• 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

JSP and JavaScript

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay so here is my delema, I have a JSP variable that is base don user input. Basically need to have a drop down change based on what the user selects. So a god for instance would be the user selects a class they want to take and a drop down below it changes dynamically based on a Java class to the current available classes. So, both fields are dynamic and are pulled from a SQL database, which i have figured out, but in pseudocode it would look like so:

MAKE drop down class menu
INPUT Geometry
MAKE drop down openings
INPUT openings
SUBMIT

then a table builds showing who is in that class (done it already)

any questions lemme know.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you search this forum, you will see that that this has been asked many times. You either have to post the page back to the server for each drop down and table, or use Ajax to do this.

Eric
 
Patrick Mallahan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i wanna avoid AJAX
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you will need to post back to the server.

I have an example app that does this:
http://simple.souther.us/not-so-simple.html

If the amount of data is small and somewhat fixed, you could build javascript arrays on the and do all of this on the client.
 
Patrick Mallahan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know how to make dynamic lists, but want the second lists contents to be beased on the first ones.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to post your form back to the server when the option is changed in the first dropdown list and fill in the second list.

onchange="document.formName.submit()"

then you can see the values and adjust them. Not that hard to do.

Eric
 
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
Also been covered in these forums on many occasions. Use the Search, Luke!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Patrick Mallahan:
i know how to make dynamic lists, but want the second lists contents to be beased on the first ones.



Which is precisely what the example I gave you does.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:

I have an example app that does this:
http://simple.souther.us/not-so-simple.html



Ben, that's a fantastic web site. Those might be the best-documented, clearest examples of this kind of system that I've ever seen. I'm reading this thread because I need to do something like this (actually a bit worse, with dynamically-added form elements) and this is a big help.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic