Announcement Announcement Module
No announcement yet.
Empty query string arg causes form field to display a comma Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Empty query string arg causes form field to display a comma

    Hi there. I have a case where a form gets redisplayed after a validation error. The URL contains a query argument that is empty. The field exists in the model as well, and so it should be bound automatically (I'm using the <form:form> JSTL stuff). The effect of the query string coming in empty is that the corresponding form field gets displayed with a comma in it. However, if I hit reload in the browser, it goes away. I'm puzzled.
    Here's the JSP snippet:
    <form:form commandName="configFormModel" target="${target}">
      <table border="0" cellpadding="0" cellspacing="0">
          <tr valign="bottom">
            <td><b>Enter a name for this search</b><br/>
              <form:input path="searchInstanceName" maxlength="128" size="35" /></td>
            <td><form:errors path="searchInstanceName" cssClass="errorBox" /></td>
    and here's the corresponding stuff from the model. Nothing strange here.
      private String searchInstanceName = null;
      public String getSearchInstanceName()
        return searchInstanceName;
      public void setSearchInstanceName(String searchInstanceName)
        this.searchInstanceName = searchInstanceName;
    The controller overrides processFormSubmission() as follows:
        if (errors.hasErrors())
          BindException newErrors = getErrorsForNewForm(request);
          return showForm(request, response, newErrors, request.getParameterMap());
        return onSubmit(request, response, command, errors);
    Any help in shedding some light on this is highly appreciated. Thanks.