Hi,
I'm sorry if I've chosen a wrong topic, or if there has already been some discussion about something similiar in the last days. Anyways, I want to give it a try:
In some of my projects, I'm quite often using something like this:
The hole part is always the same, whereas only the bind path changes.Code:<spring:bind path="person.address"> <input name="<c:out value="${status.expression}"/>" type="text" value="<c:out value="${status.value}"/>" style="width:100%;" <c:choose> <c:when test='${status.errorMessage != ""}'> class="error" />Error: <c:out value="${status.errorMessage}" /> </c:when> <c:otherwise> /> </c:otherwise> </c:choose> </spring:bind>
I'd thought about something like this:
<spring:input path="person.address" />
Dot. I think this would make lots of JSPs easier to read and develop.
Of course, this short tag could be extended to some extra parameters, such as e.g. errorClass="error" (regarding the CSS) or noErrorClass="default' and so on.
Additionally, this is also possible for comboboxes, radiogroups and so on, but I see the biggest benefit on input boxes.
May be some of you like this idea. Please let me know.
If anybody could at least give me a hint where to start with doing something like this (inheriting a java class from Spring's default Taglibrary? No idea, sorry) I'd do it myself and provide a patch, as I'm sure this would be very useful, and not only for myself.
Kind regards,
Simon


Reply With Quote
aram name="path" value="command.person.address"/>