struts中标签的用法

来源:互联网 发布:手机打电话软件大全 编辑:程序博客网 时间:2024/04/30 14:56
<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>
原创粉丝点击