| Back to Questions Page |
| |
| Question |
what is the difference between @include page and @include file |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | <jsp:include page="page.jsp" >
is action which include the output of page.jsp at
dyanamically.Instead of copying all content of page.jsp
Container transalte ,compiles page.jsp separtly and copy
the ouput of page.jsp to current page.It means it's
dyanamic inclusion.
<@include file="page.jsp">
it is directory which copy all content's of page.jsp to
current jsp page and then complete current page is
translated and compiled. It is static inclusion of file
which means copy all source code to current page as it is.  |
| Alim Atar |
| |
| |
| Question |
what is the difference between ArrayList and Vector |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
| This Interview Question Asked @ Wipro , Sasken, KPIT Cummins |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | 1. Arraylist is not synchronized while vector is.
2. Arraylist has no default size while vector has a default
size of 10.  |
| Mohammed Salim |
| |
| |
| Answer | Arraylist is not synchronized where as Vector is
synchronized.
No default size for Arraylist where as Vector is having a
default size of 10.  |
| Harmeet |
| |
| |
|
|
| |
| Answer | i would like to add a new point to above answers.
we can specify the increment size with the vector and with
array list we cannot  |
| Narasimha |
| |
| |
| Answer | ArrayList is non synchronized.Vector is
synchronized.ArrayList is very fast because non
synchronized.we can specify the increment size with the
vector and with arrayList we cannot  |
| Dara |
| |
| |
| Answer | Hi...
ArrayList is not synchronized(not Thread-safe)but Vector is
Synchronized(Thread-safe)
ArrayList gives u better performance than Vector  |
| Devarathnam |
| |
| |
| Answer | I am adding some more points to the above answers.
Array list and Vector have one in common. They both
implement Random Access.
It is possible to provide synchronization using Array List
by using the utility methods in Collection.  |
| Ganesh Nagalingam |
| |
| |
| Answer | for addition of 3rd answer incresing capacity in vector
using with ensureCapacity(int x) method  |
| Surya |
| |
| |
| Answer | ArrayList and vector both are dynamically growing arrays.
ArrayList is not thread safe where as vector is thread safe.
vector is legacy class and ArrayList is newly added.
by default ArrayList capacity is 0 where as Vector intial
capacity is 10.
vector is growing by its size doubled.
ArrayList is increse by its size half(50%)  |
| M.sridhar |
| |
| |
| Answer | ArrayList is having only those method defined within its
collection class but in case of vector it is having its own
method which is not a part of its collection class.  |
| Bhushan Singh |
| |
| |
| Answer | import java.util.*;
public class VectorDemo{
public static void main(String[] args){
Vector<Object> vector = new Vector<Object>();
int primitiveType = 10;
Integer wrapperType = new Integer(20);
String str = "tapan joshi";
vector.add(primitiveType);
vector.add(wrapperType);
vector.add(str);
vector.add(2, new Integer(30));
System.out.println("the elements of vector: " + vector);
System.out.println("The size of vector are: " +
vector.size());
System.out.println("The elements at position 2 is: " +
vector.elementAt(2));
System.out.println("The first element of vector is: " +
vector.firstElement());
System.out.println("The last element of vector is: " +
vector.lastElement());
vector.removeElementAt(2);
Enumeration e=vector.elements();
System.out.println("The elements of vector: " + vector);
while(e.hasMoreElements()){
System.out.println("The elements are: " +
e.nextElement());
}
}
}  |
| Tamilvendan |
| |
| |
| Question |
what is the difference between HashMap and Hashtable |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
| This Interview Question Asked @ Value-Labs |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Hashmap work as like as Hashtable but hashtable is
synchronised hash map was not sychronized
hashtable does not allow null values
hashmap allows null values  |
| Sarithareddy |
| |
| |
| Answer | The HashMap class is roughly equivalent to Hashtable,
except that it is unsynchronized and permits nulls.
(HashMap allows null values as key and value whereas
Hashtable doesnt allow).
HashMap does not guarantee that the order of the map will
remain constant over time. HashMap is unsynchronized and
Hashtable is synchronized.  |
| Arun Rajesh |
| |
| |
| Answer | class Hashtable was part of the original java.util and is a
concreate implementation of a Dictionary class. In java2 it
is reengineering it so that it also implements the Map
interface.
Thus it is now integrated into the collections framework.
class HashMap implements Map interface.
Because, Hashtable is a concreate implementation of
Dictionary class, is Legacy class, all legacy classes are
synchronized. So,thats why Hashtable is sunchronized.
I can say that both Hashtable and HashMap are same, accept
synchronization.  |
| Tarun Kumar |
| |
| |
| Answer | Two main differences between Hastable and HashMap are
1. Hashtable is synchronised but HashMap is not.
2. Hashtable does not allow "null" key but HashMap allows
"null" Key.
However one point to remember is that only one "null" key is
allowed in HashMap but multiple "null" values are allowed in
HashMap.  |
| Chandan Phukan |
| |
| |
| Question |
What are Struts properties?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
| This Interview Question Asked @ VI-eTrans |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | The framework uses a number of properties that can be
changed to fit your needs. To change any of these
properties, specify the property key and value in an
struts.properties file. The properties file can be locate
anywhere on the classpath, but it is typically found
under /WEB-INF/class
The list of properties can be found in struts-
default.properties (inside struts2.jar).  |
| Saran V |
| |
| |
| Answer | Properties files prepare the resource bundles with all
String messages used in your web application. Because
properties files are text files, they provide a
straightforward way of internationalizing our application.
For Struts web applications, you can use the
PropertyResourceBundle class, which is one of the standard
Struts implementations of the java.util.ResourceBundle
class. This implementation allows web applications based on
Struts to define resources using the "name=value" syntax.  |
| Bindhu |
| |
| |
| Question |
In Struts Programming which is the controller,which is the
model? |
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | The ActionServlet class is the controller and the action
class is the model.  |
| Guest |
| |
| |
| Answer | 1 The ActionServlet and Aciton class is the controller.
and From Action Class's execute mathod, we can call other
DAO layer or any other layer.
so Action class is a Model as well as Controller  |
| Jimmi Prajapati |
| |
| |
| Answer | In Struts programming ActionServlet is the controller.
* Action class also part of the controller only.
We have a Business layer/data or business service in
between the session facade and data access object (DAO) is
called the Model.  |
| Sathiyamoorthi |
| |
| |
| Answer | In struts,Action servlet,Request Processor,Action class and
ActionForm together form Controller.Struts doesn't provide
any component in Model Layer.  |
| Ganeshram |
| |
| |
| Answer | Action classes, Servlets and Request Processing will come
under controller and Business logic (Generally EJB) will
come under Model  |
| Anas |
| |
| |
| Answer | ActionServlet class is the controller & Action Class
is the model.  |
| Atul Kumar Yadav |
| |
| |
| Answer | the above given answare no 3 is correct,i thnk so  |
| Deependra |
| |
| |
| Answer | Controller components : Action Servlet,Request
Processor,Action class,struts-config,xml,web.xml
Model components : Actioform Beans
Java Beans or Enterprise java Beans
Relational Database Accesss
these are the main thing in this components  |
| Narendher Sharma |
| |
| |
| Answer | * A Model contains business logic and data.
* A Controller manages overall application flow and
validation.  |
| Kiran |
| |
| |
| Question |
Wat is Difference between Mvc1 architecture and Mvc2
Architecture? |
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
| This Interview Question Asked @ HCL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | MVC1 it combines the presentation logic with the business
logic where as MVC2 it seperates the presentation logic
from business logic  |
| Guest |
| |
| |
| Answer | in mvc1 one webcompoent is responsile for halding requst
and sending responce using helper
where as in mvc2 one webcomponent is responcible for
handling requst and anthor webcomponent is responceble for
sending responce using helper  |
| Reddy |
| |
| |
| Answer | In MVC1 the controller part is controlled and developed by
the developer only.. But in MVC2 the controller part is
developed by the container itself..  |
| Ram |
| |
| |
| Answer | In MVC1 since business logic and presentation logic is
combined so web developer for (Bus.Logic) and web designer
for(pres.logic) cannot work simultaounlsy
But in mvc2 both can work indepenedently.  |
| Jagadish Babu |
| |
| |
| Answer | MVC1 1)No separation of presentation layer and business layer.
2)Doesnt promote reusability of application components.
3)its for simple applications.
MVC2
1)ease of maintenance resulting from separation of
presentation layer and business layer.
2)Reusability of components
3)controller presents a single point of entry to the web
application providing cleaner means of implementing security
and state mgmt.  |
| Smitha |
| |
| |
| Answer | In MVC1 Both the controller and model are the jsp ,so No
seperation between business logic and presentation logic
where as in MVC2 controller is servlet and model is the
java class  |
| Prasanna |
| |
| |
| Answer | In case of MVC1, the JSP page acts as Controller and view
(i.e we need to provide the control logic and presentation
logic as part of Jsp page)
In case of MVC2, the ActionServlet acts as a controller and
the JSP page acts as view.  |
| Raghavendra |
| |
| |
| Answer | in mvc11 jsp acts as a controller
jsp will handle all the req
in mvc2 servlet acts as a controller  |
| Kalyan |
| |
| |
| Answer | MVC1 Architecture has a Model part as (classes,Bean classes
connectivity of Database), View part as jsp pages,and here
only one controller Servlet is used .here we send request
form browser by jsp page it goes to servlet(controller)
servlet get information from the request acording to request
it fatch information form classes(Models) and give responce
to the view part( to the Jsp Page).
In MVC2 Architecture we use Struts FrameWork which is a Open
Source FrameWork.Here Browser send Http Request to the
ActionServlet that Reads StrutsConfig.XML (these two play
role of Controller) then it goes to Model part acording to
request by Browser. Here in Action part we have DataBase,
ActionForm(Basicly Beans or EJB) and that give a response to
View Part As Jsp Page to the Browser.  |
| B.sivaramakrishnan |
| |
| |
| Question |
What is Request Dispatcher and what is Request Process?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Requestprocessor is a controller in stutrs it receives
request from browser and makes decision where to send the
request for further processing based on servlet-congig.xml
Request Dispatcher Defines an object that receives requests
from the client and sends them to any resource (such as a
servlet, HTML file, or JSP file) on the server  |
| Guest |
| |
| |
| Answer | Controller class ActionServlet is he request Dispatcher.
where as Action classes are request processer.  |
| Srinivas |
| |
| |
| Question |
What is Struts Frame Work Architecture(With Diagram) ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
| This Interview Question Asked @ CMC , Ms, Wibro |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Model Components
Model components provide a "model" of the business logic or
data behind a Struts program. For example, in a Struts
application that manages customer information, it may be
appropriate to have a "Customer" Model component that
provides program access to information about customers.
It's very common for Model components to provide interfaces
to databases or back-end systems. For example, if a Struts
application needs to access employee information that is
kept in an enterprise HR information system, it might be
appropriate to design an "Employee" Model component that
acts as an interface between the Struts application and the
HR information system.
Model components are generally standard Java classes. There
is no specifically required format for a Model component,
so it may be possible to reuse Java code written for other
projects.
View Components
View components are those pieces of an application that
present information to users and accept input. In Struts
applications, these correspond to Web pages.
View components are used to display the information
provided by Model components. For example, the "Customer"
Model component discussed above would need a View component
to display its information. Usually, there will one or more
View components for each Web page in a Struts application.
View components are generally built using JavaServer Page
(JSP) files. Struts provides a large number of "JSP Custom
Tags" (sometimes referred to as Struts Tags) which extend
the normal capabilities of JSP and simplify the development
of View components.
Controller Components
Controller components coordinate activities in the
application. This may mean taking data from the user and
updating a database through a Model component, or it may
mean detecting an error condition with a back-end system
and directing the user through special error processing.
Controller components accept data from the users, decide
which Model components need to be updated, and then decide
which View component needs to be called to display the
results.
One of the major contributions of Controller components is
that they allow the developer to remove much of the error
handling logic from the JSP pages in their application.
(After all, if errors in processing occur, the Controller
component forwards to an error-processing View component,
not the primary results View component.) This can
significantly simplify the logic in the pages and make them
easier to develop and maintain.
Controller components in Struts are Java classes and must
be built using specific rules. They are usually referred to
as "Action classes."
I unable to draw here........hope this will help you  |
| Farookh |
| |
| |
| Question |
what is the advantages and diadvantages of Struts?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Few Disadvantage are mentioned in the below link. Struts
have disadvantages mainly on performance of the
application. Especially when using advanced tag like nested-
loop etc, Resulting in creating many Forms object then
required.
In struts , their is no facility of backward flow.
Suppose we are in page 1 and when we submit it calls action
mapping page2.Their may be lot of variable stored in
session , which is available to page2.Now we wish to go
page1 from page 2, for this we have to call the action
mapping of page1. But struts flow is always in forward
direction. So when we call page 1, values stored in session
never get reversed.So it reduces the performance.
To resolve this problem of struts, Their is a framework
called Web Flow Nevigation Manager(WFNM) of
Sourgeforge.net.This framework can be integrated with struts  |
| Siddhartha Chakraborty |
| |
| |
| Question |
How do you know what to give for the "path " under in
struts-config.xml ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | path in struts-config.xml should match with action
attribute in form tag of any jsp  |
| Narender |
| |
| |
| Question |
Is struts thread safe? |
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
| This Interview Question Asked @ HCL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Struts is not only thread safe, it is thread dependant.
Struts instansiate each Action only once and allow all
other request to be handled by the same action  |
| Eugene Gruzin |
| |
| |
| Answer | Struts frame work is thread safe onle. we can make a struts
as non thread safe using servlet page as Single thread
model,and jsp using the page attribute isThreadSafe.  |
| Naresh |
| |
| |
| Question |
What is difference between perform() used in struts1.0 and
execute() used in 1.1 ?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
| This Interview Question Asked @ Infotech |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Using perform() u have throw IOException,ServletException.
But where as execute() method throws Generic Exception.
i.e
public ActionForward perform(ActionMapping am,ActionForm
af,HttpServletRequest req,HttpServeltResponse res) throws
ServletException,IOException{...some stuff...}
public ActionForward execute(ActionMapping am,ActionForm
af,HttpServletRequest req,HttpServeltResponse res) throws
Exception{...some stuff...}
So no need to handle all the exceptions caught programatically.  |
| Srilakshmi |
| |
| |
| Answer | In struts1.1, we use perform method ie is deprecated now.
So after struts 1.1 we use execute method  |
| Gurmeet Singh |
| |
| |
| Question |
How many types of action clases are there in stuts and
their uses?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
| This Interview Question Asked @ TCS |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | 1)Forward Action
2)Include Action
3)Dispatch Action
4)Switch Action.........(one more Action is there)  |
| Srinivas |
| |
| |
| Answer | 1.Forward Action
2.Dispatch Action
3.include Action
4.lookUpDispatch Actioc
5.MappingDispatch Action
6.switch Action
7.LocaleDispatch Action  |
| Surendraeddy.m |
| |
| |
| Answer | THERE ARE FOUR TYPES.
1)
DispatchAction: In this type of aggregation, the action
class must extend DispatchAction class as shown.
public final class CRUDDispatchAction extends
DispatchAction {
public ActionForward create(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
return (mapping.findForward("success"));
}
...
and the action mapping will be as
<action path="/crudDispatchAction"
type="com.companyname.projname.CRUDDispatchAction"
name="formName" scope="request" input=" homeDef"
parameter="methodToCall">
<forward name="success" path="targetDefName"/>
</action>
in your jsp you can call this action as
<html:link action="crudDispatchAction?
methodToCall=create">Create</html:link>
...
Observe that the above class extends DispatchAction and so
you cannot use this method if your class already extends
your (some) super class (eg., the class where the session
is validated/invalidated). Here the user has to send a
query string variable (methodToCall) to set the action name
to call.
2)
ActionDispatcher: This flavor of aggregation is same as
DispatchAction except that we need not extend
ActionDispatcher, so we can use this method even if our
class extends a super class. The following code snippet
shows this scenario.
public final class CRUDActionDispatcher extends Action {
protected ActionDispatcher dispatcher = new ActionDispatcher
(this, ActionDispatcher.DEFAULT_FLAVOR);
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
return dispatcher.execute(mapping, form, request, response);
}
The DEFAULT_FLAVOR field suggests that the default
parameter is "method" if none is specified as parameter in
struts-config.xml (eg,. methodToCall).
ActionDispatcher flavor also needs methodToCall parameter
to be set (using hidden variable or a query string) as in
case of DispatchAction.
3)
LookupDispatchAction: This type of aggregation is useful in
situations where in you have multiple submit buttons in a
single form. The class must extend LookupDispatchAction.
However, the great thing about this type is that its java
script free. That means, you need not set any hidden
variables or pass query string however, you must use submit
buttons as shown.
<html:submit property="submit"><bean:message
key="button.create"/></html: submit >
<html:submit property="submit"><bean:message
key="button.read"/></html: submit >
...
The example Action class will be as follows
public class CRUDLookUpDispatchAction extends
LookupDispatchAction {
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.create", "create");
?
return map;
}
public ActionForward create(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
return (mapping.findForward("success"));
}
Observe the getKeyMethodMap() method. The submit button
names are specified in a Map and their keys comes from
MessageResources file. Struts picks up the name from this
file and redirects it to the value specified in the Map.
The calling code in jsp however has multiple submit buttons
only differing in their names.
4)
MappingDispatchAction: This aggregation extends
MappingDispatchAction class. This is the most useful type
among the four types available. But as seen in other cases,
you can use this type only when your action does not extend
any other action. The good thing about this type is that
the action mappings can differ and so need not be the same
as in all other cases. To illustrate this consider the
below mappings.
<action path="/createMappingAction"
type="com.bodhtree.CRUDMappingDispatchAction"
scope="request" input="homeDef" parameter="create">
<forward name="success" path="targetDef"/>
</action>
<action path="/readMappingAction"
type="com.bodhtree.CRUDMappingDispatchAction" name="
formName" scope="request" input="homeDef" parameter=" read">
<forward name="success" path="targetDef"/>
</action>
Notice that in the first action mapping, there is no form
bean while in the second the bean name is specified. This
means that the user has the flexibility to change the
mapping according to his needs and hence not been contained
to use a constant mapping for all the CRUD actions. Note
that in all the other types of aggregations, we must use
the same mapping for all the CRUD actions.  |
| Saranv |
| |
| |
| Answer | there r only 5 actions:
1. forward action
2. include action
3. dispatch action
4. lookup dispatch action
5. switch action  |
| Amit Verma |
| |
| |
| Answer | Different types of action classes
1).Action Class
2).IncludeAction Class
3).ForwardAction Class
4).DispatchAction Class
5).LookUpDispatchAction Class
6).SwitchAction Class
In this we use the Action Class for implementing the
business logic
We use the IncludeAction,ForwardActions,
Suppose if you want to use your servlet application or jsp
application(which are developed previously and u want to
resue it ) should follow the struts MVC pattern then you
can acheieve that using these classes
We use the DispatchAction when you want have to perform
multiple actions through one form
We can use the switchAction when you want to use the
resources from other modules of your struts application
LookupDispatchAction is similer to DispatchAction.
this information is very useful to the guys who has the
intrest to learn struts
All the best.........  |
| Ramakrishna Goud.n |
| |
| |
| Answer | The ForwardAction acts as a bridge from the current View
(JSP) and the pages it links to. It uses the
RequestDispatcher to forward to a specified Web resource. It
is the glue that allows you to link to an action instead of
directly to a JSP.  |
| Smitha |
| |
| |
| Answer | there are 7 type of classes--
1.dispatch action class
2.forward action class.
3.include action class.
4.locale action class.
5.lookup dispatch class.
6.mapping dispatch class.
7.switch class.  |
| Sarika Singh |
| |
| |
| Question |
How to set email notification using struts.Plz give the
example code?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
| This Interview Question Asked @ HCL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Solution is to implement an email notification system. The
notification system will generate an email message whenever
the application detects an error. If you are already using
a standard logging framework like log4j.
import java.util.logging.*;
public class JDKLoggingExample
{
private static final Logger log =
Logger.getLogger(JDKLoggingExample.class.getName());
public static void main(String[] args)
{
try
{
log.fine("This is a fine message.");
int i = Integer.parseInt("Hello world");
}
catch (java.lang.Exception ex)
{
log.log(Level.SEVERE, "Caught an exception",
ex);
}
}
---------------------------------------------------------
import org.apache.log4j.*;
public class Log4jExample
{
private static final Logger log =
Logger.getLogger(Log4jExample.class);
public static void main(String[] args)
{
try
{
log.debug("This is a debug message.");
int i = Integer.parseInt("Hello world");
}
catch (java.lang.Exception ex)
{
log.error("Caught an exception", ex);
}
}
}  |
| Anas |
| |
| |
| Question |
How to create validations?what are struts validation
components? |
Rank |
Answer Posted By |
|
Question Submitted By :: Pvr |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | We can create two types of validations
1).Manually
2).Automated
we can create manual validation by implementing the
validate method in ActionForm ,DynaActionForm,Validator
or DynaValidatorForm
Also ,
we can use the automated validation like
Integer,email,creditcard etc., by providing the validation
in the following xml files.,
validation.xml
validation_rules.xml  |
| N.ramakrishna Goud |
| |
| |
|
| |
|
Back to Questions Page |