Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Help about option select in jsp page

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help about option select in jsp page

    I want get value in option select in jsp page . My code is here :
    <body>
    <form action="loadData" method="post">
        <select id="abc" name="abc">
            <option value="1">get 1</option>
            <option value="2">get 2</option>
            <option value="3">get 3</option>
            <option value="4">get 4</option>
     
        </select>
     
        <%
            String name=request.getParameter("abc");
            session.setAttribute("trans",name);
        %>
    <input type="submit" value="Report">
    </form>
     
    </body>

    I use request.getParameter("abc") to take value and set Attribute to send to controller, but value get is null. Help me !! (((


  2. #2
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: Help about option select in jsp page

    Quote Originally Posted by langtu_hqb View Post
    I use request.getParameter("abc") to take value and set Attribute to send to controller, but value get is null. Help me !! (((
    What is the target of "loadData"? Is that jsp itself? Or a servlet (or other thing depending on the used framework)? Remember that the <% %> code is executed every time the jsp is rendered to the response. But if you ask this page directly by url from browser (if it's possible) you are not posting the form and thus you don't have the abc parameter.
    Andrea, www.andbin.net SCJP 5 (91%) SCWCD 5 (94%)

    Useful links for Java beginners My new project Java Examples on Google Code

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help about option select in jsp page

    Quote Originally Posted by andbin View Post
    What is the target of "loadData"? Is that jsp itself? Or a servlet (or other thing depending on the used framework)? Remember that the <% %> code is executed every time the jsp is rendered to the response. But if you ask this page directly by url from browser (if it's possible) you are not posting the form and thus you don't have the abc parameter.
    Thank u

Similar Threads

  1. Jsp Servlet problem with getting parameter vaules from another jsp page
    By venkat_tk in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: February 25th, 2013, 01:51 AM
  2. Parent JSP Page is not refreshing properly after modifying a child Jsp.
    By jay_84 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 14th, 2011, 08:59 AM
  3. Need help in JSP Page
    By vinothkumarrvk in forum Web Frameworks
    Replies: 1
    Last Post: March 12th, 2010, 06:43 AM
  4. Need help in JSP Page
    By vinothkumarrvk in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: March 9th, 2010, 04:20 AM
  5. Get <SELECT> tag values on other jsp page
    By nehakuls in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: November 18th, 2009, 01:29 AM