Jsp Struts 2使用JSTL而不是s:text访问消息
在struts 2中Jsp Struts 2使用JSTL而不是s:text访问消息,jsp,struts2,jstl,Jsp,Struts2,Jstl,在struts 2中 <s:property value="#pageTitle" /> 我使用更紧凑的JSTL版本 我们能对应用程序消息做同样的事情吗?!要从消息资源中获取文本,请执行以下操作: <s:text name="label.sample" /> 在jsp中: ${provider.text("label.password")} //Error The function text must be used with a prefix when a defa
<s:property value="#pageTitle" />
我使用更紧凑的JSTL版本
我们能对应用程序消息做同样的事情吗?!要从消息资源中获取文本,请执行以下操作:
<s:text name="label.sample" />
在jsp中:
${provider.text("label.password")} //Error The function text must be used with a prefix when a default namespace is not specified
这是正确的方法吗
PS:在前面提到的示例中,我可以以某种方式共享struts 2和jstl消息,但是我仍然应该使用
操作对象是公开的,可以使用它的方法:
${action.getText('sample')}
这是JSTL方法调用,您需要JSTL2.2(例如:Tomcat7)
请参阅:
(您的操作必须扩展ActionSupport,才能在上面使用)
${provider.text("label.password")} //Error The function text must be used with a prefix when a default namespace is not specified
${action.getText('sample')}