Chris Tucker wrote: > > Thanks for spending the time to help with this Hans...apologies if my > explanations of problems can be a little, ahem, obtuse at times. The fact > you're managing to answer my questions when I can't even manage to ask them > properly is quite a testament. :-)
;-) > Basically, your comments on the way setProperty works pretty much clear up > the issue for me: the fact that setProperty will not attempt to set a value > if it is not specified solves the problem. I was unaware of this behaviour, > and assumed that it would nullify the existing value. I presume that if you > do actually want to nullify the existing value you have to do it explicitly > through something like: > <jsp:setProperty name="mybean" property="myprop" value="<%=null%>" /> Correct. > You say that when you explicitly specify a value using a JSP scriptlet, > setProperty does no conversion on the data type. Does this mean that the > scriptlet is not executed according to the normal model, where a <%=%> > translates directly to a response.getOutputStream().print() statement or the > equivalent? Once again, I made the assumption (I'm going to have to stop > making those!) that because of this the result of the expression in the > scriptlet would be cast to a String (and would subsequently be cast back to > the appropriate object by setProperty). Correct again; when you use <%= ... %> as an attribute value, the result is *not* converted to a String, it's used exactly as-is and must match the type of the property. The same is true both for the <jsp:setProperty> value attribute and all attributes of a custom action (that supports request-time attribute values, i.e. JSP expressions). > I finally managed to find a copy of the full JSP 1.2 spec, so I'll try to > use that to find my answers now (and save wasting your time with > already-answered questions). Thanks again, Reading the spec is very educating, but it can sometimes be a bit hard to digest since it's targeted to container implementors. In addition you may want to read a book, and I'm sure you can guess which one I recommend ;-) Hans -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
