Bookmark Topic Watch Topic
  • New Topic

list values

 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have a drop down list like below

<select
<option> name = quater value= 1
Q1<option>
<select>

In the servlet or other jsp , If I want the Q1 not the values of Q1, How would I achieve this.

suppose like this
String quater = request.getParmatername();



thanks a lot
 
krishna kishore
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Report post to moderator
one way is to store the option's text to a hidden component and take the value of the hidden from the request.
NOTE: onchange in combo(option) event, in javascript, assign the text to the hidden component.
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • Mark post as helpful
  • send pies
  • Report post to moderator
Check out

Class ServletRequest
Method: public java.util.Enumeration getParameterNames()
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Report post to moderator
The simplest and easiest is to place the Q1 as a value as well.
Is there any problem with that?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator


This is not a valid option tag or select tag.
Did you cut and paste this into Javaranch or did you type it yourself?
If the latter, please make sure that there are no typos in this code.
 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Report post to moderator
Here is the code


I want to get the Q1,Q2,Q3 and Q4 not the values. What is the best way to do it?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
They're still malformed.
What does getSelection(1) return?
 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Report post to moderator
here is the code for getSelection()
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
So, it returns "SELECTED" or an empty string.

Browsers do not send the text of a select box option to the server, so you'll need to either map the values on the server or use Javascript to read the text for the given option and add it to the form submission. (as krishna mentioned)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
So why are you making the important dats not the value? Why do things the hard way? As said previously, make the value what you want returned. Simple.
 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is it possible to display web page in a table to show
row vertically and column horizontally

I want to show some thing like this

aaaa 1 2 3 43 4 4 4 4 4 4
bbbb 0 2 3 4 4 5 5 5 5 5 5
eeee 2 3 3 3 3 3 3 3 3 3
dddd 2 2 2 2 2 2 2 2 2 2 2

How would I write the code in all columns horizonatlly
and row vertically
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
This sounds like a completely different question.
It would be better it you started a new thread with it.
 
    Bookmark Topic Watch Topic
  • New Topic