2015-09-10 22 views
1

HTML我们可以选择类别和子类别,如: -如HTML JSP <form>类别和子类别格式不支持

<select> 
    <optgroup label="Swedish Cars"> 
    <option value="volvo">Volvo</option> 
    <option value="saab">Saab</option> 
    </optgroup> 
    <optgroup label="German Cars"> 
    <option value="mercedes">Mercedes</option> 
    <option value="audi">Audi</option> 
    </optgroup> 
</select> 

表示喜欢:

enter image description here

但我不得不在jsp形式使用..我可以做到这一点?

<form:select> 
<form:optgroup label="Swedish Cars"> </form:optgroup> 
</form:select> 

在JSP中它是说, 是一个未知的标签。

回答

1

您需要使用如下:

<form:select multiple="single" path="pathname" id="modulename"> 
    <form:option value="None" label="--Select--" /> 
     <c:forEach var="service" items="${modulename}"> 
     <optgroup label="${service.key}"> 
     <form:options items="${service.value}"/>   
     </optgroup> 
     </c:forEach>   
    </form:select> 

,那么你需要在列表中添加的项目。

+0

好吧...我明白了.. – Salini

0

为什么你在你的jsp文件的标签中有form:?刚刚尝试移除它们:

<select> 
<optgroup label="Swedish Cars"> </optgroup> 
</select> 
+0

在jsp我需要处理 ...有可能吗? – Salini

+0

我不认为你需要,尝试没有'形式:' – Celt