File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Throwing Exception in the jsp:useBean Tag

 
Joe Ridener
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I am trying to auto populate a bean and retrieve the values from it using the jsp:useBean tags ect..

My code looks like this..



The error my Apache Tomcat is throwing

org.apache.jasper.JasperException: An exception occurred processing JSP page /sign_on_server_pages/confirm_info.jsp at line 91

88:
89:
90: %>
91: <jsp:useBean id="acct" type="beans.Creating_Account" scope="application"></jsp:useBean>
92: <!-- -->
93: <h5 class="param_names"> <%=param_names[0] %></h5><h5 style=" color: ${ color_border_links[0] } ;" class=""> ${ request.getParameter("firstName") }</h5>
94:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

root cause

javax.servlet.ServletException: java.lang.InstantiationException: bean acct not found within scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
org.apache.jsp.sign_005fon_005fserver_005fpages.confirm_005finfo_jsp._jspService(confirm_005finfo_jsp.java:217)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)


Any ideas on what I may be doing wrong... I have tried sever different values for the scope attribute and all of them say the same thing about 'not found in scope'
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, have you created a scoped attributed named acct in the desired scope? If not, then that's exactly what the the exception is telling you.

The form of useBean you are using requires that the scoped variable already exist.

(And, of course, the usually question: why are you using 12-year-old obsolete technology? scriptlets are long dead.)
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic