• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing param in Struts.xml Action Mapping

 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to access the param property in url tag... plese see the following code for details...

<s:url action="manageModules" id="getModules" namespace="/secure" method="getModules">
<s:param name="page">modulesList.jsp</s:param>
</s:url>

<s:a href="%{getModules}" theme="ajax" targets="mainContainer" cssClass="menuTbLink" indicator="loadingImg" showLoadingText="false">
<div class="menuTb">Modules</div>
</s:a>

I want to access the moduleList.jsp param in above jsp code to my struts.xml file to forward to a jsp page as follows

<action name="manageRoles" method="{1}" class="secure.ManageModule">
<result name="success">/view/${page}</result>
</action>

But it does not work. So can you please help me ?

Thanks

Rahul

 
Ankit Garg
Sheriff
Posts: 9520
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Here what does method="{1}" mean?? You've not used wildcard mapping in your action. The result seems to be fine to me, it will use the property named page in your action to decide the success mapping of this action. Everything that you need to know in this regard is covered in action configuration, wildcard mapping and result configuration...
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello Ankit,

Thanks for reply...

{1} represents the method name which we have received through the id in url tag...

My action is executed successfully, but i didn't get the JSP page.

Thanks

Rahul
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But like he said, you're not using wildcard mapping, so that won't work (and I wouldn't like it anyway).

Does your action have a "page" property? Is the HTML rendering as you'd expect?

This seems like a really klunky way to do things, though.
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Extremely Sorry for Late Reply....

It's working now... I have forgotten to add property to my Action....

Thanks

Rahul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic