aspose file tools*
The moose likes Struts and the fly likes Need help on basic struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Need help on basic struts" Watch "Need help on basic struts" New topic
Author

Need help on basic struts

Venkatesh Goriparthy
Greenhorn

Joined: Jan 09, 2008
Posts: 15
Hi All,

I am learning struts. I have an issue in doing my hands on.

In my form, I have an textbox, whose value can be populated from database and have an update button , where the user can change the value in the textbox and click on update button. this value should get updated in database. this updation should be tracked as an event. The whole form should not get submitted.

After this not knowing what I need to do....
Please help me how i need to do this.

Thanks!!


Prince Rulz
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The only way to cause an update to the database without submitting the form is to use AJAX, which is way beyond the scope of a beginning Struts project. Is this a school assigment?


Merrill
Consultant, Sima Solutions
Venkatesh Goriparthy
Greenhorn

Joined: Jan 09, 2008
Posts: 15
can we not even refresh the page.. like submitting the page and redirecting to same page or forward the action.
my java script is like this on click of the button
pForm.action="updateUserName.do?method=executeAction&userName="+userName+"&flag="+flag;
pForm.submit();

This is giving blank page aftr clicking on the button. and in the url v can see the changed username.
[ July 16, 2008: Message edited by: Venkatesh Goriparthy ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Yes, forwarding to the same page is the right way to handle this. Just be careful, though, with the words you use to describe a problem. Saying "The whole form should not get submitted" is not the same as saying "after submitting the form, the same page should be displayed".
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need help on basic struts
 
Similar Threads
Populate form fields from a list of data!
problem in getting values using EL
saving the details in when i click next and previous buttons
making the textbox readonly
How to set a property's value thats part of a ArrayList using Javascript.