struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan" <i...@interd4u.com>
Subject Re: Validation - can i use multiple properties ?
Date Tue, 04 May 2004 14:26:38 GMT
Take a look at

JSTL format with multiple Resource Bundles
http://www.cheblogs.com/roller/page/princeamin/20031104


<fmt:bundle basename="XXX">
   <fmt:message key="Field1" />
</fmt:bundle>


----- Original Message ----- 
From: "johannes Schwarz" <johannes.schwarz@iai.fzk.de>
To: "'Struts Users Mailing List'" <user@struts.apache.org>
Sent: Tuesday, May 04, 2004 3:54 PM
Subject: AW: Validation - can i use multiple properties ?


I know this and i use this language files.

XXX_de.properties
XXX_en.properties

AND

YYY_de.properties
YYY_en.properties

I use a action to set the language:
-------------
String lang = httpServletRequest.getParameter("language");
Locale newlang = new Locale(lang);
this.setLocale(httpServletRequest, newlang);
-------------

And in all jsp-Pages i can use the properties.



But why isn't it possible to use different properties between the
validation file?

If i use three different forms (html-formular), than i would like to use
also

-> three different validationfiles
it works, i use between struts-config:
<set-property property="pathnames"
value="X-validation.xml,Y-validation.xml"/>

X-Validation.xml is defined for formular 1
Y-Validation.xml is defined for formular 2 and so on

-> three different configfiles
it works, i use between struts-config:
[<!ENTITY actions1 SYSTEM "MyActions1.xml"> ] and at the
position i write &actions;

MyActions1.xml is defined for formular 1 (all actions for this
fields...)
MyActions2.xml is ...


-> three different properties-files
it works between the jsp-pages, but NOT between VALIDATION.

//The defenition between config
<message-resources paramter="XXX"/>
<message-resources paramter="YYY" key="Mypara1"/>
<message-resources paramter="ZZZ" key="Mypara2"/>
//My jsp-Pages:
Page1.jsp: ...<bean:message key="Field1" bundle="Mypara1"/>:
<html:text property="field1"...
Page2.jsp: ...<bean:message key="Field1" bundle="Mypara2"/>:
<html:textarea property="field1"...


Why defines validation.xml the properties-file automatically?
(in my example, validation use the ressource-parameter XXX for all
pages)

But I would like to define this "for each" line between the Validation
;-)

Example (Validation.xml):
---------
<formset>
<field ...>
<!-- i would like to define the value from the file YYY
!>
<arg0 key="Field1.error" bundle="Mypara1"/>
</field>
</formset>
<formset>
<field ...>
<!-- i would like to define the value from the file ZZ
!>
<arg0 key="Field1.error" bundle="Mypara2"/>
</field>
</formset>
-----------

But "bundle" doesnt work ;-(

Thanks
Johannes



-----Urspr√ľngliche Nachricht-----
Von: nils.mueller@accenture.com [mailto:nils.mueller@accenture.com]
Gesendet: Dienstag, 4. Mai 2004 13:24
An: user@struts.apache.org
Betreff: RE: Validation - can i use multiple properties ?



Hi Johannes,

are you aware of localization / i18n support by having multiple language
property files? Like:

XXX_de.properties
XXX_en.properties
XXX_fr.properties
...

Struts then chooses the properties-file depending on locale. Maybe a
look at that stuff helps.

good luck
Nils


-----Urspr√ľngliche Nachricht-----
Betreff: Validation - can i use multiple properties ?
Hello,

with struts-config.xml i define:

<message-resources paramter="XXX"/>
<message-resources paramter="YYY" key="Mypara"/>

Than I can write the following code in a jsp-File:

<bean:message key="Field1"/> (i see the Field1-value from the XXX-File)
<bean:message key="Field1" bundle="Mypara"/> (I see the Field1-value
from the YYY-File)


now I am using a form with validation.xml.
Some fields are required and the shown error is:

...
<arg0 key="Field1.error"/>
...

On Submit I see the Field1.error-value from the XXX-File.
I would like to see the error-value from the YYY-File. Is this possible?


Thanks
Johannes


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


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


Mime
View raw message