You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jann VanOver <Ja...@loudeye.com> on 2001/06/06 23:51:46 UTC

RE: newbie problem: javax.servlet.ServletException at org.apache. jasp er.runtime.PageContextImpl.handlePageException

If any of your parameters are null (and it looks like "issue" is null) you
will get an error when you try to use the "equals()" method.

It's better style to turn your statements around like this:
   ("Printout complete issue").equals(request.getParameter("report"));

because this way the initial string is NEVER null and the "equals" will
return "false" if the parameter is null.

-----Original Message-----
From: Terje Kristensen [mailto:Terje.Kristensen@igroup.no]
Sent: Tuesday, May 29, 2001 2:18 AM
To: 'tomcat-user@jakarta.apache.org'
Subject: newbie problem: javax.servlet.ServletException at
org.apache.jasp er.runtime.PageContextImpl.handlePageException 


Hi, 

I'm new to both this mailinglist and tomcat, and I was hoping you could help
me start out.
I use Tomcat 3.2 on a Win2K Server

My problem:

When going from this file (with the url:
http://localhost:8080/xsql/lsp200/index_redirect.jsp?issue=&opn=%25&report=A
dvanced+Reporting):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>LSP-200 - Changes in Issue</title>
	<link rel="STYLESHEET" type="text/css"
href="includes/stylesheet.css"/>
</head>
<% 
String report 	= request.getParameter("report");
String opn 		= request.getParameter("opn");
String issue 	= request.getParameter("issue");

