<input type="text" name="localport" value='<%=(client.getLocalport()!=null)?client.getLocalport():"5060"%>'>
client是一个javabean的别名,getLocalport()是client里的一个方法。

解决方案 »

  1.   

    <input type="text" name="localport" value=' <%=(client.getLocalport()!=null)?client.getLocalport():"5060"%>'
    引号不是多了一对
      

  2.   

    <%
    String v = (client.getLocalport()!=null)?client.getLocalport():"5060";
    %>
    <input type="text" name="localport" value="<%=v%>"> 
      

  3.   

    client.getLocalport()结果是什么类型?如果是String类型就没有错,如果是int类型就错了
      

  4.   

    我觉得不多,那是被包含在一对<% %>里的,我在javabean中增加了一些方法,但已经重新编译并重启了tomcat,还是有错误。
    报错:
    org.apache.jasper.JasperException: Unable to compile class for JSP: 
    An error occurred at line: 56 in the jsp file: /config.jsp
    The method getLocalport() is undefined for the type SipClientBean
    53:  </tr>
    54:  <tr>
    55:  <td>Local Port:</td>
    56:  <td><input type="text" name="localPort" value='<%= (client.getLocalport() != null) ? client.getLocalport():"5060"%>'></td>
    57:  </tr>
      

  5.   

    请问是int类型,我该怎么修改才能得到我想要的结果?谢谢。
      

  6.   

    <input type="text" name="localport" value=' <%=(client.getLocalport()!=null)?client.getLocalport():"5060"%>'> 
    client.getLocalport() 是什么类型的? 如果上string的话 这句话没有错啊!
      

  7.   

    <input type="text" name="localport" value=' <%=(client.getLocalport()!=null)?client.getLocalport()+"":"5060"%>'> 
      

  8.   

    我觉得不多,那是被包含在一对 <% %>里的,我在javabean中增加了一些方法,但已经重新编译并重启了tomcat,还是有错误。 
    报错: 
    org.apache.jasper.JasperException: Unable to compile class for JSP: 
    An error occurred at line: 56 in the jsp file: /config.jsp 
    The method getLocalport() is undefined for the type SipClientBean 
    53: </tr> 
    54: <tr> 
    55: <td>Local Port: </td> 
    56: <td> <input type="text" name="localPort" value=' <%= (client.getLocalport() != null) ? client.getLocalport():"5060"%>'> </td> 
    57: </tr> 
      

  9.   

    The method getLocalport() is undefined for the type SipClientBean,SipClientBean类中都没有定义getLocalport这个方法,你怎么能用...
      

  10.   

    我是通过String localport = request.getParameter("port");来讲参数作为实参传进javabean中的一个setLocalport()方法里,但这个方法里的参数类型必须是int型,我该如何修改?
      

  11.   

    如果是int类型,总有个默认的吧,如果默认返回是0,就是
    <input type="text" name="localPort" value=' <%= (client.getLocalport() != 0) ? client.getLocalport():"5060"%>'>
      

  12.   

    to xinyung,是的,但我已经重新编译了那个javabean,而且也重启了tomcat,不知道为什么javabean里增加的方法还不能够被识别。
      

  13.   

    classes下的东西删除,再编译一次
      

  14.   

    还是不行,我又重启了下tomcat
      

  15.   

    用到的javabean叫ClientBean.java,我已将ClientBean.class删掉再编译了CientBean.java.
      

  16.   

    非常抱歉,用到的javabean应该叫SipClientBean.java
      

  17.   

    谢谢大家的帮忙,问题解决了,做事不仔细,一直保存的javabean文件都不是自己改动的javabean文件。