aspose file tools*
The moose likes Struts and the fly likes Accessing param in Struts.xml Action Mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Accessing param in Struts.xml Action Mapping" Watch "Accessing param in Struts.xml Action Mapping" New topic
Author

Accessing param in Struts.xml Action Mapping

Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
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

Joined: Aug 03, 2008
Posts: 9280
    
  17


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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138

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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Dec 01, 2007
Posts: 138

Extremely Sorry for Late Reply....

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

Thanks

Rahul
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing param in Struts.xml Action Mapping
 
Similar Threads
Localization with Struts2 help, not persisting to any other pages
File download in struts2
Struts 2 i18n problem
Problem With I18n feature of Struts2
downloading a file struts2