aspose file tools*
The moose likes JSP and the fly likes JSP Throwing Exception in the jsp:useBean Tag 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 Throwing Exception in the jsp:useBean Tag" Watch "JSP Throwing Exception in the jsp:useBean Tag" New topic
Author

JSP Throwing Exception in the jsp:useBean Tag

Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
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

Joined: Jan 10, 2002
Posts: 61588
    
  67

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.)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP Throwing Exception in the jsp:useBean Tag