aspose file tools*
The moose likes Struts and the fly likes Need help in retrieving html:link paramter value in Action class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply locked New topic
Author

Need help in retrieving html:link paramter value in Action class.

yogi reddy
Greenhorn

Joined: Aug 10, 2009
Posts: 18
Hello All,

I am learning sturts 1.3.8 by doing a registaration application.
So far I have completed the "add a new user & list the users" workflow successfully.

I am having a little challenge in editing an user workflow. . I would need someone's help in this. (I will keep trying myself as well)

snapshot of manageusers.jsp
---------------------------
<nested:iterate name="userDetailsForm" property="userDetails">
<tr>
<td>
<html:link action="/editNow" paramName="userDetailsForm" paramProperty="userId" paramId="userId">
<nested:write property="userId" />
</html:link>
</td>
<td>
<nested:write property="firstName" />
</td>
<td>
<nested:write property="lastName" />
</td>
<td>
<nested:write property="email" />
</td>

</tr>
</nested:iterate>


This is the output rendered from manageusers.jsp all the UID WILL HAVE HYPERLINK
--------------------------------------------------------------------------------

UID430 Yogesh Reddy a@b.com
UID440 James Wallach 1@2.com
UID450 Test Tester we@we.com


struts-config.xml
-----------------

<action path="/editNow"
scope="request"
type="com.registration.action.EditUserAction">
<forward name="success"
path="/pages/edituser.jsp" />
</action>

EditUserAction.java
-------------------

public class EditUserAction extends Action {

public ActionForward execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response) {
try{
System.out.println("I am in EditUserAction user id : "+request.getParameter("userId"));
} catch(Exception e) {
System.out.println("I am in EditUserAction Exception : "+e.getMessage());
}
return mapping.findForward(Constants.SUCCESS);
}
}

What I need from you guys ?
***************************

Currently when I click the UID's I am getting the request parameter as null in EditUserAction.
I am sure that I am NOT appending the UID to the hyperlink in manageusers.jsp
because I do not know how to do that (tried couple of approaches but in vain ).

Any thoughts or suggestions on how to do this? Thanks in advance for your time.

Cheers,
Yogesh Reddy
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Duplicate Post, closing this one...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help in retrieving html:link paramter value in Action class.