Struts validator - rule in one place

P

Per

Hi there,

I have a question concerning Struts validator framework:

If have the same attribute for example salary in two forms is there any possibility
to define the validation rule in one place.
So that my form-field can depend on that rule.

regards


<form-validation>
<formset>

<form name="userFormVF">
<field property="userId" depends="required">
<arg0 key="prompt.userId"/>
</field>
<field property="salary" depends="double">
<arg0 key="prompt.salary"/>
</field>
</form>

<form name="userFormDVF">
<field property="userId" depends="required">
<arg0 key="prompt.userId"/>
</field>
<field property="salary" depends="double">
<arg0 key="prompt.salary"/>
</field>
</form>
</formset>
</form-validation>
 
S

Sudsy

Per said:
Hi there,

I have a question concerning Struts validator framework:

If have the same attribute for example salary in two forms is there any possibility
to define the validation rule in one place.
So that my form-field can depend on that rule.
<snip>

What you could do is write a small application which would generate
the validation XML file automatically. You could implement the ability
to share field definitions between forms, etc.
I'm actually working on such a tool to make it easier for some people
to generate the configuration files for validation and multi-page
forms. Of course you end up creating a new file format which contains
meta-date about your FormSet... ;-)
 
M

Martin Froment

Good question !!

I don't know if it is possible, but I suggest you to try your validation on
a BaseUserForm (extending ActionForm), superclass of UserFormVF &
UserFormDVF... Let me know if it is working !!

Martin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top