Hi Jason and all,

yes indeed, i still have this problem... :-)

I wan't to do field validation with model driven action having a model bean as usual...

 - if i provide getModelBean() and setModelBean() in actionsupport class the model 
reference will be handled as normal fields
   and fields of the bean can be accessed from jsp or velocety by    
'modelBean.fieldX'  ...
 - field validation can be done via the action-validation.xml holding field 
'modelBean' via 'visitor' type
   and a ModelBean-validation.xml holding the fields of the bean e.g. via 'required' 
type

so everything works fine

then i tried:
 - implementing the ModelDriven interface in actionsupport class, instanciating 
modelbean class and implementing getModel() method

what does not work is:
 - then simply access fields of the ModelBean instance via the field name like <input 
type="text" value="<ww: property name="fieldname" />">
   because while action is performed webwork don't updates the fields of the bean via 
its setters and because of this validation always fails and
   says: field errors (requiredstring e.g.) ...

here some code:

bean class
-----------------
public class Identity {
 String identityName = "";
 String firstName = "";
 public String getIdentityName() { return identityName;}  + setter
 public String getFirstName() { return firstName;} + setter
}

Identity-validation.xml
------------------------------------
...
<validators>
 <field name="identityName">
  <field-validator type="requiredstring">
       <message>Identitaetsname fehlt</message>
   </field-validator>
</field>
...
</validators>

do i still need a validating.xml for the AddIdentityAction action ?
if yes, what fields in it? identity's fields or identity as field via visitor type or 
both

AddIdentityAction class
-------------------------------------
public class AddIdentityAction extends MyValidatingActionSupport implements 
ModelDriven {
 Identity identity = new CIdentity();
 public Object getModel() { return identity;}
 public String execute() throws Exception {  ... }
}

action mapping in xwok.xml
-------------------------------------------
<action name="addIdentity" class="AddIdentityAction">

 what interceptors do i really need ?

 <interceptor-ref name="static-params"/>   what does they (or where can i read about 
it)  :-)
 <interceptor-ref name="params"/>
 <interceptor-ref name="conversionError"/>
 <interceptor-ref name="validationWorkflowStack"/>
 <result name="input" type="dispatcher">identityAdd.jsp</result>
 <result name="error" type="dispatcher">identityAdd.jsp</result>
 <result name="success" type="dispatcher">...</result>
</action>


thanks for reading up to this line :-)
and hopin someone could help

jp












05.01.2004 18:35:13, "Jason Carreira" <[EMAIL PROTECTED]> wrote:

>I see Hani's suggestion fixed question 1, are you still having problems with question 
>2?
>
>Applying field validators for the fields of your Model (or your Action, as they are 
>both on the ValueStack) should work. Give me some more detail if it's not.
>
>Jason
>
>> -----Original Message-----
>> From: Jan-Peter Hagenm�ller [mailto:[EMAIL PROTECTED] 
>> Sent: Monday, January 05, 2004 10:04 AM
>> To: [EMAIL PROTECTED]
>> Subject: Spam:Re: AW: [OS-webwork] Passing model from one 
>> action to another
>> 
>> 
>> 
>> 
>> Hi all!
>> 
>> I got two questions:
>> 
>>  - is there a way to use german vowels like ' � ' ( &uuml; )
>>    in xxx-validation.xml files for field validations
>>    both spellings '�' and &uuml; seem not to be valid
>> 
>>  - i want to use modeldriven action implementation and field 
>> validation
>> 
>>     - 1. i implement the interface ModelDriven, initiating my 
>> model bean and returning it in getModel() ... ok
>> 
>>     - but how must the fields be called in xxx-validation.xml 
>> file and in my jsp ??
>>       i tried both variations in both files:
>>       - <input... name = "model.attribute" 
>> value="<ww:property value="model.attribute"/>">
>>       - <input... name = "attribute" value="<ww:property 
>> value="attribute"/>">
>>      
>>       => it does not work as expection....
>>       may i need special interceptor refs in action mappings?
>> 
>>      - i got it as usual yet:
>>        - initiationg the model and have get/setter methods for it
>>        - an actionXXX-validation.xml file holding the field 
>> 'model' with field-validator type "visitor"
>>        - an model-validation.xml holding models attributes 
>> with e.g. requiredstring type
>>        - using <input... name = "model.attribute" 
>> value="<ww:property value="model.attribute"/>"> in jsp
>> 
>>      => it works well
>> 
>>     but what for do i use this ModelDriven mechanism ... if 
>> not to reduce this coding efforts ?  :-)
>> 
>> so i would be pleased if anyone could help out
>> 
>> thanks
>> jp
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> -------------------------------------------------------
>> This SF.net email is sponsored by: IBM Linux Tutorials.
>> Become an expert in LINUX or just sharpen your skills.  Sign 
>> up for IBM's Free Linux Tutorials.  Learn everything from the 
>> bash shell to sys admin. Click now! 
>> http://ads.osdn.com/?ad_id=1278&alloc_id=3371> &op=click
>> 
>> _______________________________________________
>> 
>> Opensymphony-webwork mailing list 
>> [EMAIL PROTECTED]
>> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
>> 
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: IBM Linux Tutorials.
>Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
>Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
>Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op�k
>_______________________________________________
>Opensymphony-webwork mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
>
>





-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to