I have the following code working in Tomcat as expected but gets a "NullPointerException" when run through jDev. I know the setter method is correct because I found it on the web and tested it out with a command-line editor and I get the expected result through Tomcat. I'm sure the problem is with my project config in jDev but can't pinpoint the error.
I call Result.jsp with which instantiates a "t_bean" class.
Result.jsp:
t_bean.java:
The exact error when run from jDev is:
Any suggestions as to why jDev isn't calling the "setProperty"? Tomcat does and they both are using the same jdk version.
Thanks.
I call Result.jsp with which instantiates a "t_bean" class.
Result.jsp:
Code:
<jsp:useBean id="tBean" class="t_bean"/>
<jsp:setProperty name="tBean" property="*"/>
<HTML>
<HEAD>
<title>Result Page</title>
</HEAD>
<BODY>
textB[0]:<%=tBean.getTxtB(0) %><br>
textB[1]:<%=tBean.getTxtB(1) %><br>
</BODY>
</HTML>
t_bean.java:
Code:
import java.lang.*;
public class t_bean {
private String[] textArr;
public void setTxtB(String[] pData) {
textArr = pData;
}
public String getTxtB(int index) {
return textArr[index];
}
}
The exact error when run from jDev is:
Code:
java.lang.NullPointerException
java.lang.String t_bean.getTxtB(int)
void test_html.t_page2._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.jsp.app.JspApplication.dispatchRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void oracle.jsp.JspServlet.doDispatch(oracle.jsp.app.JspRequestContext)
void oracle.jsp.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void oracle.jsp.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.lite.web.JupServlet.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.MimeServletHandler.handle(oracle.lite.web.JupApplication, java.lang.String, int, oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.JupApplication.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.JupHandler.handle(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.HTTPServer.process(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
boolean oracle.lite.web.HTTPServer.handleRequest(oracle.lite.web.JupInputStream, oracle.lite.web.JupOutputStream)
boolean oracle.lite.web.JupServer.handle(oracle.lite.web.JupInputStream, oracle.lite.web.JupOutputStream)
void oracle.lite.web.SocketListener.process(java.net.Socket)
void oracle.lite.web.SocketListener$ReqHandler.run()
Thanks.