可否再详细一些呢?setProperty只是方法,很多的类里面都有啊

解决方案 »

  1.   

    随便哪各类,我想用法都是差不多的吧!
    比如说<jsp:useBean setProperty....>
      

  2.   

     <jsp:setProperty name="cart" property="*"/>
    <jsp:getProperty name="cart/>
      

  3.   

    The <jsp:setProperty> element sets the value of one or more properties in a Bean, using the Bean's setter methods. You must declare the Bean with <jsp:useBean> before you set a property value with <jsp:setProperty>. Because <jsp:useBean> and <jsp:setProperty> work together, the Bean instance names they use must match (that is, the value of name in <jsp:setProperty> and the value of id in <jsp:useBean> must be the same). 
      

  4.   

    Examples
    <jsp:useBean id="cart" scope="session" class="session.Carts" /> 
    <jsp:setProperty name="cart" property="*" /> or 
    <jsp:useBean id="checking" scope="session" class="bank.Checking" > 
    <jsp:setProperty name="checking" property="balance" value="0.0" /> 
    </jsp:useBean>