WlExop 2017-06-28 11:24 采纳率: 50%
浏览 1754

用ajax从后台传数据到jsp页面时el表达式直接当成字符串输出了

 resp.getWriter().write("<div style=\""+"float: left; width: 20%"+"\">"+
                "<img src=\""+"${ident.createIdent.shopping.pphoto }\""+" width=\""+100+"\" height=\""+100+"\">"
            +"</div>"+
            "<div>"+
                "名称:${ident.createIdent.shopping.pname }<br><br>"+
                "价格:${ident.createIdent.shopping.pprice }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
                "折扣:<c:if test=\""+"${ident.createIdent.shopping.pdiscount<10 && ident.createIdent.shopping.pdiscount>0}\""+"><c:set var=\""+"zk\""+" value=\""+"${ident.createIdent.shopping.pdiscount*0.1}\""+"></c:set> ${ident.createIdent.shopping.pdiscount}折</c:if>"+
                "<c:if test=\""+"${ident.createIdent.shopping.pdiscount>=10 || ident.createIdent.shopping.pdiscount<=0}\""+"><c:set var=\""+"zk\""+" value=\""+"${1}\""+"></c:set>无折扣</c:if>"
                +"<br><br>"+
                "数量:<input value=\""+"${ident.createIdent.cicount }\""+"/>"+ 
                "<input type=\""+"button\""+" value=\""+"增加\""+" name=\""+"zj\""+"/>"+
                "<input type=\""+"button\""+" value=\""+"减少\""+" name=\""+"js\""+"/>"+
                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总计:${ident.createIdent.shopping.pprice}<c:if test=\""+"${zk!=0 }\""+">*${zk}</c:if>*${ident.createIdent.cicount}=<font color=\""+"red\""+" size=\""+"5\""+">${ident.createIdent.shopping.pprice*zk*ident.createIdent.cicount}</font>"+
                "<input name=\""+"acount\""+" value=\""+"${ident.createIdent.shopping.pprice*zk*ident.createIdent.cicount}\""+"/>"+
                "<br><br>"+
            "</div>");
  • 写回答

3条回答 默认 最新

  • show_code 2017-06-28 13:54
    关注

    乱七八糟的,估计是字符窜没拼对,你再检查检查吧

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题