| | |
How can i get selected value from list.
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
•
•
Join Date: Mar 2008
Posts: 4
Reputation:
Solved Threads: 0
Hi all,
I want to retrieve selected item from listbox in a jsp page and send it to a servlet. I am not able to get selected value. Can u please tell me how to get selected value.
In servlet i am trying to get the selected value by using getparameter() function, but its not working.
This is the code i hve given in jsp page:
I want to retrieve selected item from listbox in a jsp page and send it to a servlet. I am not able to get selected value. Can u please tell me how to get selected value.
In servlet i am trying to get the selected value by using getparameter() function, but its not working.
This is the code i hve given in jsp page:
JSP Syntax (Toggle Plain Text)
<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Unblock Page</title> </head><br><br> <body background ="bluebg1.jpg" text="DarkBlue"> <select name = "urllist" size="1" > <%Iterator itr;%> <% List data= (List)request.getAttribute("data"); for (itr=data.iterator(); itr.hasNext(); ) { String s=itr.next().toString(); %> <option value = "<%=s%>" > <%=s%> </option> <%}%> </select> <form action="./unblock" method="post"><h1 align="center"><input type="submit" value="Unblock" ></h1></form> <% String urllist = request.getParameter("urllist"); System.out.println("String in jsp"+urllist); %> </body> </html>
Last edited by peter_budo; Nov 29th, 2008 at 8:01 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Your
From what I see you seem to have no idea how HTML forms work, so I would suggest this tutorial.
And PLEASE use code tags, when you are pasting code. You can read about them here.
This is already your fourth post in roughly 7-8 months and the fact that you still haven't read the rules only shows your ignorance.
<select> element (and also any other element eg textfields, checkboxes, etc ) should be inside the <form> </form> tags, if you want your data to get posted (via GET or POST) to the URL specified in the form's action parameter.From what I see you seem to have no idea how HTML forms work, so I would suggest this tutorial.
And PLEASE use code tags, when you are pasting code. You can read about them here.
This is already your fourth post in roughly 7-8 months and the fact that you still haven't read the rules only shows your ignorance.
Last edited by stephen84s; Nov 29th, 2008 at 2:26 pm.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
"How to ask questions the smart way ?"
"How to ask questions the smart way ?"
![]() |
Similar Threads
- Make data from a pull down list mandatory (Visual Basic 4 / 5 / 6)
- Select List Values Retained (PHP)
- I cann't unable to get count the selected list box items using javascript (JavaScript / DHTML / AJAX)
- Count the selected list box items using javascript (JavaScript / DHTML / AJAX)
- Multiple Select List Handling (JSP)
- dynamic dropdowm list and mysql (PHP)
- Help Using Selected Values between Tables (VB.NET)
- Blank drop list (PHP)
Other Threads in the JSP Forum
- Previous Thread: How can i Import contact using javascript in jsp
- Next Thread: security authentification using JDBCRealm under tomcat 6 and postgresql
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish imagetodatabse imageupload internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial video web






