2014-05-28 6:34 GMT+02:00 Alireza Fattahi <[email protected]>:
> Meanwhile, I tried to find a way to pass textprovider to jsp. But I could not
> find a way
>
> public class BaseActionSupport extends ActionSupport{
>
> //Same as ActionSupport
> private TextProvider Provider; //with setter and getter
>
> public TextProvider getSampleTextProvider() {
>
> TextProviderFactory tpf = new TextProviderFactory();
> if (container != null) {
> container.inject(tpf);
> }
> return tpf.createInstance(getClass(), this);
> }
>
> }
You don't have to do it - ActionSupport class already expose getText() method
> In jsp:
>
> ${provider.text("label.password")} //Error The function text must be used
> with a prefix when a default namespace is not specified
>
> Is it a correct approach?!
I'm not sure if this will ever work -
${provider.text("label.password")} calls function not a property and
JSTL uses special prefix to indicates if expressions is a function
call - ${fn:length(string1)}
I cannot find it now, but action is exposed so you should be able use
${someProperty} or ${action.someProperty} - if this will work, try to
use ${action.text("message.key")}
Regards
--
Ćukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]