This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes value of the textbox to a scriplet in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "value of the textbox to a scriplet in JSP" Watch "value of the textbox to a scriplet in JSP" New topic
Author

value of the textbox to a scriplet in JSP

Soumik Basu
Ranch Hand

Joined: Oct 01, 2007
Posts: 40
hi,
I am developing an application where i am having 2 combo boxes and
those combo boxes were populated by the value from databases.I have
populated my 1st combo box by using a Java bean where i have used sql
query.But for populating the 2nd combo box i need to use another bean
where i have to give the selected value of the 1st combo box in the
where condition of its SQL query.

I tried to get this selected value by taking the value in a text-box
through JavaScript and then tried to pass the value of the text-box in
the scriptlet n thus pass it in 2nd Java Bean.but unfortunately
every time i got null value.
Can you please tell me how to pass this value in a variable in scriptlet.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61071
    
  66

I tried to get this selected value by taking the value in a text-box
through JavaScript and then tried to pass the value of the text-box in
the scriptlet n thus pass it in 2nd Java Bean.
It sounds as if you are trying to mix client and server-side code, and that just can't happen. Please read this article to find out why.

What you are trying to do has pretty much become the "poster child" example for using Ajax to retrieve the dynamic context of the secondary select element (by the way, it's not a "combo box", there is no such native control on the web).

Search the HTML forum for "dependent dropdown" or "cascading dropdown" for many previous disucssions of just this issue.
[ October 01, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: value of the textbox to a scriplet in JSP