This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Can not update the struts form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Can not update the struts form " Watch "Can not update the struts form " New topic
Author

Can not update the struts form

jack fe
Greenhorn

Joined: Nov 10, 2009
Posts: 16
Guys:
I have a question. When the form submitted, the value of 'clientPageNumber' of 'pageInfo' of 'form' is still 0 instead of 5
during processing the action class on the server side.
How can I update the value of that?

Thanks.
The source is in the following:
jsp
<bean:define id="formPageInfo" name="TestForm" property="pageInfo"/>
<!-- pageInfo is a property object of form -->
<input type="hidden" id="tablePageNumber" name="tablePageNumber" value="<bean:write name="formPageInfo" property="clientPageNumber"/>"/>
<!-- clientPageNumber is a int property of pageInfo object -->

javascript
function submitFormFunction(){
document.getElementById("tablePageNumber").value= 5 + '';
document.myform.action = "/<%=StartupConstants.APPLICATION_WAR_VALUE%>/TestUpdateFormAction.do";
document.myform.submit();
}

Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
The name of the input field is going to need to match the name of the property in your form. So it sounds like the name of the input field should be pageInfo.clientPageNumber

Hope that helps.
jack fe
Greenhorn

Joined: Nov 10, 2009
Posts: 16
You are right.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can not update the struts form
 
Similar Threads
Iterate tag - only the first value of the form variable received when submitted.
java code and SAX
Trying to use c:out
How to update the object property on the server side by updating value in javascript before submit
iterating over a user defined class object using logic iterate