File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes org.apache.jasper.JasperException: java.lang.NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "org.apache.jasper.JasperException: java.lang.NullPointerException" Watch "org.apache.jasper.JasperException: java.lang.NullPointerException" New topic
Author

org.apache.jasper.JasperException: java.lang.NullPointerException

arpit patel
Greenhorn

Joined: Feb 16, 2008
Posts: 6
Hi,

I am getting following error in my JSP:-

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:361)
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:308)
org.apache.jsp.Test_jsp._jspService(Test_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)


root cause

java.lang.NullPointerException
org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:322)
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:308)
org.apache.jsp.Test_jsp._jspService(Test_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)



I am trying to read the value from a form and store it in a bean and dislay it in another JSP. Line no 78 of Test_jsp.java is given below.

com.sample.bean.propertyBean userNameData = null;
synchronized (request) {
userNameData = (com.sample.bean.propertyBean) _jspx_page_context.getAttribute("userNameData", PageContext.REQUEST_SCOPE);
if (userNameData == null){
userNameData = new com.sample.bean.propertyBean();
_jspx_page_context.setAttribute("userNameData", userNameData, PageContext.REQUEST_SCOPE);
out.write("\n");
out.write(" ");
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("userNamedata"), "name", request.getParameter("name"), request, "name", false);


Test.jsp looks something like this:-

<%@page import="com.sample.bean.propertyBean" %>
<!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=UTF-8">
<title>JSP Page</title>
</head>
<body>
<jsp:useBean id="userNameData" class="com.sample.bean.propertyBean" scope="request">
<jsp:setProperty name="userNamedata" property="name" param="name" />
</jsp:useBean>

<jsp:useBean id="userPasswordData" class="com.sample.bean.propertyBean" scope="request">
<jsp:setProperty name="userPasswordData" property="password" param="password"></jsp:setProperty>
</jsp:useBean>
Name is <jsp:getProperty name="userNameData" property="name"/>


Password is <jsp:getProperty name="userPasswordData" property="password"/>

</body>
</html>

can any one of you help me out???

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Please, code tags...


JDBCSupport - An easy to use, light-weight JDBC framework -
arpit patel
Greenhorn

Joined: Feb 16, 2008
Posts: 6
Sebastian Janisch wrote:Please, code tags...


Code tag?? as in?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

arpit patel wrote:Code tag?? as in?


He means when you post part of the code you should use Code tags (which you will find when you post/edit a topic among the buttons listed above the text area) otherwise it's very hard to read the code and you are likely to get less reponses from the people here .


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

Are you passing the name & password parameters from the previous page?
arpit patel
Greenhorn

Joined: Feb 16, 2008
Posts: 6
Vijitha Kumara wrote:Are you passing the name & password parameters from the previous page?

Rookie mistake guys ... the attribute "id" in jsp:useBean and attribute "name" jsp:setproperty are not same. There is some problem with case. Hence i was getting tht error....

Vijitha,

Yes. I am passing name and password from index.html to Test.jsp

Thanks a lot for your time and help guy

Regards,
Arpit

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.apache.jasper.JasperException: java.lang.NullPointerException