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!

Bean Question

Status
Not open for further replies.

RicardoPereira

Programmer
Jun 3, 2003
255
PT
Hi,

I can't make my jsp page display the results posted in a form. I have tree files:

1-form.jsp
2-form_resp.jsp
3-database.java

form.jsp
------

...
<form method=&quot;POST&quot; action=&quot;pesquisa_encomenda_qry.jsp&quot;>
<table border=&quot;0&quot; cellpadding=&quot;4&quot; cellspacing=&quot;2&quot; align=&quot;center&quot;>

<center><font class=&quot;bolddark&quot;>Pesquisas IOL <br>::por Nº de Encomenda::<br></font><br></center>
<hr>
<tr>
<td class=&quot;bolddark&quot;>Nº Encomenda:</td>
<td><input type=&quot;text&quot; name=&quot;XNENC&quot; class=&quot;formstyleShort&quot;</td>

</table>

</table>

...


form_resp.jsp
---------------
...

<jsp:useBean id=&quot;pesquisas&quot; scope=&quot;request&quot; class=&quot;bd.AcessoBD&quot; />
<%
ArrayList listaEnc=pesquisas.getNEncomenda();
for( int x=0;x<listaEnc.size();x++) {
xiol01p xiol=(xiol01p) listaEnc.get(x);
out.println(&quot;<TR><TD width='50%' align='center' bgcolor='#CCCCCC'><font face='Arial' size='3'>&quot; + xiol.getXCVND() +
xiol.getXNENC()+ xiol.getXNACT() + xiol.getXNGT()&quot;</a></TD></TR>&quot;);

}
%>

...


database.java
-------------

connection ...
...

public ArrayList getNEncomenda(String XNENC) throws SQLException {
ArrayList res=new ArrayList();

PreparedStatement pstmt=
con.prepareStatement(&quot;select XCVND, XNENC, XDEXP, XNACT, XNGT &quot; +
&quot;from XIOL01P &quot; +
&quot;where XNENC=? &quot; +
&quot;Order By XNENC &quot;);

ResultSet rslt=pstmt.executeQuery();
while (rslt.next()) {
res.add(new entidades.xiol01p (rslt.getString(1),rslt.getString(2),rslt.getInt(3), rslt.getString(4), rslt.getString(5)) );
}

return res;

}

...


My problem is that i'am having always the same message


org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_encomenda_qry_jsp.java:153: ')' expected
[javac] xiol.getXNENC()+ xiol.getXNACT() + xiol.getXNGT()&quot;&quot;);
[javac] ^
[javac] C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_encomenda_qry_jsp.java:149: cannot resolve symbol
[javac] symbol : class ArrayList
[javac] location: class org.apache.jsp.pesquisa_encomenda_qry_jsp
[javac] ArrayList listaEnc=pesquisas.getNEncomenda();
[javac] ^
[javac] C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_encomenda_qry_jsp.java:149: getNEncomenda(java.lang.String) in bd.AcessoBD cannot be applied to ()
[javac] ArrayList listaEnc=pesquisas.getNEncomenda();
[javac] ^
[javac] C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_encomenda_qry_jsp.java:151: cannot resolve symbol
[javac] symbol : class xiol01p
[javac] location: class org.apache.jsp.pesquisa_encomenda_qry_jsp
[javac] xiol01p xiol=(xiol01p) listaEnc.get(x);
[javac] ^
[javac] C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_encomenda_qry_jsp.java:151: cannot resolve symbol
[javac] symbol : class xiol01p
[javac] location: class org.apache.jsp.pesquisa_encomenda_qry_jsp
[javac] xiol01p xiol=(xiol01p) listaEnc.get(x);
[javac] ^
[javac] 5 errors


What should i do to resolve this???


Thanks



 
Add

pstmt.setString( 1 , XNENC );

in database.java as shown below and see the result



public ArrayList getNEncomenda(String XNENC) throws SQLException {
ArrayList res=new ArrayList();

PreparedStatement pstmt=
con.prepareStatement(&quot;select XCVND, XNENC, XDEXP, XNACT, XNGT &quot; +
&quot;from XIOL01P &quot; +
&quot;where XNENC=? &quot; +
&quot;Order By XNENC &quot;);




pstmt.setString( 1 , XNENC );






ResultSet rslt=pstmt.executeQuery();
while (rslt.next()) {
res.add(new entidades.xiol01p (rslt.getString(1),rslt.getString(2),rslt.getInt(3), rslt.getString(4), rslt.getString(5)) );
}

return res;

}

 
Also it would help if you check for any syntactical error in the following jsp page

pesquisa_encomenda_qry.jsp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top