aspose file tools*
The moose likes JSP and the fly likes what is wrong with my jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "what is wrong with my jsp" Watch "what is wrong with my jsp" New topic
Author

what is wrong with my jsp

Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
hi ,
I have following jsp , it runs fine if i delete that if part, it prints the query string as null, i am getting errors becuse of that if , i am not undertsanding what is wrong with that part, someone please suggest.

<html>
<head>
<br>
<br>
<center>
<h2>Enter the following data</h2>
</center>
<br>
</head>
<body bgcolor="#FFDAB9">
<%
String query = request.getQueryString();
out.println("query is "+query);
if(query.equals("null"))
{
out.println("query is null");
}
%>
</body>
</html>
I ma getting folowing errors when i access it thorugh the browser
java.lang.NullPointerException
at org.apache.jsp.index_jsp._jspService(index_jsp.java:58)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
hey i got that , i have to use
if(query == null
{
}
toma lam
Greenhorn

Joined: Aug 25, 2003
Posts: 4
Cool!
Yeh, this gets me a lot too. I keep forgetting that Null isn't treated like an object, so you can't use the equals method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is wrong with my jsp