This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes DispatchAction:seems fine, but doesn't work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DispatchAction:seems fine, but doesn Watch "DispatchAction:seems fine, but doesn New topic

DispatchAction:seems fine, but doesn't work

Ioana Mihaela

Joined: May 08, 2006
Posts: 2
Hi,I have the following code:
public class AggrActAction extends DispatchAction {
public ActionForward execute(...){...}
public ActionForward create(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response) {
return mapping.findForward("success");
in strus-config.xml:
<action-mappings >
<forward name="success" path="/success.jsp" redirect="true"/>
in aggr.jsp:
<html:link action="">Create</html:link>
<html:link action="/aggrAct?met=create">Create</html:link>
both links lead to the execution of execute method in AggrActAction and not create

Does anyone have a clue why it doesn't work?
Thank you.
Joseph Erickson

Joined: May 05, 2006
Posts: 10
You shouldn't be overridding the execute method, or at least you need to call super.execute() when you're done. The execute method of the DispatchAction is what is looking at that parameter and calling your create() method.
Ioana Mihaela

Joined: May 08, 2006
Posts: 2
Thanks a lot, it works
(not overriding the execute method did the trick)
It is sorta covered in the JavaRanch Style Guide.
subject: DispatchAction:seems fine, but doesn't work
Similar Threads
Cannot find bean in any scope
Errata : ActionForward
how to get value of hmtl:link in action class?
Not able to see the errors on JSP
Newbie Question