You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Sharples, Brian" <Br...@cingular.com> on 2002/08/15 17:14:30 UTC

Errors Compiling a JSP

Hi,

I am learning JSP with the SAMS book"Teach Yourself JSP in 24 Hours".  One
of the sample JSPs keeps getting a compiler error.  The code is:

<HTML>
<HEAD><TITLE>JSP that processes parameters in a link</TITLE></HEAD>
<BODY>
Parameters
<UL>
<LI>Country = <%= request.getParameter("country") %>
<LI>Colors:
	<UL>
	<%! String[] colorValues = request.getParameterValues("colors"); %>
	<LI>Color 1 = <%= colorValues[0]%>
	<LI>Color 2 = <%= colorValues[1]%>
	<LI>Color 3 = <%= colorValues[2]%>
	</UL>
</UL>
</BODY>
</HTML>

The error is a status 500 - Internal Server Error: Undefined variable or
class name: request
String[] colorValues = request.getParameterValues("colors"); 
If I remove the colorValues variable declaration and just put <%
request.getParameterValues("colors") %>, I get past that line.  Of course,
the next line then shows colorValues as undefined.
I don't understand why this is occurring.  I am using Tomcat 4.0.4 and j2sdk
1.4.0_01.
Thanks for your help.
Brian Sharples


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Errors Compiling a JSP

Posted by Capr1ce <ca...@capr1ce.co.uk>.
Try it like this:

<% String[] colorValues = request.getParameterValues("colors"); %>


At 11:14 AM 15/08/2002 -0400, you wrote:
>Hi,
>
>I am learning JSP with the SAMS book"Teach Yourself JSP in 24 Hours".  One
>of the sample JSPs keeps getting a compiler error.  The code is:
>
>Parameters
>    * Country = <%= request.getParameter("country") %>
>    * Colors:
>    <%! String[] colorValues = request.getParameterValues("colors"); %>
>        * Color 1 = <%= colorValues[0]%>
>        * Color 2 = <%= colorValues[1]%>
>        * Color 3 = <%= colorValues[2]%>
>
>
>The error is a status 500 - Internal Server Error: Undefined variable or
>class name: request
>String[] colorValues = request.getParameterValues("colors");
>If I remove the colorValues variable declaration and just put <%
>request.getParameterValues("colors") %>, I get past that line.  Of course,
>the next line then shows colorValues as undefined.
>I don't understand why this is occurring.  I am using Tomcat 4.0.4 and j2sdk
>1.4.0_01.
>Thanks for your help.
>Brian Sharples
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>