0

我有这样的代码,

<c:if test="${total gt "+"<%=assignedValue%>"+"}">
<p>Your total value is greater than the assignedValue</p>
</c:if>

并且“addignedValue”是从java返回的,

<%
      Calculate cal = new Calulate();
      double assignedValue = Double.parseDouble(cal.getAssignedValue());%>

但是我无法在标签内检查...

任何帮助将不胜感激。谢谢你...

4

1 回答 1

0

您必须从脚本变量创建一个作用域变量。而不是使用

<%
  Calculate cal = new Calulate();
  double assignedValue = Double.parseDouble(cal.getAssignedValue());%>

利用

<%
   Calculate cal = new Calulate();
   pageContext.setAttribute("assignedValue", cal.getAssignedValue());
%> 

<c:if test="${total gt assignedValue}">
    <p>Your total value is greater than the assignedValue</p>
</c:if>
于 2012-12-06T17:21:02.667 回答