title: Struts 2 Access messages with JSTL instead of s:text
body: <p>In struts 2 the </p>
  
  <pre><code>&lt;s:property value="#pageTitle" /&gt;
  </code></pre>
  
  <p>(is equivalent to...)</p>
  
  <pre><code>JSTL: ${pageTitle}
  </code></pre>
  
  <p>I use JSTL version which is more compact.</p>
  
  <p>Can we do the same thing with application messages?! To get text from message resources we do as below:</p>
  
  <pre><code>&lt;s:text name="label.sample" /&gt;
  </code></pre>
  
  <p>Now, is there any JSTL version insteadof <code>&lt;s:text/&gt;</code> ? </p>
  
  <hr>
  
  <p>Meanwhile, I tried to find a way to pass textprovider to jsp. But I could not find a way</p>
  
  <pre><code>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);
    }
  
  }
  </code></pre>
  
  <p>In jsp:</p>
  
  <pre><code>${provider.text("label.password")} //Error The function text must be used with a prefix when a default namespace is not specified
  </code></pre>
  
  <p>Is it a correct approach?!</p>
  
  <p>PS: In the <a href="http://notsoyellowstickies.blogspot.com/2011/05/making-struts-2-and-jstl-share-message.html" rel="nofollow">http://notsoyellowstickies.blogspot.com/2011/05/making-struts-2-and-jstl-share-message.html</a> mentioned that I can somehow share struts 2 and jstl messages, but I should still use <code>&lt;fmt:message key="sample.label"/&gt;</code></p>