Dear Struts users and experts:

    I am new to Struts and try to build a main multi-frames webpage. My
navigation frame is on the top frames. So, whenever the user click a link on
the navigation frame, the center frame will be updated. I have successfully
build the page for login. If the user login successfully, they will be shown
the main page. I try to build a jsp page where user can change their account
detail. The link is provided on the top frame(navigation frame). The account
detail page will be displayed in the center frame. I have create the form,
called "UserAccountForm", the Action, "GetUserAccountAction", and the
corresponding entry in the struts-config.xml file. The snap-shot of my
struts-config.xml file related to this problem is shown below:

   <form-beans>
   <form-bean name="loginForm" type="com.netadvsr.form.LoginForm"/>
   <form-bean name="userAccountForm" type="com.netadvsr.form.UserAccountForm
/>
   </form-beans>

<action
    path="/getuseraccount"
    type="com.netadvsr.action.GetUserAccountAction"
    scope="request"
    attribute="userAccountForm"
    name="userAccountForm"
    validate="false">
    <forward name="Success" path="/jsp/userAccount.jsp" redirect="true"/>
   </action>

   Note: for the above action mapping, I have try with only attribute/name
or both of them together, but still getting the same problem.

   And this is the link that will activate the userAccount jsp page.

<td width="15%" height="19">
   <html:link href="../getuseraccount.do?action=Edit" target="mainFrame">
    <bean:message key="main.toplink.myaccount"/>
   </html:link>
  </td>

    Note: "mainFrame" in the above code is the name of the center frame.

And here is my "GetUserAccountAction.java" code.(only have execute method)

public class GetUserAccountAction extends Action {
 public ActionForward execute( ActionMapping mapping,
     ActionForm form, HttpServletRequest request, HttpServletResponse
response)
     throws Exception {

  // Extract attributes we will need
  Locale locale = getLocale(request);
  MessageResources messages = getResources(request);
  HttpSession session = request.getSession();
  String action = request.getParameter("action");
  if (action == null) {
   action = "Edit";
  }

  /* Get the UserView from the session, has been set by the previous action
code
    when the user login successfully.
  */
    UserView userView         (UserView)request.getSession().getAttribute( IConstants
USER_VIEW_KEY );

  if (userView != null) {

   if (form == null) {
    form = new UserAccountForm();

    if ("request".equals(mapping.getScope()))
          request.setAttribute(mapping.getAttribute(), form);
        else
          session.setAttribute(mapping.getAttribute(), form);
   }

   UserAccountForm aform = (UserAccountForm)form;
   aform.setAction(action);
   aform.setFullname(userView.getFullname());
   aform.setUsername(userView.getUsername());
   aform.setPassword(userView.getPassword());
   aform.setRetypePassword(userView.getPassword());
   aform.setPrivilege(userView.getPrivilege());
      return mapping.findForward( IConstants.SUCCESS_KEY );
    } else return mapping.findForward("NotLogin");
 }
}

Note: some of the code are adopted from the example code provided by Struts
distribution.


And finally, this is the error that I get:(that show in the center frame)

type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error)
that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: bean userAccountForm  not found within scope

        at org.apache.jasper.runtime.PageContextImpl
handlePageException(PageContextImpl.java:471)
        at org.apache.jsp.userAccount$jsp._jspService(userAccount$jsp.java:777)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper
service(JspServlet.java:201)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain
internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain
doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve
invoke(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve
invoke(StandardContextValve.java:190)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
java:246)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext
java:2347)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve
java:180)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.valves.ErrorDispatcherValve
invoke(ErrorDispatcherValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve
java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve
java:468)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
java:174)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor
java:1027)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor
java:1125)
        at java.lang.Thread.run(Thread.java:536)

root cause
java.lang.InstantiationException: bean userAccountForm  not found within
scope
        at org.apache.jsp.userAccount$jsp._jspService(userAccount$jsp.java:78)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper
service(JspServlet.java:201)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain
internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain
doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve
invoke(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve
invoke(StandardContextValve.java:190)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
java:246)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext
java:2347)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve
java:180)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.valves.ErrorDispatcherValve
invoke(ErrorDispatcherValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve
java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve
java:468)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
java:174)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline
java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor
java:1027)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor
java:1125)
        at java.lang.Thread.run(Thread.java:536)


    I will be very grateful if someone who know what's went wrong with my
approach.
I have tried few days to find the bug, but can't seem to solve it. Please. I
m in urgent
need for the solution. I thank you in advance for reading this email and
helping me out.
Thanks.

Sincerely,
Brandon


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to