Hello,
I have an application where I encapsulate a specific form tags technology (Spring Form Tags in this case) by JSP 2.0 custom tags.
I have encountered the next problem with the Spring Form Tags 'option' and 'select':
I'm going to describe the components that I use:Code:Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspExce ption: javax.servlet.jsp.JspException: java.lang.IllegalStateException: The 'option' tag can only be used inside a valid 'select' tag. at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779) at org.apache.jsp.WEB_002dINF.jsp.editNumberConfig_jsp._jspService(editNumberConfig_jsp.java :108) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) ... 69 more
I have two files select.tag and option.tag where I encapsulate the select and option Spring Form Tags:
select.tag
option.tagCode:<%@ include file="/WEB-INF/jspf/taglibs.jspf" %> <%@ tag body-content="scriptless" trimDirectiveWhitespaces="true" %> <%@ attribute name="path" required="true"%> <%@ attribute name="label" required="true"%> <%@ attribute name="required" required="false"%> <dt> <springform:label path="${path}"> <c:if test='${required}'><span class="required">*</span></c:if><fmt:message key="${label}" />: </springform:label> </dt> <dd> <springform:select cssStyle="field" path="${path}"> <jsp:doBody /> </springform:select> <div class="error"><springform:errors path="${path}" /></div> </dd>
Code:<%@ include file="/WEB-INF/jspf/taglibs.jspf" %> <%@ tag body-content="empty" trimDirectiveWhitespaces="true" %> <%@ attribute name="label" required="false" %> <%@ attribute name="value" required="true" %> <%@ attribute name="text" required="false" %> <c:if test="${label == null}"> <c:set var="label" value="${value}" /> </c:if> <springform:option label="${label}" value="${value}" />
One the fragments of code where I use that custom tags is this:
Note that the prefix tag 'form' refers to my custom JSP 2.0 tags and the prefix tag 'springform' refers to Spring Form Tags. That is defined in the file taglibs.jspfCode:... <form:select label="tts.voice.gender" path="TTSServerConfig.gender"> <c:forEach items="${genderList}" var="gender"> <form:option value="${gender}" label="tts.voice.gender.${gender}" /> </c:forEach> </form:select> ...
With other spring tags as 'input', 'checkbox' and others I didn't encountered problems.
Does anybody knows how to solve it?
Thanks in advance.


Reply With Quote