aspose file tools*
The moose likes JSP and the fly likes JSP et Bean JasperException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP et Bean JasperException" Watch "JSP et Bean JasperException" New topic
Author

JSP et Bean JasperException

Ethan Lowes
Greenhorn

Joined: Oct 25, 2005
Posts: 1
I have this page called reserver2.jsp in /public_html

<html>
<head>
<title>W-Rent</title>
</head>
<body>
<jsp:useBean id="cb" class="beans.clientsBean" scope="page" />
<jsp:setProperty name="cb" property="*" />
<h1 align=center>W-Rent</h1>
<h2 align=left>Réserver une voiture</h2>
<br />
<% if (request.getParameter("NoClient") == null) { %>
<jsp:setProperty name="cb" property="client" />
<% } %>
<jsp:getProperty name="cb" property="clientInfo" />
<form name=succursale action="reserver3.jsp" method=GET>
Succursale : <br />
<select name=noSuccursale size=5 />
<option value=1>Allo</option>
<option value=2>Salut</option>
<option value=3>Bye</option>
<option value=4>Ciao</option>
</select>
<br />
<br />
<input type=submit value="Obtenir les voitures"/><br />
</form>
</body>
</html>

and this file called clientsBean.class in /public_html/WEB-INF/classes/bean

package beans;

import java.sql.*;

public class clientsBean {

Integer NoClient;
String Prenom;
String Nom;
String Adresse;
String Ville;
String NoTel;
String CodePostal;

public clientsBean() {
NoClient = 0;
Prenom = "";
Nom = "";
Adresse = "";
Ville = "";
NoTel = "";
CodePostal = "";
}

public void setNoClient(Integer valNoClient) {
NoClient = valNoClient;
}

public void setPrenom(String valPrenom) {
Prenom = valPrenom;
}

public void setNom(String valNom) {
Nom = valNom;
}

public void setAdresse(String valAdresse) {
Adresse = valAdresse;
}

public void setVille(String valVille) {
Ville = valVille;
}

public void setNoTel(String valNoTel) {
NoTel = valNoTel;
}

public void setCodePostal(String valCodePostal) {
CodePostal = valCodePostal;
}

public void setClient() {
ResultSet rs;
Statement stmt;
Connection con;

try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException e)
{
System.err.println("Impossible de charger le pilote de la base de donnees.");
}
try
{
con = DriverManager.getConnection("jdbc racle:thin:@labunix.uqam.ca:1521 8db","ef091471","x");

stmt = con.createStatement();
rs = stmt.executeQuery("SELECT SeqNoClient.nextval FROM Dual");
if (rs != null) {
NoClient = Integer.valueOf(rs.getString("NoClient"));
}
rs.close();
stmt.close();
stmt = con.createStatement();
stmt.executeQuery("INSERT INTO Client VALUES (" + NoClient + ",'" + Prenom + "','" + Nom + "','" + Adresse + "','" + Ville + "','" + NoTel + "','" + CodePostal + "')");
stmt.close();
}
catch (SQLException e)
{
System.err.println("Echec de la connexion a la base de donnees.");
}
}

public String getClientInfo() {
ResultSet rs;
Statement stmt;
Connection con;
String html = "Popcorn";
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException e)
{
System.err.println("Impossible de charger le pilote de la base de donnees.");
}

try
{
con = DriverManager.getConnection("jdbc racle:thin:@labunix.uqam.ca:1521 8db","ef091471","x");

stmt = con.createStatement();
rs = stmt.executeQuery("SELECT * FROM Clients WHERE NoClient =" + NoClient.toString());
if (rs != null) {
Prenom = rs.getString("Prenom");
Nom = rs.getString("Nom");
Adresse = rs.getString("Adresse");
Ville = rs.getString("Ville");
NoTel = rs.getString("NoTel");
CodePostal = rs.getString("CodePostal");

html = html + "Prénom : " + Prenom + "<br />" + "Nom : " + Nom + "<br />" + "Adresse : " + Adresse + "<br />" + "Ville : " + Ville + "<br />" + "Numéro de téléphone : " + NoTel + "<br />" + "Code Postal : " + CodePostal + "<br />";
}
else {
html = "Client inconnu<br />";
}
rs.close();
stmt.close();
}
catch (SQLException e)
{
System.err.println("Echec de la connexion a la base de donnees.");
}

return html;
}

}

and I get the following error

org.apache.jasper.JasperException: /reserver2.jsp(7,0)
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

I've tried everything, but I always get this error. I tried moving the files, renaming them, everything. Please help me.
Wagner Danda Da Silva Filho
Ranch Hand

Joined: Mar 21, 2003
Posts: 80
Hi,

you said your classes are stored in the "/public_html/WEB-INF/classes/bean" path, but looking at you class you declared to be in the "beans" package.

Try to change the "/public_html/WEB-INF/classes/bean" path to "/public_html/WEB-INF/classes/beans". Your package declaration should respect the path.

Wagner Danda


SCJP, SCWCD
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Javaranch tip:

If you're going to post more than a line or two of your code, make sure to wrap the code in UBB Code tags. Doing so will preserve your indenting which makes your code much easier for others to read.

The easier it is for others to read it, the more they will and the more likely they are to help you.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP et Bean JasperException