IIRC this is just how `MessageFormat`
> > works.
>
> Yeah... getText() is using MessageFormat so you must properly escape
> your messages
>
> https://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html
>
>
> Regards
> -
wt., 2 kwi 2019 o 16:54 Dave Newton napisał(a):
>
> Single-quotes must be escaped using double single-quotes; single quotes are
> used to allow non-resource strings. IIRC this is just how `MessageFormat`
> works.
Yeah... getText() is using MessageFormat so you must properly escape
y
={0}is{1}and{2}.
> test.key2={0}'sis{1}and{2}.
>
> String key1= getText("test.key", newString[] {"aa11", "bb22", "cc33"});
> String key2= getText("test.key2", newString[] {"aa11", "bb22", "cc33"});
>
> Key 1:
I think found the issue. It fails because of '.
test.key={0}is{1}and{2}.
test.key2={0}'sis{1}and{2}.
String key1= getText("test.key", newString[] {"aa11", "bb22", "cc33"});
String key2= getText("test.key2", newString[] {"aa11"
your struts.xml? This is rather something with your
config, I have tested the same in my app and everything looks good:
System.out.println(getText("test.key", new String[] { "A", "B", "C" }));
test.key={0} is {1} and {2}
"A is B and C&quo
:03 Affan Osman napisał(a):
> >
> > I am passing in three parameters to getText but only the first one gets
> > populated.
> >
> > getText("error.invalidcode", new String[] {"name", "num", "1az"});
> >
> > And in my App
sob., 30 mar 2019 o 20:03 Affan Osman napisał(a):
>
> I am passing in three parameters to getText but only the first one gets
> populated.
>
> getText("error.invalidcode", new String[] {"name", "num", "1az"});
>
> And in my App
I am passing in three parameters to getText but only the first one gets
populated.
getText("error.invalidcode", new String[] {"name", "num", "1az"});
And in my ApplicationResources.properties
error.invalidcode={0} and {1} property has error with code
You may want to checkout this tutorial and the example code that goes with
it:
http://struts.apache.org/release/2.3.x/docs/unit-testing.html
--
View this message in context:
http://struts.1045723.n5.nabble.com/How-to-Mock-getText-customerLabel-method-in-junit-tp5713562p5713597.html
Sent
2013/8/29 Mohit Gupta :
> I am facing one issue while writing the junit of my struts 2 action
> class.My action class has following code
> snippet
>
> getText("customerLabel")
>
> While execution of junit i get below error though works fine thru
>
I am facing one issue while writing the junit of my struts 2 action
class.My action class has following code
snippet
getText("customerLabel")
While execution of junit i get below error though works fine thru
application(i think
Struts controller loads it while normal web
2013/7/18 Paul Benedict :
> I have a global properties file with this key:
> emailSent=The email was sent to {0}.
>
> I add a message in my action:
> addActionMessage(getText("emailSent", Arrays.asList(email)));
>
> And the {0} stays in the output. Why is this?
Stra
I have a global properties file with this key:
emailSent=The email was sent to {0}.
I add a message in my action:
addActionMessage(getText("emailSent", Arrays.asList(email)));
And the {0} stays in the output. Why is this?
--
Cheers,
Paul
You are right!
On Fri, Oct 19, 2012 at 2:54 PM, Hoying, Ken wrote:
> I believe that your problem is that the field names are the same as your
> label names and with the validator both are in the stack.
> ${getText(user.password)} is first evaluating user.password and finding the
>
I believe that your problem is that the field names are the same as your label
names and with the validator both are in the stack. ${getText(user.password)}
is first evaluating user.password and finding the field value "1234". getText
is then trying to locate an entry for "1
Mi mistake. Sorry.
The resource error message I was using is in fact:
errors.confirmPassSame=The ${user.confirmPassword} field has to have the
same value as the ${user.password} field.
whereas it should be:
errors.confirmPassSame=The ${getText("user.confirmPassword")} field has t
Hi,
I'm having a problem with getText().
I have the following xml validator:
(user.confirmPassword.equals(user.password))
And the error message is defined in a bundle like
:
reject.to=Reject to
reject.to.larry=%{getText('reject.to')} Larry
or use the getText call in your tag:
or, if users is a collection to iterate over, containing user beans with a
property firstName:
See also:
https://cwiki.apache.org/confluence/display/WW/Localization
https://cwiki.
The key attribute is for simple resource properties lookup only, without
MessageFormat. The tag is able to deal with MessageFormat in
particular.
In your case you could either use specialized properties in your bundle:
reject.to=Reject to
reject.to.larry=%{getText('reject.to')} Lar
If you want a definitive solution, i suggest you create a new method like:
getTextEx(.)
in your action,
in this method, you can check the parameters, if they are null, change
them to empty string, and then invoke the original getText method.
you can put this method in the base class of
r is always shown
in the Java default number format. Not only that this is not "nice", if you
are in a non-en locale, it will also cause trouble when submitting the form
since type conversion is locale aware. The solution is to again use the
message formats as defined above, by using the g
this is not "nice", if you
> are in a non-en locale, it will also cause trouble when submitting the form
> since type conversion is locale aware. The solution is to again use the
> message formats as defined above, by using the getText Method of
> ActionSupport:
>
> val
o input a number, one might have noticed that the number is always shown
> in the Java default number format. Not only that this is not "nice", if you
> are in a non-en locale, it will also cause trouble when submitting the form
> since type conversion is locale aware. The solutio
se the message formats as defined above, by using the
getText Method of ActionSupport:
value="%{getText('format.number',{orderItem.price})}" />
This maps to the method signature getText( String key, Object[] params )
in ActionSupport."
(http://struts.apache.org/2.
helps.
2011/11/17 Burton Rhodes :
> I am having an issue with displaying the original value entered on a
> form after failed type conversion. This "bug" is caused by my use of
> getText() in the form value fields. I'm curious how one solves this
> issue for making
I am having an issue with displaying the original value entered on a
form after failed type conversion. This "bug" is caused by my use of
getText() in the form value fields. I'm curious how one solves this
issue for making sure the field is formatted correctly upon display,
but a
; > would prefer otheer solution...if possible.
> > > Sent via BlackBerry from T-Mobile
> > >
> > > -Original Message-
> > > From: Chris Pratt
> > > Date: Thu, 16 Jun 2011 22:24:33
> > > To: Struts Users Mailing List
> > > Repl
2011 22:24:33
> > To: Struts Users Mailing List
> > Reply-To: "Struts Users Mailing List"
> > Subject: Re: getText on XSLT transformation on an Action
> >
> > There's no reason the XSL should be dynamic. The XML is typically the
> > dynamic part w
tt
> Date: Thu, 16 Jun 2011 22:24:33
> To: Struts Users Mailing List
> Reply-To: "Struts Users Mailing List"
> Subject: Re: getText on XSLT transformation on an Action
>
> There's no reason the XSL should be dynamic. The XML is typically the
> dynamic part with
Berry from T-Mobile
>
> -Original Message-
> From: Chris Pratt
> Date: Thu, 16 Jun 2011 22:24:33
> To: Struts Users Mailing List
> Reply-To: "Struts Users Mailing List"
> Subject: Re: getText on XSLT transformation on an Action
>
> There's no reaso
List"
Subject: Re: getText on XSLT transformation on an Action
There's no reason the XSL should be dynamic. The XML is typically the
dynamic part with the XSL being static (so that it can be parsed and cached
for efficiency). Why not include a section in the XML with the replace
and transform it to HTML using XSLT. The
> >> transformation
> >> > is done in the action, and the output is returned as a stream and sent
> to
> >> > the client. It works fine, but now I need to write some labels that
> >> depend
> >> > o
;m using Struts 2.1.8.1. I have an action that retrieves some XML data
>> > from a webservice, and transform it to HTML using XSLT. The
>> transformation
>> > is done in the action, and the output is returned as a stream and sent to
>> > the client. It works fine
is done in the action, and the output is returned as a stream and sent to
> > the client. It works fine, but now I need to write some labels that
> depend
> > on the user's locale. Is there any way to call getText from the XSLT
> > stylesheet, so it uses the action that calle
e user's locale. Is there any way to call getText from the XSLT
> stylesheet, so it uses the action that called the transformer as the basis
> to look for the package with the labels in the diferent languages? It
should
> also use the user's locale, but since it gets it from
that depend
on the user's locale. Is there any way to call getText from the XSLT
stylesheet, so it uses the action that called the transformer as the basis
to look for the package with the labels in the diferent languages? It should
also use the user's locale, but since it gets it from the Ac
2011/6/7 Stephen Ince :
> Thanx a lot Lukask! That was quick.
Please test it if you can, thanks in advance!
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
Thanx a lot Lukask! That was quick.
Steve
- Original Message -
From: "Lukasz Lenart"
To: "Struts Users Mailing List"
Sent: Tuesday, June 07, 2011 7:40 AM
Subject: Re: ognl and getText for s:textfield/placeholder
Ok, solved, please wait a bit, SNAPSHOT version
>
> Steve
> https://issues.apache.org/jira/browse/WW-3644
>
> - Original Message - From: "Lukasz Lenart"
>
> To: "Struts Users Mailing List"
> Sent: Tuesday, June 07, 2011 7:07 AM
> Subject: Re: ognl and getText for s:textfield/placeholder
>
Lukasz,
I reported the issue. Thx again for you time.
Steve
https://issues.apache.org/jira/browse/WW-3644
- Original Message -
From: "Lukasz Lenart"
To: "Struts Users Mailing List"
Sent: Tuesday, June 07, 2011 7:07 AM
Subject: Re: ognl and getText for s:t
quot;
>
> To: "Struts Users Mailing List"
> Sent: Tuesday, June 07, 2011 6:57 AM
> Subject: Re: ognl and getText for s:textfield/placeholder
>
>
> It isn't supported, but it can be, I think. Could you register an
> issue ? It's not only related to Dojo t
ubject: Re: ognl and getText for s:textfield/placeholder
It isn't supported, but it can be, I think. Could you register an
issue ? It's not only related to Dojo tags (as TextField doesn't have
Dojo version).
The change should be simple:
AbstractUITag, line 294
public void set
e
> fields. Is there a flag that I can tell struts2 to evaluate placeholder
> field.
>
> The following did work:
> value='%{getText("placeHolder.Username")}' />
>
> The submit button has the correct resource key value.
> but this will not work.
>
Lukasz,
Thx for your response. A resource key. I tried that. It seems that strut2
will only ognl evaluate certains fields and "placeholder" is not one of the
fields. Is there a flag that I can tell struts2 to evaluate placeholder
field.
The following did work:
value=
2011/6/7 Stephen Ince :
> placeholder="%{getText('placeHolder.Username')}" id="j_username"
> name="j_username" cssStyle="width:180px" />
What is placeHolder, a bean or a resource key ?
If bean: "%{getText(placeHolder.Username)}&qu
I am trying to use ognl/getText to assign a placeholder attribute for a
s:textfield. I can not seem to get it to work. I am using struts 2.2.3.
e.g.
My hunch is that the placeholder field is not being evaluated . I am using dojo
with struts2 and would like to add placeholder attributes where
You can setup a locale in the session and Struts will use that for all
your texts.
-Original Message-
From: franc...@rendezvouscentral.com
[mailto:franc...@rendezvouscentral.com]
Sent: Tuesday, March 29, 2011 6:26 PM
To: user@struts.apache.org
Subject: getText
Hi Everybody
is there a
thx a lot it seems to be exactly what I need Francois Rouxel
www.rendezvouscentral.com
Original Message
Subject: Re: getText
From: Okan_Özeren_[via_Struts]
< ml-node+4271219-775331120-194...@n5.nabble.com >
Date: Wed, March 30, 2011 6:40 am
To: &
Everybody
> is there a way to use getText in an action and specify the locale (I mean
,
> I don't want struts to use the getLocale() from the browser) ?
>
> something like that getText('my.ref',myLocale);
>
> thx a lot
>
> --
> View this message in c
Hi Everybody
is there a way to use getText in an action and specify the locale (I mean ,
I don't want struts to use the getLocale() from the browser) ?
something like that getText('my.ref',myLocale);
thx a lot
--
View this message in context:
http://struts.1045723.n5.nab
the only thing i have different is a space before and after the = in the
resource file
apart from that i'm using getText as you are.
adam
> Date: Tue, 23 Mar 2010 11:12:19 -0700
> Subject: Weird behavior in getText()
> Fr
Chris Pratt wrote:
for some reason, in my current instance it's trying to
evaluate the resource bundle key as an OGNL expression.
A couple weeks ago I finally took the time to look at lots of the
warning output in my log files and was able to use that to fix a few
buggy ognl expressions (yay
I'm seeing some weird behavior in ActionSupport.getText() that is causing me
some problems in Struts 2.0.14. From the docs (and my previous experience),
getText() retrieves entries from the resource bundle's associated with the
application. But for some reason, in my current instance i
Hi Struts users:
I'm working with Struts 2. I have following property file:
solicitud.error.solicitante.enCalidad = Debe introducir en calidad de del
solicitante.
.
.
.
solicitante.enCalidad = En calidad
I know keys are similar, but not the same. When I try to retrieve
ge
login.properties has to be mentioned in you struts.properties file as
struts.custom.i18n.resources=login
Above means that login.properties resides in WEB-INF/classes
On Wed, Jan 20, 2010 at 1:47 PM, Emi Lu wrote:
> Lukasz Lenart wrote:
>
>> Please read documentation, everything is explained th
Lukasz Lenart wrote:
Please read documentation, everything is explained there.
http://struts.apache.org/2.1.8.1/docs/localization.html
http://struts.apache.org/2.1.8.1/docs/strutsproperties.html
This did not answer my question :(
Using package.properties works fine for me. The problem is how
Please read documentation, everything is explained there.
http://struts.apache.org/2.1.8.1/docs/localization.html
http://struts.apache.org/2.1.8.1/docs/strutsproperties.html
Regards
--
Lukasz
Kapituła Javarsovia 2010
http://javarsovia.pl
ruts2 read login.properties:
(1) where should the login.properties saved?
(2) Do I need any setup in strut.xml or web.xml to
getText("username.required") from login.properties?
Thanks a lot!
--
Lu Ying
-
To unsubscribe, e
When system is starting, I want to log 1 message in Operating system locale.
How can I do that??
Thanks,
Ashish
--
View this message in context:
http://www.nabble.com/get-resource-getText-at-system-start-tp23885793p23885793.html
Sent from the Struts - User mailing list archive at Nabble.com
Burton Rhodes wrote:
I know this is a simple one, but for some reason just can't crack it.
I have a resource property like so:
titleOptions=Mr.,Mr. & Mrs.,Mrs.,Ms.,Dr.,Dr. & Mrs.,Mr. & Dr.,Dr. & Dr.
And then I have html like this:
I've tried surrounding it by #{...} in several places but get
I know this is a simple one, but for some reason just can't crack it.
I have a resource property like so:
titleOptions=Mr.,Mr. & Mrs.,Mrs.,Ms.,Dr.,Dr. & Mrs.,Mr. & Dr.,Dr. & Dr.
And then I have html like this:
I've tried surrounding it by #{...} in several places but get an a
parse error or ca
Hi all.
This line is in my Action myaction:
addFieldError("azienda", getText("error.azienda"));
This is in my myaction.properties:
error.azienda=È necessario specificare il nome ed il cognome.
Output in html is:
È necessario specificare lazienda di appartenenza.
How ca
On Wednesday 04 March 2009 15:52:37 Security Management wrote:
> I would like the getText() methods to pull information from a database
> "Meaning" table.
>
> Would the proper way to do that be to subclass ActionSupport and
> re-implement that interface? Then, al
I would like the getText() methods to pull information from a database
"Meaning" table.
Would the proper way to do that be to subclass ActionSupport and
re-implement that interface? Then, all my actions inherit from
MyActionSupport, and the getText stuff is different.
If that's
If your actions are extending ActionSupport than you can go like so:
public String intercept(ActionInvocation invocation) throws Exception {
String message = ((ActionSupport)
invocation.getAction()).getText("resource.key")
...
}
Zarar
On Thu, Feb 26, 2009 at 12:23 PM
I have LoggedInInterceptor.java and LoggedInInterceptor.properties in a
package, how do I use getText from the interceptor to read from the
properties file?
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For
Good Evening Lu-
there is a good illustration of this resolution of getText available in Struts
2.1.2 editEmployee.jsp the example is a textfield which pulls attribute
firstName from employee
here is the definition for 'save' method defined for EmployeeAction in
Hi all,
Well I think I figured out what's happening but not why.
I was using and noticed
session {WW_TRANS_I18N_LOCALE=ga}
locale en_US
With more than one tile in use the locale doesn't get changed
I assume s:text reads off
com.opensymphony.xwork2.ActionContext.locale
a
david.kerw...@hse.ie]
Sent: 06 February 2009 14:57
To: user@struts.apache.org
Subject: Struts2 + tiles + i18n, getText issue
Hi,
I've come across a problem I can't figure out it seems similar to
http://www.mail-archive.com/user@struts.apache.org/msg76063.html
These two statements gi
>
>
>> (2) Put package.properties under /WEB-INF/classes/
>>
>>
> have you tried to put package.properties under the same package as your
action class?AFAIK package.properties only works with classes in the same
package or classes sub-classing the classes in the package.
Hi,
I've come across a problem I can't figure out it seems similar to
http://www.mail-archive.com/user@struts.apache.org/msg76063.html
These two statements give different results when the language is changed
With s:text giving the correct language text but getText always
Finally, in JSP(not through action) success by doing the following:
(1) Create "struts.properties" under WEB-INF/classes/
struts.custom.i18n.resources=globalMessages
(2) Create globalMessages_en_US.properties
label.test= test label value
(3) in JSP,
--
Lu Ying
Emi Lu wrote:
htt
Emi Lu wrote:
http://t.wits.sg/2008/06/23/howto-struts-2-i18n/
Did not success.
(1) in package.properties
label.code=example value
(2) Put package.properties under /WEB-INF/classes/
(3) in jsp
Still cannot see the result?
Again: are you accessing the JSP through an action?
Dave
http://t.wits.sg/2008/06/23/howto-struts-2-i18n/
Did not success.
(1) in package.properties
label.code=example value
(2) Put package.properties under /WEB-INF/classes/
(3) in jsp
Still cannot see the result?
--
Lu Ying
---
're mis-understanding how the text is retrieved from the JSP: the JSP
>> is calling the action's getText(...) method.
>>
>> Are you accessing the JSP directly, or through an action?
>
> I am new to struts2. I tried to use getText directly in JSP. Is it possible
> that
Hi Dave,
(3) but I do not know how jsp can recognize "package.properties"?
You're mis-understanding how the text is retrieved from the JSP: the JSP
is calling the action's getText(...) method.
Are you accessing the JSP directly, or through an action?
I am new to str
package.properties" to display getText() in jsp
please?
More testing results are:
(1) Action class can recognize both "ProcessInfo.properties" and
"package.properties"
(2) JSP recognized "ProcessInfo.properties"
(3) but I do not know how jsp can recognize
I got why: I have to name the same property file name as the action
class. Rename "package.properties" to ProcessInfo.properties, I got
correct result.
I just wonder isn't "package.properties" is recognized automatically?
May I know how to use "package.prope
package.properties" to display getText() in jsp
please?
Thanks a lot!
--
Lu Ying
Hi Martin,
Take a look at this example
what is displayed when property is displayed in jsp?
I got the same value displayed "edit.action" :( Do you know where I did
wrong please?
A questi
rdia.ca
To: user@struts.apache.org
Subject: getText did not return value in s:submit
Good afternoon,
A question about getText in jsp file. I'd like to get value from
property file.
in package.properties,
edit.action=Edit information
in jsp,
...
The result always shows &
> Subject: getText did not return value in s:submit
>
> Good afternoon,
>
> A question about getText in jsp file. I'd like to get value from
> property file.
>
> in package.properties,
> edit.action=Edit information
>
>
> in jsp,
> ...
>
>
Good afternoon,
A question about getText in jsp file. I'd like to get value from
property file.
in package.properties,
edit.action=Edit information
in jsp,
...
The result always shows "edit.action" as the button value, but not "Edit
information". Coul
I need to fetch a locale specific string for an evaluation and cannot get
the syntax worked out:
!title.toUpperCase().equals( getText("titleMatch") )
Should this work? I also tried:
!title.t
Hi,
we need for a migration of an old application to use the complete
RessourceBundle.
To get the texts with getText works fine. But when we try to get the whole
RessourceBundle with getTexts, we just get null. Does getTexts not retrieve
the package.properties somewhere in the buildpath like
; Any idea about how the first command (getText) works
> but the second one
> does not?
>
> 1.-
> targets="workspaceAjaxContent"
> executeScripts="true"
> onclick="var a =
> confirm('%{getText('Delete.Confirm')}');
>
Hello,
Any idea about how the first command (getText) works but the second one
does not?
1.-
executeScripts="true"
onclick="var a = confirm('%{getText('Delete.Confirm')}');
if (a) {dojo.event.topic.pub
s
and resource2.properties at the root of your classpath.
Zarar
On Nov 15, 2007 7:09 AM, Dean Pullen <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>
>
> Having a perculiar problem regarding getText() in an action.
>
>
>
> It seems to be returning the key, not its value, ev
Hi all,
Having a perculiar problem regarding getText() in an action.
It seems to be returning the key, not its value, even though the key
exists.
(Which is odd, as the javadocs say getText returns null if key not
found).
The action is a login action, not sure if that makes any
hi Vinicius,
this works fine.
the correct syntax for me is:
because the variable THEME is stored in the request or session or action.
thanx a lot.
regards marco
Vinicius Medeiros Peretti wrote:
>
> Hi Marco
> I use:
> value="%{getText( #Variable+'.string.constant
Hi Marco
I use:
value="%{getText( #Variable+'.string.constant.label.'+OtherVariable)}"
try:
regards,
Vinicius
Marco Machmer wrote:
hi folks,
can i use #attr inside the getText()-methode?
here my problem:
the key will not be found.
whats wrong
r
hi folks,
can i use #attr inside the getText()-methode?
here my problem:
the key will not be found.
whats wrong
regards marco machmer
--
View this message in context:
http://www.nabble.com/-S2--getText%28%29-and--attr-tf4751113.html#a13585395
Sent from the Struts - User mailing list archive
Hi,
Junit is unable to run getText() and retrieve text resources from a package.xml
file, because it appears to be a functionality that is provided by the
ActionSupport super class. Is there a way to setup my Junit test case to be
able to run that code? I've setup my test case to use a
hi,
I've spent the last couple of weeks migrating our site from webwork 2 to struts
2. The Struts 2 version of the app worked fine on my windows machine, as well as
in our qc environment (apache/tomcat 5).
However, when we rolled the code to the production servers, we encountered a
rather major p
Hello,
I'm wondering if one can include some html in a where passwordConfirmation is
such as passwordConfirmation = Password (confirmation).
In struts 1 there was an attribute (can't recall the exact name but
was something like filter="false" or such) that allowed html to be
interpreted.
Is th
94 matches
Mail list logo