aspose file tools*
The moose likes Struts and the fly likes javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope" Watch "javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope" New topic
Author

javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi

I have a small struts application and am getting this error while starting. Someone Please assist me to resolve the issue




Error
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.academicone.filter.LoginFilter.doFilter(LoginFilter.java:50)

root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.Login.login_jsp._jspService(login_jsp.java:92)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.academicone.filter.LoginFilter.doFilter(LoginFilter.java:50)

root cause

javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:938)
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:176)
org.apache.jsp.Login.login_jsp._jspx_meth_html_005ftext_005f0(login_jsp.java:206)
org.apache.jsp.Login.login_jsp._jspx_meth_html_005fhtml_005f0(login_jsp.java:150)
org.apache.jsp.Login.login_jsp._jspService(login_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.academicone.filter.LoginFilter.doFilter(LoginFilter.java:50)
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Meet Gaurav wrote:javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope

You did something wrong the way you are accessing the bean "LoginForm" in your JSP page. Please post the JSP.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Here is the JSP page.

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Or you somehow, missed to create the bean or didn't placed it any scope before forwarding request to the JSP.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

No need to take the "name" attribute in Struts text tag, especially when you are taking input from the user. Remove them.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
After chnaging the JSP. Am getting below Error

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're using Struts html form tags without a Struts html form; please show the Struts configuration for this action.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
David,

Thanks for your response. I tried with HTML form too same error.

Struts-config.xml

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

How are you accessing the page with the form in it?
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
This is the start page, so am using the below url http://localhost:8080/Login/login.jsp

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Accessing a JSP with Struts tags on it without going through the Struts request handling process will not work.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Could you please assist me.. How can I call that ?
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Great David.... Nomal JSP is working..

Please assist me how to call jsp with struts tag in it..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Call it through an action.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Added

<action path="/Login" parameter="/Login/login.jsp" type="org.apache.struts.actions.ForwardAction" />

in struts-config.xml

and accessing /Login.do it's working fine.. Thanks David
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No problem; glad you got it working :)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.servlet.jsp.JspException: Cannot find bean LoginForm in any scope