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 Need suggestions and help for my scenario in struts 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 "Need suggestions and help for my scenario in struts" Watch "Need suggestions and help for my scenario in struts" New topic
Author

Need suggestions and help for my scenario in struts

kaushal sharma
Greenhorn

Joined: Oct 04, 2009
Posts: 26
Hi All,

As I am new to Struts, I need to develop a scenario.

I need to create a select box on my JSP page the values in this select box will be coming from the database.

When I select an option from the select box, the other values from the same table will be populated on the same JSP page but in a tabular format.

The values will be in a form format, including some text boxes and checkboxes.

Kindly suggest me with some examples or scenario.


-Thanks & Regards,
Kaushal K. Sharma

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Sounds like you want an Ajax request fired off when the select box changes.
kaushal sharma
Greenhorn

Joined: Oct 04, 2009
Posts: 26
Hi David,

I understand your suggestion but i want to use javascript as i know we can get an ID of every select option, so can't we send the ID to my Action Servlet when it's selected? It may feel the page is refreshed or do we try something else?



-Thanks & regards,
Kaushal K. Sharma




David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I may be misunderstanding you.

My suggestion *was* to use JavaScript, make an Ajax request when the select box is changed, and send back just the HTML for the table containing the data based on the ID (or whatever) selected in the select box.
kaushal sharma
Greenhorn

Joined: Oct 04, 2009
Posts: 26
Hi David,

hope you would have some documents available online in response to my work. i do not know AJAX. Please suggest me so, that i will be able to understand the development part.


-Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you're going to use Ajax, just search the web for Ajax. I'd *strongly* recommend using a JavaScript library if you go that route--doing it without a library (like jQuery, Prototype, whatever) is a pretty bad idea.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need suggestions and help for my scenario in struts
 
Similar Threads
How to populate select box based on value from another select
JSP Form values Not able to submit
Getting values from a select box
html select box - values getting lost
Operations between two select boxes