• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

LookupDispatchAction with link, Please Help Me!!!

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an action class MyAction extends LookupDispatchAction, there are several buttons and a link in JSP page,
delete, add, update, display etc. actions.
My struts-config.xml:
<action
path="/doSomething"
type="MyAction"
name="myForm"
scope="request"
validate="true"
input="/myAction.jsp"
parameter="methodd">
</action>


In MyAction class:
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.insert", "insert");
map.put("button.delete", "delete");
map.put("link.showLink", "showLink");
return map;
}

public ActionForward insert(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
System.out.println("do something for insertion");
...........
}

public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
System.out.println("do something for deletion");
...........
}

public ActionForward showLink(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
System.out.println("do something for displaying");
...........
}


In my JSP:
<html:submit property="methodd">
<bean:message key="button.insert"/>
</html:submit>
<html:submit property="methodd">
<bean:message key="button.delete"/>
</html:submit>

There is a link, when click it, it will do some action (call the showLink() method in MyAction class ) as well.
<a href="doSomething.do?methodd=showLink">
<bean:message key="link.showLink"/>
</a>,
But, it Can NOT work properly when click the link.
Error msg is : Request[/doSomething] does not contain handler parameter named methodd

But, if i use a Button instead of the link, everything works fine
<html:submit property="methodd">
<bean:message key="link.showLink"/>
</html:submit>

However, I have to use a link to perform this action.
I check the syntax of the link (<a href) in jsp, it should be OK.

Anybody can help me? Any suggesions of how to use a link instead of using a button in LookupDispatchAction?
I am going to be dead, :--((


Thanks a million,

Sunflower
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"sunflower Seas",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we try to strictly enforce. Please re-read this document and edit your display name in order to comply. Thanks in advance, and we look forward to seeing you around the Ranch.
 
huali ouyang
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I have updated my profile,
i'm sorry.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Fiona Xue:
OK, I have updated my profile,
i'm sorry.



Not a problem, Fiona. Welcome!
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<a href='doSomething.do?methodd=<bean:message key="link.showLink"/>'>
<bean:message key="link.showLink"/>
</a>

Cheers!
 
huali ouyang
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it, you are right, it should be the value of the key in resource boundle instead of the method name.

Thanks a lot.

:-))
reply
    Bookmark Topic Watch Topic
  • New Topic