You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Chris <ct...@gmail.com> on 2005/05/04 17:29:58 UTC
Struts-bridge and validation
Hi,
i have a problem with struts-bridge and validating via struts-plugin.
Validating seems to work, it forwarts back to the defined input page,
but trying to write out the validating errors I found out that the
ActionMessages, stored in org.apache.struts.action.ACTION_MESSAGE
attribute, is empty.
Any ideas?
I add the Struts-config for this module
regards
Chris
--------- Stuts Config ----------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
<!--
===================================================
The struts configuration for the SYSTEM PORTLET
===================================================
-->
<struts-config>
<form-beans>
<!-- Each action needs a Bean, even if it is empty. Otherwise NPE -->
<form-bean name="emptyBean"
type="org.apache.struts.action.DynaActionForm">
</form-bean>
<!-- User logs in -->
<form-bean name="loginBean"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="userLogin" type="java.lang.String" />
<form-property name="userPassword" type="java.lang.String" />
</form-bean>
<!-- User registers -->
<form-bean name="registerUserBean"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="userLogin" type="java.lang.String" />
<form-property name="userFamilyName" type="java.lang.String" />
<form-property name="userGivenName" type="java.lang.String" />
<form-property name="userEmail" type="java.lang.String" />
<form-property name="userCellular" type="java.lang.String" />
<form-property name="userPreferredChannel" type="java.lang.String" />
</form-bean>
</form-beans>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
<!-- Display main or login page -->
<action
path="/main_view"
type="portal.portlets.system.view.MainAction"
name="emptyBean">
<forward name="showWelcome" path="/systemMain.jsp"/>
<forward name="showLogin" path="/login_view.shtml"/>
<forward name="showLoggedIn" path="/loggedInGui.jsp"/>
<forward name="showRegisterUser" path="/registerUserGui.jsp"/>
</action>
<!-- Login action -->
<action
path="/login_control"
type="portal.portlets.system.control.LoginAction"
name="loginBean"
scope="session"
input="validateErrors"
validate="true">
<forward name="validateErrors" redirect="true" path="/login_view.shtml"/>
<forward name="done" redirect="true" path="/main_view.shtml"/>
<forward name="cancel" redirect="true" path="/main_view.shtml"/>
</action>
<action
path="/login_view"
type="portal.portlets.system.view.LoginView"
name="loginBean"
scope="session"
validate="false">
<forward name="success" path="/loginGui.jsp"/>
</action>
<!-- Register action -->
<action
path="/registerUser_control"
type="portal.portlets.system.control.RegisterUserAction"
name="registerUserBean"
input="done">
<forward name="invalid" redirect="true" path="/main_view.shtml"/>
<forward name="done" redirect="true" path="/main_view.shtml"/>
<forward name="cancel" redirect="true" path="/main_view.shtml"/>
</action>
</action-mappings>
<!-- ========== Controller Configuration ================================ -->
<controller inputForward="true"
processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"
/>
<!-- ========== Plug Ins Configuration
================================== -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml" />
</plug-in>
</struts-config>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
RE: Struts-bridge and validation
Posted by Shah Amit <am...@hotmail.com>.
I am not a champion with this, but have you added
<render-context>
<attribute name="errors"/>
</render-context>
in your struts-portlet-config.xml file ?? You would need that to preserve
request attributes after being forwarded to the same page ...
I might be wrong over here though. This is just a suggestion ...
Amit
----Original Message Follows----
From: Chris <ct...@gmail.com>
Reply-To: Chris <ct...@gmail.com>
To: jetspeed-user@portals.apache.org
Subject: Struts-bridge and validation
Date: Wed, 4 May 2005 17:29:58 +0200
Hi,
i have a problem with struts-bridge and validating via struts-plugin.
Validating seems to work, it forwarts back to the defined input page,
but trying to write out the validating errors I found out that the
ActionMessages, stored in org.apache.struts.action.ACTION_MESSAGE
attribute, is empty.
Any ideas?
I add the Struts-config for this module
regards
Chris
--------- Stuts Config ----------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
<!--
===================================================
The struts configuration for the SYSTEM PORTLET
===================================================
-->
<struts-config>
<form-beans>
<!-- Each action needs a Bean, even if it is empty. Otherwise NPE -->
<form-bean name="emptyBean"
type="org.apache.struts.action.DynaActionForm">
</form-bean>
<!-- User logs in -->
<form-bean name="loginBean"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="userLogin" type="java.lang.String" />
<form-property name="userPassword" type="java.lang.String" />
</form-bean>
<!-- User registers -->
<form-bean name="registerUserBean"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="userLogin" type="java.lang.String" />
<form-property name="userFamilyName" type="java.lang.String" />
<form-property name="userGivenName" type="java.lang.String" />
<form-property name="userEmail" type="java.lang.String" />
<form-property name="userCellular" type="java.lang.String" />
<form-property name="userPreferredChannel" type="java.lang.String"
/>
</form-bean>
</form-beans>
<!-- ========== Action Mapping Definitions
============================== -->
<action-mappings>
<!-- Display main or login page -->
<action
path="/main_view"
type="portal.portlets.system.view.MainAction"
name="emptyBean">
<forward name="showWelcome" path="/systemMain.jsp"/>
<forward name="showLogin" path="/login_view.shtml"/>
<forward name="showLoggedIn" path="/loggedInGui.jsp"/>
<forward name="showRegisterUser" path="/registerUserGui.jsp"/>
</action>
<!-- Login action -->
<action
path="/login_control"
type="portal.portlets.system.control.LoginAction"
name="loginBean"
scope="session"
input="validateErrors"
validate="true">
<forward name="validateErrors" redirect="true" path="/login_view.shtml"/>
<forward name="done" redirect="true" path="/main_view.shtml"/>
<forward name="cancel" redirect="true"
path="/main_view.shtml"/>
</action>
<action
path="/login_view"
type="portal.portlets.system.view.LoginView"
name="loginBean"
scope="session"
validate="false">
<forward name="success" path="/loginGui.jsp"/>
</action>
<!-- Register action -->
<action
path="/registerUser_control"
type="portal.portlets.system.control.RegisterUserAction"
name="registerUserBean"
input="done">
<forward name="invalid" redirect="true" path="/main_view.shtml"/>
<forward name="done" redirect="true" path="/main_view.shtml"/>
<forward name="cancel" redirect="true" path="/main_view.shtml"/>
</action>
</action-mappings>
<!-- ========== Controller Configuration
================================ -->
<controller inputForward="true"
processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"
/>
<!-- ========== Plug Ins Configuration
================================== -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml" />
</plug-in>
</struts-config>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org