<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> 
头部包含了这2个<c:choose>       <c:when test="<%=product_price%> ==0">              电讯       </c:when>    <c:otherwise>  
              <%=product_price%>       </c:otherwise>  </c:choose>    <%=product_price%>
是输出的变量值  ,上面这段报错  <c:when test="<%=product_price%> ==0">
这句话赋值判断报错 attribute value,我知道应该变量赋值错误了,但不知道这个变量判断怎么写,对jsp不太熟悉,知道的帮下忙吧,这句话的作用的就当 <%=product_price%>
这个值为0时显示  电讯 ,不为 0时正常显示,我知道很简单。JSP标签jstl

解决方案 »

  1.   


    <c:choose>       <c:when test="${row.v_money<10000}">              初学下海       </c:when>       <c:when test="${row.v_money>=10000&&row.v_money<20000}">              身手小试       </c:when>       <c:otherwise>              商业能手       </c:otherwise></c:choose>
    懂了没....
      

  2.   

    你都知道简单,那就百度一下jstl的用法就好了呗不懂的先查API啊 看帮助手册,然后百度 google啊 一般问题就解决了  关于思路方面的在发帖啊 什么的 呵呵  个人建议
      

  3.   

    HTTP Status 500 -   Attribute value product_price%> == 0">   这是报错
      

  4.   

      <c:when test="<%=product_price%> ">
    不知道你product_price哪里来的,如果后台传值到jsp话
      <c:when test="${product_price == 0 } ">
      

  5.   

    <c:when test="${product_price == 0 } ">
      

  6.   

       <c:when test="<%=product_price%> ==0">
    这是什么意思?假设product_price=1,那么   <c:when test="1==0">,编译器就不知道了,把他改成 
    <c:when test="<%=product_price==0>%>">
    试试看行不行。我对jsp标签页不熟,个人看法
      

  7.   

    上面说的方法都不行编译器压根就不认  when 这句话,直接跳到了  <c:otherwise>  后面执行
      

  8.   

    我试过了行
    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
    <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> 
    <%int product_price=3; %>
    <html>
      <head>
      </head>
      <body>
      <c:choose>       <c:when test="<%=product_price ==3%>">              This is my JSP page. <br>       </c:when>    <c:otherwise>  
                  <%=product_price%>       </c:otherwise>  </c:choose>   
      
        
      </body>
    </html>
    是你没理解,还有要学会用debug工具
      

  9.   

    上面这个代码 我放上去试了下  product_price因为已经取到值了,就只放了  
     <c:choose>
     
           <c:when test="<%=product_price ==3%>">
     
                  This is my JSP page. <br>
     
           </c:when>
     
        <c:otherwise>  
                   <%=product_price%>
     
           </c:otherwise>  
     
    </c:choose>   报错Incompatible operand types String and int  不相容的数据类型,如果前面加上 <%int product_price; %>  这行就会报错
      

  10.   

    我这个例子就是证明了<c:whew> ……<c:orherwise>....能用,你那种情况看具体代码好解决,因为你的product_price可能是从servlet等其他地方传过来的,都不知道是什么类型。还有如果前面加上 <%int product_price; %>没有初始化应该默认为0吧,还要考虑会不会跟你从servlet等其他地方传过来的product_price有冲突呢。注意断点,单步调试。