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:
and here's the corresponding stuff from the model. Nothing strange here.Code:<form:form commandName="configFormModel" target="${target}"> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <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>
The controller overrides processFormSubmission() as follows:Code:private String searchInstanceName = null; public String getSearchInstanceName() { return searchInstanceName; } public void setSearchInstanceName(String searchInstanceName) { this.searchInstanceName = searchInstanceName; }
Any help in shedding some light on this is highly appreciated. Thanks.Code:if (errors.hasErrors()) { BindException newErrors = getErrorsForNewForm(request); newErrors.addAllErrors(errors); return showForm(request, response, newErrors, request.getParameterMap()); } return onSubmit(request, response, command, errors);


Reply With Quote