【问题标题】:Why the jsp apply struts2 always display attribute id invalid for tag url according to TLD?为什么 jsp apply struts2 总是根据 TLD 显示标签 url 的属性 id 无效?
【发布时间】:2021-12-24 15:04:30
【问题描述】:
<s:url id = "indexEN" namespace="/" action = "locale" >
  <s:param name = "request_locale" >en</s:param>
</s:url>
    
<s:url var = "indexES" namespace="/" action = "locale" >
  <s:param name = "request_locale" >es</s:param>
</s:url>
        
<s:a href="%{indexEN}" >English</s:a>
      
<s:a href="%{indexES}" >Spanish</s:a>
      
<s:a href="%{indexFR}" >France</s:a>

请告诉我这个问题的解决方案。谢谢。

【问题讨论】:

标签: jsp struts2 tags jsp-tags tld


【解决方案1】:

解决方案是不要使用&lt;s:url&gt; 标签上不存在的属性。

根据the documentation

注意:id 属性在 Struts 2.1.x 中已被弃用,并且已被 var 属性取代。

【讨论】:

  • 感谢您的回复。但是对于使用 id 的某些 struts 2.1 元素,它仍然可用吗?喜欢表单标签?
  • @Dannyme 它在支持它的标签上可用。标签文档列出了每个标签可用的属性。
猜你喜欢
  • 2014-06-23
  • 1970-01-01
  • 1970-01-01
  • 2014-08-30
  • 1970-01-01
  • 2018-04-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多