• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring MVC - A novice doubt

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic