.
my LoginAction
public class LoginAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
if (loginForm.getUsername().equals("a"))
{
request.setAttribute("userName", loginForm.getUsername());
return mapping.findForward("success");
}
return null;
}
}
.
.
my loginsuccess.jsp to display the value.
.
, you successfully logged in!
This a struts page.
when i try to run this page. i am getting following error.
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean userName in scope request
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.loginsuccess_jsp._jspService(loginsuccess_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
-
cannot find bean in scope (3 messages)
- Posted by: SRS Kumar
- Posted on: May 07 2007 03:11 EDT
Threaded Messages (3)
- Re: cannot find bean in scope by Eugene Krivosheyev on May 07 2007 14:02 EDT
- Re: cannot find bean in scope by SRS Kumar on May 09 2007 00:56 EDT
- It is working by changing redirect to false ??? by Madhusudhan Mukthavaram on October 04 2009 14:54 EDT
-
Re: cannot find bean in scope[ Go to top ]
- Posted by: Eugene Krivosheyev
- Posted on: May 07 2007 14:02 EDT
- in response to SRS Kumar
Check the page with the input form. It should be like this: But not like this: -
Re: cannot find bean in scope[ Go to top ]
- Posted by: SRS Kumar
- Posted on: May 09 2007 00:56 EDT
- in response to Eugene Krivosheyev
Thanks, i found where the error is , it is in struts-config.xml mine was it should be -
It is working by changing redirect to false ???[ Go to top ]
- Posted by: Madhusudhan Mukthavaram
- Posted on: October 04 2009 14:54 EDT
- in response to SRS Kumar
Able to read the values from bean by changing redirect to false in struts-config.xml :*) I don't remember struts guide's have said this any where. Could you please explain, why it is working now?