aspose file tools*
The moose likes Struts and the fly likes passing parameter between pages in struts2 using hyperlink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "passing parameter between pages in struts2 using hyperlink" Watch "passing parameter between pages in struts2 using hyperlink" New topic
Author

passing parameter between pages in struts2 using hyperlink

sarin jacob
Greenhorn

Joined: Aug 09, 2011
Posts: 2
<a href=edit.jsp?id="<%=UserID %>">edit</a>

This is thae code i want to convert to struts2 format.

I tried

<s:url id="editUrl" action="edituser2" >
<s:param name="id" value="%{UserID}" />
</s:url>
<s:a href="%{editUrl}">Edit</s:a>

and

<s:url id="editUrl" action="edituser2" >
<s:param name="id" value="%{UserID}" />
</s:url>
<s:a href="<%=UserID %>">Edit</s:a>
but still its not working... Any 1 could help me?

In struts.xml

<action name="edituser2" class="com.action.edituseraction">
<result name="useredit" type="tiles">edituser1</result>
</action>

and in action class

package com.action;
import java.util.ArrayList;
import com.opensymphony.xwork2.ActionSupport;
public class edituseraction extends ActionSupport{
private static final long serialVersionUID = -2613425890762568273L;


private String id;

public String execute() {
System.out.println(id);
return "useredit";

}
public String getid() {
System.out.println(id);
return id;
}
public void setid(String value) {
System.out.println(id);
this.id = value;
} }


This is what i tried
sarin jacob
Greenhorn

Joined: Aug 09, 2011
Posts: 2
It worked

<a href=edituser2?&id="<%=UserID %>">edit</a>

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing parameter between pages in struts2 using hyperlink