Results 1 to 4 of 4
  1. #1
    sayan751 is offline Member
    Join Date
    Feb 2009
    Posts
    29
    Rep Power
    0

    Default A Question on <select><option> tag

    Hi,
    i have question on html select tag. i am using the following code in jsp.

    Java Code:
    <form name="f1" action="anyservlet">
    <select name="letter">
    <option value="1">A</option>
    <option value="2">B</option>
    <option value="3">C</option>
    <option value="4">D</option>
    </select>
    <input type="submit" name="submit" value="submit">
    </form>
    now what i want is to display 'A','B','C','D' in the drop down list.but while submitting this form to "anyservlet" i want to get the value written in the option tag.

    example: 'B' is chosen and this form is submitted the value i want is '2'.


    is that possible??if yes, then how??

    thank you
    Last edited by sayan751; 09-14-2009 at 06:07 AM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    In the servlet you just do

    Java Code:
    request.getParameter("letter");

  3. #3
    sayan751 is offline Member
    Join Date
    Feb 2009
    Posts
    29
    Rep Power
    0

    Default

    Quote Originally Posted by r035198x View Post
    In the servlet you just do

    Java Code:
    request.getParameter("letter");
    Thanks It worked.

  4. #4
    sayan751 is offline Member
    Join Date
    Feb 2009
    Posts
    29
    Rep Power
    0

Similar Threads

  1. How to retain value in struts 2 using <s:select></s:select> tag
    By SaiPrasad@Sella in forum Web Frameworks
    Replies: 0
    Last Post: 02-09-2009, 07:23 AM
  2. CVS with -f option
    By amiga23 in forum Eclipse
    Replies: 2
    Last Post: 09-22-2008, 02:57 AM
  3. Why to Use J2SE and Option for using this..
    By mgrprasad90 in forum Java Applets
    Replies: 0
    Last Post: 08-27-2008, 09:27 AM
  4. Is JSP the right option?
    By Naga in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 08-20-2008, 06:48 AM
  5. the -eprof option?
    By GVD in forum Advanced Java
    Replies: 2
    Last Post: 01-10-2008, 01:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •