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

How to carry the values to the form

Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
Hi Ranchers,
currently i am developing small web app. Here comes the requirement.
I have a user input screen with 2 textboxes and 1 dropdown.And it has 2 buttons called Add and Update
both buttons will navitage to same scrren.

Once the user clicks on ADD button i have to do some validations like, make sure the three filelds combination should not exist in the table, if it passes the validationm i am dispalying a screnn which contains textboxes.

Once the user clicks on UPDATE button, i have to validate to make sure should exist in the table, If it passes the validation i am navigationg to the next screen, which is same as ADD Screen, as a difference, all the textboxe values are prepopulateed with the existing data. This i s my requirement.

But the problems, at any point of time one button is carrying the parameters to the action,
how to carry the values to action. i am using struts. Here is my first JSP.

if i click on ADD i am able to pass these values to Action, but if i click on Update i am getting nulls in Action




if the user clicks on ADD button in the first scrren and navigates to the second scrren, on which we have 2 buttons called COnfirm ADD and Confirm Update. I have to disable the ConfirmUpdate button, vice versa to ConfirmAdd buuton is be disable when user come thru update button in the firs scren. How to achieve this.

Any help is greatly appreciated.

Thanks
Sunil Vasudevan
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
You need to check how you have used your form tags. Your elements are wrapped in one form tag and you have update button in another form tag. Hope that gives you a pointer on what you need to do.


Sunil.V<br />SCJP2, SCWCD1.4, SCBCD1.3
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Please be sure to post Struts questions in the Struts forum. I have moved this there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
Sunil Vasudevan wrote:You need to check how you have used your form tags. Your elements are wrapped in one form tag and you have update button in another form tag. Hope that gives you a pointer on what you need to do.

Thanks for your time, i even tried with one form button, still the same...
Sunil Vasudevan
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
I did not get what you meant by 1 form button.

You need two buttons - Add and Update. But they should be within one single form element. On the click on the button, your server should be able to understand if the request is for Add or Update.

Can you attach your form bean and action class?
Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
Thanks for your time Sunil. I found out a solution for that. Using a java script.. i am assigning an action to each button.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to carry the values to the form