Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

DispatchAction:seems fine, but doesn't work

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot, it works
(not overriding the execute method did the trick)
 
reply
    Bookmark Topic Watch Topic
  • New Topic