You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by robin bajaj <ro...@gmail.com> on 2006/11/23 17:51:17 UTC

Having problems with Struts validation framework

Hi Folks,

--- problem ---
My validation is working but the control doesnt go back to the input 
page. I want the input page to render again showing the errors.

--- Details --
I am using Struts 1.1.x for my webApp.
My validation is working fine. (validator-rules.xml and 
validation-renewal.xml setup correctly and declared in 
struts-config-renewal.xml file).

I want to validate an "Email" text field on "LoyaltyPage.jsp", it has to 
be non-empty, valid email address.

Here's the snippet from validation-renewal.xml
-------------------------
  <form name="loyaltyForm">
	            <field property="email"
	                    depends="required,email">
	                <msg name="required"  key="error.loyaltyPage2" 					/>
	                <msg name="email"  key="error.loyaltyPage3" />
	            </field>
   	    </form>
----------------------

Here's the snippet from struts-config-renewal.xml
----------------------
<action path="/processLoyalty"
			   type="com.xyz.flow.action.renewal.ProcessLoyaltyPageAction"
			   name="loyaltyForm"
			   scope="request"
			   validate="true"
			   input="/LoyaltyPage.jsp" >
			   <forward name="exit" path="/EquipmentList.jsp"></forward>
			   <forward name="continue" path="/processRegistration.do"></forward>
                <forward name="failure" 
path="/ErrorPageRenewal.jsp"></forward>
         </action>

----------------------

I do notice that validation is occuring but the control doesnt go back 
to the loyaltypage.jsp even though I have mentioned it as the input 
attribute in the action mapping. I just get a blank page in the browser.

"input="/LoyaltyPage.jsp"

I have tried changing the input attribute to the action that actually 
forwards to loyaltyPage.jsp
"input="/getLoyalty.do"

but in both the cases, I get the blank page in the browser. I want the 
loyaltypage.jsp to render again with the error messages showing up.

The following logs show clearly that the validation is occuring, form is 
failing the validation, but the input page is still not rendering in the 
browser.

What's the missing piece in the whole picture, please help ???

----
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor - Processing a 'POST' for path 
'/processLoyalty'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  Looking for ActionForm bean instance in 
scope 'request' under attribute key 'loyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  Creating new ActionForm instance of type 
'com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  --> 
com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm@1d964b7
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Storing ActionForm bean instance 
in scope 'request' under attribute key 'loyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Populating bean properties from 
this request
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
BeanUtils.populate(com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm@1d964b7, 
{actionValue=[Ljava.lang.String;@1633bbd, 
contactMethod=[Ljava.lang.String;@1e719e8, 
sendCommunication=[Ljava.lang.String;@155f12b, 
email=[Ljava.lang.String;@14c7c48})
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty(com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm@1d964b7, 
actionValue, [continue])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string 'continue' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
org.apache.commons.beanutils.converters.StringConverter@c017d
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty(com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm@1d964b7, 
contactMethod, [])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string '' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
org.apache.commons.beanutils.converters.StringConverter@c017d
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty(com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm@1d964b7, 
sendCommunication, [false])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string 'false' to class 
'boolean'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
org.apache.commons.beanutils.converters.BooleanConverter@de8a94
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty(com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm@1d964b7, 
email, [])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string '' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
org.apache.commons.beanutils.converters.StringConverter@c017d
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Validating input form properties
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Validation failed, returning to 
'/getLoyalty.do'
--------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org