我在使用ognl表达时到一个roomType的对象
我怎么样将roomType里面的一个属性值打印现来呢
就是在alert("")中该怎么写呢?

解决方案 »

  1.   

    <td>
    <input type="button" value="订购"
    onClick="javascript:alert('${roomType.hotelId}' })" />严重: Servlet.service() for servlet jsp threw exception
    java.lang.NumberFormatException: For input string: "hotelId"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)之前也也试过,可是报这个错
      

  2.   

     是不是因为那个hotelId的属性值是int类型号的原因呢?
      

  3.   

    是Int类型的原因,改成String吧
      

  4.   

    大哥,刚测试了,不是int类型的关系,我传一个String类型号的属性,也会报同样的错误,
      

  5.   

    这个太明显了。用的struts2.x号..类型转换的问题呀..> 75% 的可能性是因为你提交过  非  整形的 数  如 "abc"  到actionName.HoteId中去..很显然。。在发生类型转换时就会有numberFormateExcepton!
      

  6.   

    javascript:alert('${roomType.hotelId}')
    把‘’去掉
      

  7.   

    不是啦,我也不知道是什么原因,但去掉那个roomType就成了!~~很奇怪的....感谢大家的关注啊!!!