In struts 2 the 

    <s:property value="#pageTitle" />

(is equivalent to...)

    JSTL: ${pageTitle}

I use JSTL version which is more compact.

Can we do the same thing with application messages?! To get text from message 
resources we do as below:

    <s:text name="label.sample" />

Now, is there any JSTL version insteadof `<s:text/>` ? 


----------


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);
    }

}
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?!

PS: In the 
http://notsoyellowstickies.blogspot.com/2011/05/making-struts-2-and-jstl-share-message.html
 mentioned that I can somehow share struts 2 and jstl messages, but I should 
still use `<fmt:message key="sample.label"/>`

 
~Regards,
~~Alireza Fattahi

Reply via email to