Results 1 to 2 of 2

Thread: JSP 2.0 Custom Tags and Spring Form Tags integration problem

  1. #1
    Join Date
    Sep 2005
    Posts
    4

    Default JSP 2.0 Custom Tags and Spring Form Tags integration problem

    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':

    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'm going to describe the components that I use:


    I have two files select.tag and option.tag where I encapsulate the select and option Spring Form Tags:

    select.tag
    Code:
    <%@ 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>
    option.tag
    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:
    Code:
    ...
    <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>
    ...
    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.jspf

    With other spring tags as 'input', 'checkbox' and others I didn't encountered problems.


    Does anybody knows how to solve it?

    Thanks in advance.

  2. #2
    Join Date
    Apr 2010
    Posts
    23

    Default

    Hi,

    I have the same problem, did you find a solution?

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •