现在的位置: 首页 > 综合 > 正文

struts中标签的用法

2013年03月01日 ⁄ 综合 ⁄ 共 708字 ⁄ 字号 评论关闭
<logic:messagesPresent>

<logic:messagesPresent> 标签只在要显示特定类型的 Struts 消息时才显示其内容。message 属性定义了消息类型:如果为 true,那么就考虑正常消息,否则就考虑错误消息。在 <logic:messagesPresent> 标签中,<html:message> 标签枚举并显示相应类型的每一个消息。因而在下面 JSP 页中,第一部分显示所有正常应用程序消息,第二部分所有显示错误。

<logic:messagesPresent message="true">
  <p>
    <html:messages id="message" message="true">
      <c:out value="${message}" />
    </html:messages>
  </p>
</logic:messagesPresent>
<logic:messagesPresent>
  <p>
    There was a problem with your request:
  </p>
  <blockquote class="error">
    <html:messages id="error">
      <li><c:out value="${error}" /></li>
    </html:messages>
  </blockquote>
  <c:if test="${not empty requestScope.exception}">

    [...]

  </c:if>
  <p>
    Please correct the problem and try again.
  </p>
</logic:messagesPresent>

抱歉!评论已关闭.