Hai all.Can i develope Struts action class without execute(-,-
,-,-)method.Ifd it's possible plz provide some sample code.
Answer Posted / sreekanth madamanchi
If your Action class extends from Dyna Action Action, then
you can develop struts action class with out execute
method. Because in that action class we write our own
methods insted of execute method.
EXAMPLE:
public class Dispatch_Action extends DispatchAction
{
public ActionForward add(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
System.out.println("You are in add function.");
return mapping.findForward("add");
}
public ActionForward delete(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
System.out.println("You are in delete function.");
return mapping.findForward("delete");
}
public ActionForward search(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
System.out.println("You are in search function");
return mapping.findForward("search");
}
public ActionForward save(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
System.out.println("You are in save function");
return mapping.findForward("save");
}
}
| Is This Answer Correct ? | 20 Yes | 3 No |
Post New Answer View All Answers
What is the use of struts?
When should be opt for struts framework?
What is meant by custom tags?
What is struts 2 framework in java?
Where can I get a copy of struts?
In which order struts framework searches for a message bundle?
What are the custom tags?
What is action class? What are the types of action class?
Is struts action class singleton?
How do I install struts?
What is the use of form bean in struts?
Can you explain value stack?
How can we display all validation errors to user on jsp page?
What is the purpose of @conversionerrorfieldvalidator annotation?
Provide some important Struts2 constants that you have used?