aspose file tools*
The moose likes Struts and the fly likes sending form id to another action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "sending form id to another action" Watch "sending form id to another action" New topic

sending form id to another action

Ar Reddy

Joined: Nov 03, 2008
Posts: 20
I have a showcontact.jsp it will shows all conct details with ids. for each contact need to display edit contact. edit contact is a different action and different jsp. how can I send id to that action. Please give me reply asap.

Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

If image is using for edit each contact, below code snippets can be reffered.

In corresponding action class
Ar Reddy

Joined: Nov 03, 2008
Posts: 20
Thanks for you reply, but I have a question the below is the code I am using . I need to use this contID in editcontacts.action. please give me little bit explanation too.

<s:iterator value="ShowContacts" id="contact">
<td> <s:property id="contID" value ="#contact.contactId" /></td>
<td> <s:property id="fName" value="# contact.firstName" /> </td>
<td> <s:property id="lName" value="# contact.lastName" /> </td>
<td> <s:property id="PNumber" value="# contact.PhoneNumber" /> </td>
<td> <s:property id="emailAddr" value="# contact.emailAddress" /> </td>
<td> editContact </td>

Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443

You already have the necessary information in the FORM elements and in the corresponding Form bean. You need to create a new Form bean (the one that is associated with the Edit page) and populate the details in it. This would let you show up the detail in the Edit contact page.

I am assuming you are or Struts 1.x. If you are on 2.x then use the same similar logic.

It is sorta covered in the JavaRanch Style Guide.
subject: sending form id to another action