1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

Struts interview questions

  • Q.What is Action Class? Explain with Example ? view answer
  • Q.How you can do Exception Handling in Struts ? view answer
  • Q. What are the Advantages of Struts ? view answer
  • How Iterate Tag used with a Map ? view answer
  • Q.How does client side validation using validator framework work in struts ? view answer
  • Q. How to do File Upload in Struts ? view answer
  • Q. What is DynaActionForm ? and How you can retrive the value which is set in the JSP Page in case of DynaActionForm ? view answer
  • Q. How to Setup validator framework in Struts ? view answer
  • Q.How does validator framework work in Struts ? view answer
  • What are Validators? and What are Basic Validators provided by the framework ? view answer
  • What is the Benefits of Using the Validator framework in struts ? view answer
  • Q. What is the Difference between DispatchAction and LookupDispatchAction ? view answer
  • Q. What is LookupDispatchAction? view answer
  • Q.How to create a multiple selections list in Struts? and retrive seleted values ? view answer
  • Q.How to create a drop down list in Struts? view answer
  • Q. What is DispatchAction ? view answer
  • Q. What is IncludeAction ? view answer
  • Q. How to Protect JSPs from direct access ? view answer
  • Q. What is ForwardAction ? view answer
  • How does reset() and Validate() method struts work ? view answer
  • Multiple buttons in struts using java script? view answer
  • Integration Struts Spring Hibernate ? view answer
  • Q.Mutli-click prevention using struts tokens with code example. view answer
  • Q. How to prevent mutli-click using struts tokens ? view answer
  • Q.How you will enable front-end validation based on the xml in validation.xml? view answer
  • Q.What is new in ServletRequest interface ? view answer
  • Q.Struts Action Chaining? view answer
  • Q.How can I avoid validating a form before data is entered? view answer
  • Q.Can I have an Action without a form? view answer
  • Q.What is Struts Validator Framework? view answer
  • Q.How you will make available any Message Resources Definitions file to the Struts Framework Environment? view answer
  • Q.What helpers in the form of JSP pages are provided in Struts framework? view answer
  • Q.How you will enable front-end client side validation based on the xml in validation.xml? view answer
  • Q.What design patterns are used in Struts? view answer
  • Q.What is role of Action Class? view answer
  • Q.What is ActionMapping and is the Action Mapping specified? view answer
  • Q.What is the ActionForm and what are important methods in ActionForm? view answer
  • Q.What is role of ActionServlet? view answer
  • Q.What is ActionServlet? view answer
  • What are the components of Struts? view answer
  • What is MVC and how it maps to Struts? view answer
  • How do you get a password field in struts ? view answer
  • Q.Struts Flow In Depth? view answer
  • Q.How does validate() method of ActionForm work ? view answer
  • Q.What are the important sections in Struts Configuration File ? struts-config.xml? view answer
  • Q.How to handle Handling multiple buttons in HTML Form ? view answer
  • Q.How does Value replacement in Message Resource Bundle work? view answer
  • What is SwitchAction? view answer
  • What is difference between LookupDispatchAction and DispatchAction? view answer
  • What is the use of LookupDispatchAction? view answer
  • What is LookupDispatchAction? view answer
  • What is the difference between ForwardAction and IncludeAction? view answer
  • What is IncludeAction? view answer
  • What is the use of ForwardAction? view answer
  • What is DispatchAction? view answer
  • What are the different kinds of actions in Struts? view answer
  • What is the difference between session scope and request scope when saving formbean ? view answer
  • Can we have more than one struts-config.xml file for a single Struts application? view answer
  • In which method of Action class the business logic is executed ? view answer
  • What is role of Action Class? view answer
  • How is the Action Mapping specified ? view answer
  • What is ActionMapping? view answer
  • Describe validate() and reset() methods ? view answer
  • What is role of ActionServlet? view answer
  • What are the core classes of the Struts Framework? view answer
  • What are the components of Struts? view answer
  • How you will enable front-end validation based on the xml in validation.xml? view answer
  • How you will display validation fail errors on jsp page? view answer
  • Give the Details of XML files used in Validator Framework? view answer
  • What is Struts Validator Framework? view answer
  • What is ActionForm? view answer
  • What is Action Class? view answer
  • How you will make available any Message Resources Definitions file to the Struts Framework Environment? view answer
  • What is ActionServlet? view answer
  • Q.How you will display validation fail errors on jsp page? view answer
  • Q.How you will enable front-end client validation based on the xml in validation.xml? view answer

!!! Struts interview questions !!!


Go to Struts Tutorials >>> new

What is difference between LookupDispatchAction and DispatchAction?



The difference between LookupDispatchAction and DispatchAction is that the actual method that gets called in LookupDispatchAction is based on a lookup of a key value instead of specifying the method name directly.

Details :

LookupDispatchAction is subclass of DispatchAction.
In case of DispatchAction, you have to declare the method name in the JSP page.
For Example :
http://localhost:8080/emp/empaction.do?step=add // IN CASE OF DispatchAction
here step=add , we are delaring method name in JSP.
or
<html:submit property="step">Add</html:submit> //IN CASE OF DispatchAction
so we can't use localization for button.


To over come both the issues below
a)method name declaration in JSP
b)can't use localization for button
We will go for LookupDispatchAction.

In the LookupDispatchAction :
For example :
If there are three operation like add, delete, update employee.
You can create three different Actions ?
AddEmpAction, DeleteEmpAction and UpdateEmpAction.
This is a valid approach, although not elegant since there might be duplication of code across
the Actions since they are related. LookupDispatchAction is the answer to this
problem. With LookupDispatchAction, you can combine all three Actions into one.

Example :
Step 1.
three buttons might be
<html:submit property="step">
<bean:message key="button.add"/>
</html:submit>
<html:submit property="step">
<bean:message key="button.delete"/>
</html:submit>
<html:submit property="step">
<bean:message key="button.update"/>
</html:submit>

//No need method name declaration in JSP . Button name from resource bundle.

Step 2.
In the the Resource Bundle. //Here you can add localization.
button.add=Add
button.delete=Delete
button.update=Update

Step 3.
Implement a method named getKeyMethodMap() in the subclass of the
LookupDispatchAction. The method returns a java.util.Map. The
keys used in the Map should be also used as keys in Message Resource
Bundle.

public class EmpAction extends LookupDispatchAction {

public Map getKeyMethodMap()
{
Map map = new HashMap();
map.put("button.add", "add");
map.put("button.delete", "delete");
map.put("button.update", "update");
}


public ActionForward add(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
{
//your logic
mapping.findForward("add-success");
}

public ActionForward delete(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
{
//your logic
mapping.findForward("delete-success");
}

public ActionForward update(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
{
//your logic
mapping.findForward("update-success");
}

}

in struts-config.xml

<action path="/empaction"
input="/empform.jsp"
type="list.EmpAction"
parameter="step"
scope="request"
validate="false">
<forward name="add-success"
path="addEmpSuccess.jsp"
redirect="true"/>
<forward name="delete-success"
path="deleteEmpSuccess.jsp"
redirect="true"/>
<forward name="update-success"
path="updateEmpSuccess.jsp"
redirect="true"/>
</action>

for every form submission, LookupDispatchAction does the
reverse lookup on the resource bundle to get the key and then gets the method
whose name is associated with the key from
getKeyMethodmap().


Flow of LookupDispatchAction:
a) Form the button name "Add" get the key "button.add" fro resource bundle.
b) then in the Map getKeyMethodMap() find the value associated with the key "button.add".
c) value from the Map is "add" . then call add() method of the same action class.


more details :
http://www.techforum360.com/forum/viewthread?thread=135

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy