<p>42: Encountered illegal body of tag "c:set" tag, given its attributes.</p>

来源:互联网 发布:安卓c语言编辑器 编辑:程序博客网 时间:2024/06/07 02:29

<c:set>标签使用错误!!!

如题,使用c:set标签时遇到的问题,找了很多资料,最后还是google靠谱点...英语的,我就翻译了下。

c:set标签定义了value值时不能再有body,比如:

<c:set var="pid" scope="page" value="$('#projectName option:selected').val()">  <input /></c:set>
此时因为有定义value属性了,再加input标签,c:set就会报错。原文如下:

The answer of @BalusC is not totally correct. You ARE allowed to have contents in a<c:set>-tag. You are however, not allowed, to have contents in a <c:set>-tag when it already contains the attribute value="". (Which makes sense, as the JSP interpreter does not know what to set when both are present)。