struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: [Fwd: Having problems with Struts validation framework]
Date Sun, 26 Nov 2006 23:00:21 GMT
More simply, you can use the <html:cancel> tag to generate your cancel 
button.

For your second question, no, there's no way for different buttons to 
invoke different actions (at least, not without some hokey Javascript 
hackery), but you can have different buttons call different methods on 
the *same* action, using one of the various dispatch actions that come 
with Struts.

L.

Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Robin,
> 
> All you have to do is set the name of your button to Globals.CANCEL_NAME
> (not that exact text, but use that constant to set the "name" attribute
> of that submit button element).
> 
> - -chris
> 
> robin bajaj wrote:
>> Hello folks,
>> I found a little issue with the action that's being called.
>> Please dis-regard my previous mail reporting this issue.
>> Its resolved now.
>>
>> However, I have another related issue.
>> My loyaltyPAge.jsp has two buttons - Exit and continue.
>>
>> I want the validation to occur only when "Continue" is clicked upon.
>> But because there's one form in the LoyaltyPage.jsp having these two
>> buttons, they both get evaluated using one actionMapping (which has the
>> validate=true).
>>
>> Is there some facility provided by the Struts framework to
>> SKIP the validation when a specific button (Exit) is clicked
>> and ONLY OCCUR when another button(*Continue) is clicked . ???
>>
>> A corollary question to this would be,
>> Is it possible for one JSP to have two buttons in one form,
>> and each button calling a different Action.
>>
>> Currently as I know, the action gets called based on the
>> <html:form action="">  setting.
>>
>>
>> Any help would be much appreciated,
>> regards,
>> robin.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> Subject:
>> Having problems with Struts validation framework
>> From:
>> robin bajaj <robinbajaj@gmail.com>
>> Date:
>> Thu, 23 Nov 2006 11:51:17 -0500
>> To:
>> Struts Users Mailing List <user@struts.apache.org>
>>
>> To:
>> Struts Users Mailing List <user@struts.apache.org>
>>
>>
>> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFFZwcx9CaO5/Lv0PARAsnRAKC+z3fqs2GFzxziRXoyjLdam+NbsACgrjFE
> C1QzHAWy5/sZHZJGb3PUn5U=
> =yZZl
> -----END PGP SIGNATURE-----


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


Mime
View raw message