I have read about people having problems getting or setting a bean which does not fit the bean specification. In that case the Cart object would also need a setSubTotal(double dbl) method, even if it is not used eg

public class Cart extends HashMap {
   private double subTotal = 400.00;
   public double getSubTotal(){return subTotal;}
   public void setSubTotal(double dbl){subTotal=dbl;}
}


This could be the problem because the bean:write would expect a bean, but the <%...%> is just accessing an object's method.


Also the way to access maps in struts is object(value) eg <bean:write name="cart(abc)"/>

Which is roughly the same as <c:out value="${cart.abc}" />

These should perform the following: cart.get("abc")



Michael Marrotte wrote:

Here's the bean:

public class Cart extends HashMap {
   private double subTotal = 400.00;
   public double getSubTotal(){return subTotal;}
}


Here's the Java:


session.setAttribute("cart", new Cart());


Here's the JSP


<bean:write name="cart" property="subTotal"/> // no output?
<%= ((csp.Cart)session.getAttribute("cart")).getSubTotal() %> // works,
writes 400.0


Here's the problem


<bean:write> isn't producing any output, but

<%= ... %> is...

Any ideas are greatly appreciated.

Thanks,

--Mike M.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






--
Jason Lea



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to