Dear all, I was trying to going from one JSP page to another, where each JSP page has a submit button... and a Form bean as well. But when I click a submit button on the first JSP page, it said that the second Form bean is not found in the second JSP page. The workflow is supposed to be: RedirectForm -> RedirectHelpForm Can anyone please shed some light on me to resolve this issue? Thank you very much in advance.
Here is the error: 02:26:27,748 ERROR [PortletRequestDispatcherImpl:316] org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "RedirectHelpForm" in any scope org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "RedirectHelpForm" in any scope at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) Here are all the codes: --- struts-config.xml: =============================== # cat docroot/WEB-INF/struts-config.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd"> <struts-config> <form-beans> <form-bean name="RedirectForm" type="com.ip6networks.struts_redirect.portlet.RedirectForm"></form-bean> <form-bean name="RedirectHelpForm" type="com.ip6networks.struts_redirect.portlet.RedirectHelpForm"></form-bean> </form-beans> <action-mappings> <action path="/struts_redirect_portlet/input" type="com.ip6networks.struts_redirect.portlet.RedirectAction" name="RedirectForm" scope="session" validate="true" input="/portlet/struts_redirect_portlet/input.jsp"> <forward name="input" path="/portlet/struts_redirect_portlet/input.jsp" ></forward> <forward name="help" path="/portlet/struts_redirect_portlet/help.jsp" ></forward> </action> <action path="/struts_redirect_portlet/help" type="com.ip6networks.struts_redirect.portlet.RedirectHelpAction" name="RedirectHelpForm" scope="session" validate="true" input="/portlet/struts_redirect_portlet/help.jsp"> <forward name="help" path="/portlet/struts_redirect_portlet/help.jsp"></forward> </action> </action-mappings> <message-resources parameter="resources.application" null="true"></message-resources> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"></set-property> </plug-in> </struts-config> --- input.jsp: =============================== # cat input.jsp <%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %> <p align=centre> Hello the hell..... </p> <bean:define id="comment" name="RedirectForm" property="comment" type="java.lang.String" /> <logic:messagesPresent> <span class="es-error"> <bean:message key="error.comment.invalid"/> </span> </logic:messagesPresent> <p align=centre> <html:form action="/struts_redirect_portlet/input" method="post" focus="comment"> <table class="stats"> <tr> <th><bean:message key="form.title.comment"/></th> <th><html:text name="RedirectForm" property="comment" size="50" /></th> </tr> </table> </p> <p align=left> <html:submit><bean:message key="button.submit"/></html:submit> </html:form> </p> --- help.jsp: =========================== # cat help.jsp <%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %> <p align=centre> Hello the HelP FORM ??..... </p> <bean:define id="name" name="RedirectHelpForm" property="name" type="java.lang.String" /> <logic:messagesPresent> <span class="es-error"> <bean:message key="error.name.invalid"/> </span> </logic:messagesPresent> <p align=centre> <html:form action="/struts_redirect_portlet/help" method="post" focus="name"> <table class="stats"> <tr> <th><bean:message key="form.title.name"/></th> <th><html:text name="RedirectHelpForm" property="name" size="50" /></th> </tr> </table> </p> <p align=left> <html:submit><bean:message key="button.submit"/></html:submit> </html:form> </p> --- RedirectAction.java: ===================================== public class RedirectAction extends PortletAction { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception { RedirectForm redirectForm = (RedirectForm) form; String comment = redirectForm.getComment().trim(); if ( comment.length() > 0) { return mapping.findForward("help"); } return mapping.findForward("input"); } public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { return mapping.findForward("input"); } } --- RedirectHelpAction.java: =============================== public class RedirectHelpAction extends PortletAction { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception { return mapping.findForward("help"); } public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { return mapping.findForward("help"); } } -- RedirectForm.java: =================================== public class RedirectForm extends ValidatorForm { private String comment=""; public String getComment() {return this.comment;} /** * @struts.validator type="required" msgkey="error.comment.required" */ public void setComment(String c) {this.comment = c;} public void reset(ActionMapping mapping, HttpServletRequest req) { this.comment = ""; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) { ActionErrors errors = new ActionErrors(); try{ if (this.comment == null || this.comment.length() < 1) { errors.add("comment", new ActionMessage("error.comment.required")); } } catch(NullPointerException npe){} return errors; } } --- RedirectHelpForm.java ================================== public class RedirectHelpForm extends ValidatorForm { private String name=""; public String getName() {return this.name;} /** * @struts.validator type="required" msgkey="error.name.required" */ public void setName(String c) {this.name = c;} public void reset(ActionMapping mapping, HttpServletRequest req) { this.name = ""; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) { ActionErrors errors = new ActionErrors(); try{ if (this.name == null || this.name.length() < 1) { errors.add("name", new ActionMessage("error.name.required")); } } catch(NullPointerException npe){} return errors; } } --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org