Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[Custom Tags] Dynamic Variable Name // Spring MVC

843840May 7 2008
I am having a problem with a tag,
i try to make a dynamic select tag that is reuseable, the problem is that my spring controller generates a model where i can access the list information for a select and that i have to pass this to the dynamic tag, the model could have different name, so it could be ${listitemsa} ${listitemsb} ${listitemsc} and i want to pass this list to my custom tag.

i tried the following, but the problem is that the var is passed as a string and not the list, does anybody know how to do this?
<tag:formfield-selectbox name="listA" path="prototypeForm.selectionA" list="${listitemsa} " />
<tag:formfield-selectbox name="listB" path="prototypeForm.selectionB" list="${listitemsb} " />
<tag:formfield-selectbox name="listC" path="prototypeForm.selectionC" list="${listitemsc} " />	
<%@ tag body-content="scriptless" %>
<%@ attribute name="name" required="true" %>
<%@ attribute name="path" required="true" %>
<%@ attribute name="list" required="false" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<spring:bind path="${path}">
	<c:if test="${status.error}">
		<span class="error">
			<c:forEach items="${status.errorMessages}" var="error">
				<c:out value="${error}"/>
			</c:forEach>
		</span><br />
	</c:if>
	<label for="<c:out value="${status.expression}"/>">${name}: </label>
	<form:select path="${path}">
		<form:option value="-1" label="--Please Select--" />
		<form:options items="${list}" />
	</form:select>
</spring:bind>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2008
Added on May 7 2008
0 comments
355 views