hi, correct method is getParameter, without final "s".
if you have multi values for a parameter (such us in checkbox), you
can use
String[] getParameterValues(String paramName)
Stefano
Hi Stefano,
Thanks for pointing out the typo, really silly & annoying.
I corrected the typo still getting error (line 34, ; required??)
I understand sn1 = getParameter("Value0");
I do not understand the: String[] getParameterValues(String paramName)
How do you assign this??
Thanks for your assistance.
clive
> hi, correct method is getParameter, without final "s".
>
[quoted text clipped - 3 lines]
>
> Stefano
stefanomnn - 02 Jul 2007 11:08 GMT
Hi,
suppose you have this in your form:
<input type="ceckbox" name="selectedColors" value="red"/>Red
<input type="ceckbox" name="selectedColors" value="yellow"/>Yellow
<input type="ceckbox" name="selectedColors" value="green"/>Green
in your jsp,
String[] colors= request.getParameterValues("selectedColors");
// colors have just colors user selected
Stefano :-)
cliveswan@yahoo.co.uk - 02 Jul 2007 13:29 GMT
Hi Stefano,
Noticed that I left out the System before out.println
I have amended the code, but am still getting an error >>> ; expected
I have pasted the revised code below.
PS thanks for your patience.
//>>>>>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page
import="java.lang.*"
import="javax.servlet.*"
import="java.lang.*"
%>
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"/>
<title>Home</title>
<style type="text/css">
body {
background-color: #ffa5ff;
}
a:link { color: #0000ff; }
</style>
</head>
<body>
<select name="roofTopdrop" size="1">
<option value="Roof0" SELECTED>Yes</option>
<option value="Roof1">N0</option>
<option value="Roof2">-</option>
</select>
// n1 = Integer.ParseInt(roofTopdrop);
<%
String[] roofTop = request.getParameterValues("roofTopdrop");
System.out.println("Value is" roofTop);
%>
</body>
</html>
cliveswan@yahoo.co.uk - 02 Jul 2007 14:10 GMT
Hi Stefano,
Error, the System.out.println was within the <% %>, did not seem to
like that.
The JSP is creating website with drop-down listbox.
It prints out the System.out.println("Value is" roofTop);
Rather than the option selected in drop-down????
Thanks
Clive
stefanomnn - 02 Jul 2007 14:24 GMT
A combobox is a single value parameter.
so, you have to recovery value with request.getParameter("yourCombo");
you have some confusion with jsp,
see SUN tutorial: http://java.sun.com/javaee/5/docs/tutorial/doc/JSPIntro.htm