Solved: if you run in trouble like me doublecheck your constructor definition!
mine was for some ninja-releated reason private.
Hi everyone,
i’m new to NetBeans-JSP programming (i’m quite confident with PHP)
hi have this instruction in “doLogin.jsp”:
...
<jsp:useBean scope="request" id="user" class="minibay.user.LoginBean" />
<jsp:useBean scope="session" id="userSession" class="minibay.user.UserSessBean" />
...
when I run the application and go to the page I recive this error:
org.apache.jasper.JasperException: /doLogin.jsp(12,0) The value for the useBean class attribute minibay.user.UserSessBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1220)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3416)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
Actually, the class is located under “MiniBay/java/minibay/user” (where MiniBay is the project root)
I’ve read in other post that my classes should be located under the “WEB-INF” folder.
Actually, ii’ve tried to move them with no succes.
Furthermore, the “user” bean works well, if I remove the second line of the code above I have no problem.
Any Idea of how to make it work out?
thnks
Edit: this is the UserSessBean class definition:
package minibay.user;
import java.io.Serializable;
/**
*
* @author Alessandro Artoni <artoale@gmail.com>
*/
public class UserSessBean implements Serializable{
private boolean loggedIn;
private User user;
private UserSessBean(){
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public boolean isLoggedIn() {
return loggedIn;
}
public void setLoggedIn(boolean loggedIn) {
this.loggedIn = loggedIn;
}
}
This boils down that the following has failed miserably:
Does it have an (implicit) public no-arg constructor? It should be there to get construction to work. Also take care that any of (static) initialization blocks runs without throwing runtimeexceptions/errors. You should however have seen that back in the server logs as root cause.
See also: