aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Spring MVC - A novice doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Spring MVC - A novice doubt" Watch "Spring MVC - A novice doubt" New topic
Author

Spring MVC - A novice doubt

Stephen King
Greenhorn

Joined: Jul 08, 2007
Posts: 23
Hello All,

I am realtively new to the Spring MVC framework and have recently started exploring it. I have so far achieved implementing a single form with 2 fields, validating the user inputs in the command object (bound to the form) and ahndling of the request in a Controller extended from SimpleFormController.

I also understood that the method formBackingObject() can be overrided and the command object can be initialized so that during the 'request' phase, the form view can display the default values in the respective fields.

So far so good.

Now I am thinking of implementing a new page with a 'not so simple' form implementation. I need to have two drop down fields on the form. The values in the second drop down should depend on (and get refreshed with) the value selected in the first drop down. However, I am not sure as to how this can be achived using the Spring MVC framework.

Would appreciate if somebody can provide some suggestions, code snippets etc.

Thanks in advance.

Kind Regds,
Steve


Believe in yourself!
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Hi Stephen,

I'm in the same boat, Just finished some simple stuff and now planning to do a little bit advance in sping.
Just wanted to know whether:
you need to populate the second drop down value based on the fist dropdown value at form load time? or
You want to select the 1st dropdown and based on that you want to select the other one.(In this case we can use AJAX)
Stephen King
Greenhorn

Joined: Jul 08, 2007
Posts: 23
Shyam,

Good to know that there is somebody with me in the _same boat_ . What I need to do is to populate a specific set of values in the second drop down based on the the value selected in the first one. to give you an example, the first drop down may list 'product categories' and the second one lists the products in each catedory. So when you select a particular 'Product Category' in the first drop down, the second drop down should refresh and get all the products for that particular category.

Any pointers?

Thanks & Regds,
Steve
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Any pointers?

This is not a Spring related issue. It's kind of a Html (or Ajax) issue. I wonder if we'd better move this topic to the Html forum.


[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60997
    
  65

This very example has sort of become the "poster child" for Ajax -- it's been solved numerous times in this forum and hundreds if not thousands of times on the web.

Essentially, you capture the change of the first select, make an Ajax request to fetch the values for the second select, and populate the second select in the request callback.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring MVC - A novice doubt