Java 如何修复此无法转换错误?
我有这个错误Java 如何修复此无法转换错误?,java,jsp,tomcat,tomcat8,Java,Jsp,Tomcat,Tomcat8,我有这个错误 javax.el.ELException: Cannot convert false of type class java.lang.String to class com.vocabase.objects.dialog.modules.Module at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:553) at org.apache.el.ExpressionFactoryImpl.coerceToType(
javax.el.ELException: Cannot convert false of type class java.lang.String to class com.vocabase.objects.dialog.modules.Module
at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:553)
at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:47)
在这个代码上
<c:forEach items="${param}" var="tmp">
<c:set var="tab" value="${fn:split(tmp.key,'.')}" />
<c:set var="start" value="${tab[0]}" />
<c:set var="type" value="${tab[1]}" />
<c:set var="language" value="${tab[2]}" />
<%String type=(String)pageContext.getAttribute("type");
System.out.println(type);
pageContext.setAttribute("type", type);%>
<log:debug>saving ${tab}</log:debug>
<c:if test="${start=='object'}">
<c:choose>
<c:when test="${param.onglet=='audition'}">
<c:choose>
<c:when test="${empty language}">
<% if("inputTimeout".equals(type)){%>
<!-- inputTimeout -->
<c:set target="${answerManage}" property="inputTimeout" value="${tmp.value}" />
<%}else if("noInput1Management".equals(type)){%>
<!-- noInput1Management -->
<c:set target="${answerManage.noInput1}" property="management" value="${model:getPromptManagement(tmp.value)}" />
<%}else if("noInput2Management".equals(type)){%>
<!-- noInput2Management -->
<c:set target="${answerManage.noInput2}" property="management" value="${model:getPromptManagement(tmp.value)}" />
<%}else if("noInput3Management".equals(type)){%>
<!-- noInput3Management -->
<c:set target="${answerManage.noInput3}" property="management" value="${model:getPromptManagement(tmp.value)}" />
<%}else if("finalNoInputManagement".equals(type)){%>
<!-- finalNoInputManagement -->
<c:set target="${answerManage.finalNoInput}" property="management" value="${model:getPromptManagement(tmp.value)}" />
<%}else if("whatIsNext".equals(type)){%>
<!-- whatIsNextNoInput -->
<c:if test="${!(tmp.value=='empty')}">
<c:set var="direction" value="${tmp.value}" />
<c:set var="whatIsNextNoInput" value='<%=DirectionType.valueOf( pageContext.getAttribute("direction").toString())%>' />
<c:set target="${answerManage}" property="whatIsNextNoInput" value="${whatIsNextNoInput}" />
</c:if>
<%}else if("moduleToCallNoInput".equals(type)){%>
<!-- moduleToCallNoInput -->
<c:set var="whatIsNext" value='<%=request.getParameter("object.whatIsNext")%>' />
<c:choose>
<c:when test="${tmp.value!='empty' && whatIsNext=='moduleCall'}">
<c:set var="tmp" value="${fn:split(tmp.value, '.')}" />
<!-- id.type -->
<c:set var="module" value="${model:getModuleByType(tmp[0],tmp[1])}" />
<c:if test="${!empty module}">
<c:set target="${answerManage}" property="moduleToCallNoInput" value="${module }" />
</c:if>
</c:when>
<c:otherwise>
<c:set target="${answerManage}" property="moduleToCallNoInput" value='<%=null %>' />
</c:otherwise>
</c:choose>
<%}else{%>
<!-- repeatNoInput1,2,3 || repeatChoiceNoInput1,2,3 -->
<c:set target="${answerManage}" property="${type}">
<c:choose>
<c:when test="${tmp.value=='on' }">true</c:when>
<c:otherwise>false</c:otherwise>
</c:choose>
</c:set>
<%}%>
</c:when>...
正在保存${tab}
真的
假的
...
嗯,错误在
<c:choose>
<c:when test="${tmp.value=='on' }">true</c:when>
<c:otherwise>false</c:otherwise>
</c:choose>
真的
假的
我也不知道如何修复它。错误发生在使用Tomcat8.5的Java8上,它是对使用Tomcat6的Java6项目表单的更新。我需要一些想法,因为我尝试了所有可能的方法,但错误就在那里
谢谢,,
Vlad.可能是这样:
model:getModuleByType
需要的是模块而不是字符串。我的建议是,检查此方法的签名并将所有tmp
重命名为更有意义的名称。但是它是从model:getModuleByType
的一部分传递过来的,因此我认为问题不在于此,因为最后一个问题是错误。answerManage
是什么类型的type
?如果它是一个“模块”,那么你就可以了