You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mail <re...@attbi.com> on 2002/10/12 09:20:12 UTC

Sending data from JSP back to the Action Class

This is probably a piece of cake for most of you, but I am having a heck of
a time with it.

I create a table of data in a JSP using the <Nested:Iterate> tag.  One
column of the table, the Terminate Date, is a text field.  The idea being
that the user can modify the Terminate date, click on the Update link in the
row next to it, and that row's data is sent back to the Action class and the
Terminate Date is updated with the modified data.

Unfortunately, when I click on the link, the original Terminate Date is sent
back to the Action class, not the modified Terminate Date, as if no change
was made.  Any ideas will be greatly appreciated?

JSP code snippet from "rulesUpdate.jsp":
<nested:iterate property="gridArray">
	<td><nested:write property="gridRuleNbr" filter="true"/></td>
	<td><nested:write property="payorId" filter="true"/></td>
	<td><nested:text property="terminateDate" size="10" maxlength="10"/></td>
	<td><<a href='/grid/web/primary_jsps/rulesUpdate.do?action=updateRow
		  &gridRuleNbr=<nested:write property="gridRuleNbr"/>
		  &terminateDate=<nested:write
property="terminateDate"/>'>Update&nbsp;</a></td>
	</tr>
</nested:iterate>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Sending data from JSP back to the Action Class

Posted by mail <re...@attbi.com>.
When I click on this link, the fields you see in the link (action,
gridRuleNbr, and terminateDate) in the JSP snippet are ALL made available to
the Action class via request.getParameter("fieldname").  That doesn't seem
to be a problem, the problem I am having is that - although the user has
changed the terminateDate - the original value in the terminateDate property
is sent, not the changed value.

Your right though, linking to another "detail" page would be easier, but
that isn't what the user wants and I think that someone on this list
probably knows how to do what I need.

Thanks,
Ron

-----Original Message-----
From: James Mitchell [mailto:jmitchtx@telocity.com]
Sent: Saturday, October 12, 2002 5:18 AM
To: Struts Users Mailing List
Subject: RE: Sending data from JSP back to the Action Class


You can't click on a link to submit data.  You must submit an html form to
the server.  You do have a form right?  I don't see it in the sample code
you provided.

If you want to use a link to do this, you will need to use some JavaScript.
However, it appears that you are using multiple rows, each with it's own
text fields and that you want to update a certain row's data by clicking the
link for that row.  I would not advise doing it this way.

It is much easier to link to a detail page, which displays the details for
that row of data, and then have the user submit the form to an action that
can update the data.

HTH


James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

> -----Original Message-----
> From: mail [mailto:rea-family@attbi.com]
> Sent: Saturday, October 12, 2002 3:20 AM
> To: struts-user@jakarta.apache.org
> Subject: Sending data from JSP back to the Action Class
>
>
> This is probably a piece of cake for most of you, but I am having
> a heck of
> a time with it.
>
> I create a table of data in a JSP using the <Nested:Iterate> tag.  One
> column of the table, the Terminate Date, is a text field.  The idea being
> that the user can modify the Terminate date, click on the Update
> link in the
> row next to it, and that row's data is sent back to the Action
> class and the
> Terminate Date is updated with the modified data.
>
> Unfortunately, when I click on the link, the original Terminate
> Date is sent
> back to the Action class, not the modified Terminate Date, as if no change
> was made.  Any ideas will be greatly appreciated?
>
> JSP code snippet from "rulesUpdate.jsp":
> <nested:iterate property="gridArray">
> 	<td><nested:write property="gridRuleNbr" filter="true"/></td>
> 	<td><nested:write property="payorId" filter="true"/></td>
> 	<td><nested:text property="terminateDate" size="10"
> maxlength="10"/></td>
> 	<td><<a href='/grid/web/primary_jsps/rulesUpdate.do?action=updateRow
> 		  &gridRuleNbr=<nested:write property="gridRuleNbr"/>
> 		  &terminateDate=<nested:write
> property="terminateDate"/>'>Update&nbsp;</a></td>
> 	</tr>
> </nested:iterate>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Sending data from JSP back to the Action Class

Posted by James Mitchell <jm...@telocity.com>.
You can't click on a link to submit data.  You must submit an html form to
the server.  You do have a form right?  I don't see it in the sample code
you provided.

If you want to use a link to do this, you will need to use some JavaScript.
However, it appears that you are using multiple rows, each with it's own
text fields and that you want to update a certain row's data by clicking the
link for that row.  I would not advise doing it this way.

It is much easier to link to a detail page, which displays the details for
that row of data, and then have the user submit the form to an action that
can update the data.

HTH


James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

> -----Original Message-----
> From: mail [mailto:rea-family@attbi.com]
> Sent: Saturday, October 12, 2002 3:20 AM
> To: struts-user@jakarta.apache.org
> Subject: Sending data from JSP back to the Action Class
>
>
> This is probably a piece of cake for most of you, but I am having
> a heck of
> a time with it.
>
> I create a table of data in a JSP using the <Nested:Iterate> tag.  One
> column of the table, the Terminate Date, is a text field.  The idea being
> that the user can modify the Terminate date, click on the Update
> link in the
> row next to it, and that row's data is sent back to the Action
> class and the
> Terminate Date is updated with the modified data.
>
> Unfortunately, when I click on the link, the original Terminate
> Date is sent
> back to the Action class, not the modified Terminate Date, as if no change
> was made.  Any ideas will be greatly appreciated?
>
> JSP code snippet from "rulesUpdate.jsp":
> <nested:iterate property="gridArray">
> 	<td><nested:write property="gridRuleNbr" filter="true"/></td>
> 	<td><nested:write property="payorId" filter="true"/></td>
> 	<td><nested:text property="terminateDate" size="10"
> maxlength="10"/></td>
> 	<td><<a href='/grid/web/primary_jsps/rulesUpdate.do?action=updateRow
> 		  &gridRuleNbr=<nested:write property="gridRuleNbr"/>
> 		  &terminateDate=<nested:write
> property="terminateDate"/>'>Update&nbsp;</a></td>
> 	</tr>
> </nested:iterate>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>