struts 2.0允许在s:复选框的标签中使用HTML

时间:2013-10-11 17:50:10

标签: forms jsp struts2

我有一个复选框,用于同意contenst的条款和条件,并且用户希望标签中链接的条款。我试图做这样的事情:

<s:checkbox name="iagree" fieldValue="true" label="By entering, I acknowledge that I have read, understand, and agree to the 
<a href='/rules.pdf'>Official Rules</a>, <a href='/about-us/terms-of-use/'>Terms of Use</a>, and <a href='/about-us/privacy-policy/'>Privacy Policy</a>."/>

不幸的是,JSP正在逃避我的标记,所以你实际上看到了括号,标签等。我是否可以添加一个属性以确保HTML实际用作HTML?

奇怪的是,我有一个struts无线电组,它允许标记就好了。

1 个答案:

答案 0 :(得分:0)

只需使用HTML <label>标记并放置复选框以及文本和链接。并为simple代码使用<s:checkbox>主题。

<label>
  <s:checkbox name="iagree" fieldValue="true" theme="simple"/>
  By entering, I acknowledge that I have read, understand, and agree to the 
  <a href='/rules.pdf'>Official Rules</a>, 
  <a href='/about-us/terms-of-use/'>Terms of Use</a>, 
  and <a href='/about-us/privacy-policy/'>Privacy Policy</a>.
</label>