看样子楼主是在jsp当中直接用的java代码,那么就可以这样写 <% String num6 = "40"; out.println(Integer.parseInt(num6)); %> 注意:使用Integer.parseInt()。这样就可以把jsp页面中的string直接转化为int类型。