boolean no_1 	= request.getParameter("report").equals("Printout complete
issue");
boolean no_2 	= request.getParameter("report").equals("Printout changes
since last issue");
boolean no_3 	= request.getParameter("report").equals("Printout
sections");
boolean no_4 	= request.getParameter("report").equals("Historic Data");
boolean no_5 	= request.getParameter("report").equals("Advanced
Reporting");

 	if (no_1) { 
		String section1 = "section1.xsql?opn="+ opn + "&issue=" +
issue;
		String section2 = "section2.xsql?opn="+ opn + "&issue=" +
issue;
		String section3 = "section3.xsql?opn="+ opn + "&issue=" +
issue;
		String section4 = "section4.xsql?opn="+ opn + "&issue=" +
issue;
		String section5 = "section5.xsql?opn="+ opn + "&issue=" +
issue;
		String section6 = "section6.xsql?opn="+ opn + "&issue=" +
issue;
		String section7 = "section7.xsql?opn="+ opn + "&issue=" +
issue;
		String section8 = "section8.xsql?opn="+ opn + "&issue=" +
issue;
		String section9 = "section9.xsql?opn="+ opn + "&issue=" +
issue;
%>
<body>
		<jsp:include page="<%=section1%>" flush="true"/>
		<jsp:include page="<%=section2%>" flush="true"/>
		<jsp:include page="<%=section3%>" flush="true"/>
		<jsp:include page="<%=section4%>" flush="true"/>
		<jsp:include page="<%=section5%>" flush="true"/>
		<jsp:include page="<%=section6%>" flush="true"/>
		<jsp:include page="<%=section7%>" flush="true"/>
		<jsp:include page="<%=section8%>" flush="true"/>
		<jsp:include page="<%=section9%>" flush="true"/>
</body>
<% 	} 
	if (no_2) { 
		String section1 = "changes_section1.xsql?opn="+ opn +
"&issue=" + issue;
		String section2 = "changes_section2.xsql?opn="+ opn +
"&issue=" + issue;
		String section3 = "changes_section3.xsql?opn="+ opn +
"&issue=" + issue;
		String section4 = "changes_section4.xsql?opn="+ opn +
"&issue=" + issue;
		String section5 = "changes_section5.xsql?opn="+ opn +
"&issue=" + issue;
		String section6 = "changes_section6.xsql?opn="+ opn +
"&issue=" + issue;
		String section7 = "changes_section7.xsql?opn="+ opn +
"&issue=" + issue;
		String section8 = "changes_section8.xsql?opn="+ opn +
"&issue=" + issue;
		String section9 = "changes_section9.xsql?opn="+ opn +
"&issue=" + issue;
%>
<body>
		<jsp:include page="<%=section1%>" flush="true"/>
		<jsp:include page="<%=section2%>" flush="true"/>
		<jsp:include page="<%=section3%>" flush="true"/>
		<jsp:include page="<%=section4%>" flush="true"/>
		<jsp:include page="<%=section5%>" flush="true"/>
		<jsp:include page="<%=section6%>" flush="true"/>
		<jsp:include page="<%=section7%>" flush="true"/>
		<jsp:include page="<%=section8%>" flush="true"/>
		<jsp:include page="<%=section9%>" flush="true"/>
</body>
<% 	} 
	if (no_3) { %>
<body	bgcolor="#FFBD9D">
	<br/>
	<br/>
	<br/>
	<br/>
		<div align="center">
			<table class="menu">
				<tr>
					<td>
						<dl>
							<dt/><b
style="font-size:10pt">Printout section</b><dd/>
							<a
href="section1.xsql?opn=<%= opn %>&issue=<%= issue %>">1. General</a><br/>
							<a
href="section2.xsql?opn=<%= opn %>&issue=<%= issue %>">2. PCS</a><br/>
							<a
href="section3.xsql?opn=<%= opn %>&issue=<%= issue %>">3. SST</a><br/>
							<a
href="section4.xsql?opn=<%= opn %>&issue=<%= issue %>">4. VDS</a><br/>
							<a
href="section5.xsql?opn=<%= opn %>&issue=<%= issue %>">5. VSK</a><br/>
							<a
href="section6.xsql?opn=<%= opn %>&issue=<%= issue %>">6. MDS</a><br/>
							<a
href="section7.xsql?opn=<%= opn %>&issue=<%= issue %>">7. ESK</a><br/>
							<a
href="section8.xsql?opn=<%= opn %>&issue=<%= issue %>&sc=%&rev=%">8.
SC</a><br/>
							<a
href="section9.xsql?opn=<%= opn %>&issue=<%= issue %>">9. VSM</a><br/>
						</dl>
					</td>
				</tr>
			</table>
		</div>			
</body>
<% 	} 
	if (no_4) { %>
	<body><jsp:include page="historic.xsql" flush="true"/></body><%
} 
	if (no_5) { %>
<body bgcolor="#66cccc" style="font-family:Tahoma">
		<br/>
		<br/>
		<br/>
		<form action="advanced_redirect.jsp" method="get">
			<input type="hidden" name="opn" value="<%=
request.getParameter("opn") %>"/>
			<div align="center">
				<b>Historic Data:</b>
				<table class="menu">
					<tr><td colspan="2"><b
style="font-size:10pt">Section Selection</b></td></tr>
					<tr><td
width="20"></td><td><b>Description:</b> This will print out a complete
example of the current issue</td></tr>
					<tr><td></td><td
align="right"><input type="submit" name="xsql_file" style="width:35mm;"
value="Section Selection"/></td></tr>
					<tr><td colspan="2"><hr/></td></tr>
					<tr><td colspan="2"><b
style="font-size:10pt">PCS Selection</b></td></tr>
					<tr><td
width="20"></td><td><b>Description:</b> This will print out a complete
example of the current issue</td></tr>
					<tr><td nowrap="nowrap">PCS: <input
type="text" value="%" size="8" name="pcs"/></td><td align="right"><input
type="submit" name="xsql_file" style="width:35mm;" value="PCS
Selection"/></td></tr>
					<tr><td colspan="2"><hr/></td></tr>
					<tr><td colspan="2"><b
style="font-size:10pt">VDS Selection</b></td></tr>
					<tr><td
width="20"></td><td><b>Description:</b> This will print out a complete
example of the current issue</td></tr>
					<tr><td nowrap="nowrap">VDS: <input
type="text" value="%" size="8" name="vds"/></td><td align="right"><input
type="submit" name="xsql_file" style="width:35mm;" value="VDS
Selection"/></td></tr>
					<tr><td colspan="2"><hr/></td></tr>
					<tr><td colspan="2"><b
style="font-size:10pt">Pipe Element Selection</b></td></tr>
					<tr><td
width="20"></td><td><b>Description:</b> This will print out a complete
example of the current issue</td></tr>
					<tr><td></td><td
align="right"><input type="submit" name="xsql_file" style="width:35mm;"
value="Pipe Element Selection"/></td></tr>
				</table>
			</div>
		</form>
</body>
<% } %>
</body>
</html>

I'm trying to open this file:
		<html>
			<head>
				<title>LSP200</title>
			</head>
			<link rel="STYLESHEET" type="text/css"
href="includes/stylesheet.css"/>
			<body>
				<div align="center">
			<form action="advanced_section.jsp" method="get">
				<input type="hidden" name="opn" value="<%=
request.getParameter("opn") %>"/>
				<input type="hidden" name="issue"
value="%"/>
				<table class="menu">
					<tr>
						<th colspan="3">Select
section(s)</th>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section2"/>2. PCS</td>
						<td><input type="text"
name="pcs" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section3"/>3. SST</td>
						<td><input type="text"
name="sst" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section4"/>4. VDS</td>
						<td><input type="text"
name="vds" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section5"/>5. VSK</td>
						<td><input type="text"
name="vsk" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section6"/>6. MDS</td>
						<td><input type="text"
name="mds" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section7"/>7. ESK</td>
						<td><input type="text"
name="esk" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section8"/>8. SC</td>
						<td><input type="text"
name="sc" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td><input type="checkbox"
name="section9"/>9. VSM</td>
						<td><input type="text"
name="vsm" value="%"/></td>
					</tr>		
					<tr>
						<td>&nbsp;</td>
						<td></td>
						<td align="right"><input
type="submit" value="run report"/></td>
					</tr>
				</tr>
			</table>
			</form>
				</div>
			</body>
		</html>

, but I get the following error:
Error: 500
Location: /xsql/lsp200/advanced_schema_sections.jsp
Internal Servlet Error:
javax.servlet.ServletException
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
	at
lsp_00032_00030_00030._0002flsp_00032_00030_00030_0002fadvanced_0005fredirec
t_0002ejspadvanced_0005fredirect_jsp_0._jspService(_0002flsp_00032_00030_000
30_0002fadvanced_0005fredirect_0002ejspadvanced_0005fredirect_jsp_0.java:122
)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
	at org.apache.tomcat.core.Handler.service(Handler.java:286)
	at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
	at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
	at java.lang.Thread.run(Thread.java:484)
Root cause: 
java.lang.IllegalArgumentException
	at javax.servlet.http.HttpUtils.parseName(HttpUtils.java:285)
	at javax.servlet.http.HttpUtils.parseQueryString(HttpUtils.java:154)
	at
org.apache.tomcat.facade.RequestDispatcherImpl.addQueryString(RequestDispatc
herImpl.java:491)
	at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl
.java:176)
	at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:421)
	at
lsp_00032_00030_00030._0002flsp_00032_00030_00030_0002fadvanced_0005fredirec
t_0002ejspadvanced_0005fredirect_jsp_0._jspService(_0002flsp_00032_00030_000
30_0002fadvanced_0005fredirect_0002ejspadvanced_0005fredirect_jsp_0.java:72)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
	at org.apache.tomcat.core.Handler.service(Handler.java:286)
	at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
	at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
	at java.lang.Thread.run(Thread.java:484)


What am I doing wrong?

Terje Kristensen
iSolutions AS
Norway