Discussions

Web tier: servlets, JSP, Web frameworks: Struts validator message

  1. Struts validator message (1 messages)

    I am using the Validator framework for my Struts 1.2.7 app. The application has a login page(Login.jsp) and after a successful login the user is taken to a selection page (SelectAR.jsp). There is one dropdown on the selection page for which a selection is required to be made. The validation works fine but somehow the validation error header message (under logic:messagesPresent) shows up even when SelectAR.jsp is first loaded (no validation errors).

    Here is my jsp -

    <%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@taglib uri="/WEB-INF/app.tld" prefix="app"%>
     
    <html:html>
    <head>
    <link href="<html:rewrite page="/css/argenerator.css" />" rel="stylesheet" type="text/css">
    <title>AR# Generator - Generate AR#</title>
    </head>
    <body topmargin="0">
     
    <html:img page="/img/banner.jpg" /><br>
    <font size="2">Welcome, <bean:write name="user" property="firstName" />.
     
    <br><br><br><br>
     
    <logic:messagesPresent>
    <bean:message key="errors.validation.header"/> (***this message***)
    <html:messages id="error">
    <bean:write name="error"/><br>
    </html:messages>
    </logic:messagesPresent>
     
    <table width="790" cellspacing="0" cellpadding="0">
     
    <tr><td> </td></tr>
     
    <html:form action="generateAR.do" method="post">
     
    <tr><td align="center">
    <h3>Generate AR# for
    <html:select property="region" size="1">
    <html:option value="">--Select One--</html:option>
    <html:optionsCollection name="regions" value="region" label="regionName"/>
    </html:select>
    </h3><br>
    </td></tr>
    <tr><td align="center">
    <html:submit><bean:message key="button.generate" /></html:submit>
    <html:link page="/logout.do" styleClass="coolButton">Exit</html:link>
    </td></tr>
    </html:form>
    <%@include file="Contact.jsp"%>
     
    </table>
    </body>
    </html:html>



    Why is it entering the logic:messagesPresent loop when there are no errors generated when the page first loads?
  2. Struts validator message[ Go to top ]

    글설리