aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DispatchAction:seems fine, but doesn Watch "DispatchAction:seems fine, but doesn New topic
Author

DispatchAction:seems fine, but doesn't work

Ioana Mihaela
Greenhorn

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) {
System.out.println("create");
return mapping.findForward("success");
}
}
in strus-config.xml:
<action-mappings >
<action
attribute="aggrForm"
input="/aggr.jsp"
name="aggrForm"
parameter="met"
path="/aggrAct"
scope="request"
type="com.yourcompany.struts.action.AggrActAction">
<forward name="success" path="/success.jsp" redirect="true"/>
</action>
</action-mappings>
in aggr.jsp:
<html:link action="aggrAct.do?met=create">Create</html:link>
or
<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
Greenhorn

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
Greenhorn

Joined: May 08, 2006
Posts: 2
Thanks a lot, it works
(not overriding the execute method did the trick)
 
wood burning stoves
 
subject: DispatchAction:seems fine, but doesn't work