Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JDeveloper and JSP Arrays

Status
Not open for further replies.

fernie255

Programmer
Jun 4, 2001
2
US
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:
Code:
<jsp:useBean id=&quot;tBean&quot; class=&quot;t_bean&quot;/>
<jsp:setProperty name=&quot;tBean&quot; property=&quot;*&quot;/>

<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()
Any suggestions as to why jDev isn't calling the &quot;setProperty&quot;? Tomcat does and they both are using the same jdk version.

Thanks.
 
Is t_Bean in a package/folder in JDev? My bean call looks like this,

<jsp:useBean id=&quot;bean&quot; class=&quot;PacServlets.Results&quot; scope=&quot;session&quot; />

The class of the bean is Results.java, but the package name comes first which is PacServlets. Don't know if this is the problem, but worth checking I think.
 
I'm sorry I cannot answer your questions. I'm a DBA and get
questions a to which tools may be better .. What is
your opinion of JDeveloper ?? We are a shop of IPlanet ... Is JDeveloper easier ?? Is BC4J a benefit ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top