Friday, August 15, 2003

I have a love-hate relationship with confessional debugging. You know, when you go to someone else for help and, in the process of explaining your problem, find the solution yourself. I love it because it solves the problem, and I hate it because I always feel slightly embarassed in front of the other person. I've found a bit of a compromise though: mailing lists, specifically those related to the problem I'm trying to solve. I don't know how many times the act of writing the details of my problem down in my request for help has forced me to see the problem in a different light and craft a solution. I generally decide to reexamine my problem more thoroughly when I remember that the person "on the other end of the line" is going to scrutinize not only my problem, but the efforts I went to to solve it before I came to them.

Wednesday, August 13, 2003

More quickies:

- A few times now I have struggled with the JSTL tags complaining that they can't find a property I'm trying to access in my Struts ActionForm. The <html:> tags find the property with no trouble, so I know it's there. The key was that I was using a DynaForm, where the properties are dynamically defined in the struts-config.xml file, and I had forgotten the ".map." that you need to access properties via JSTL. E.g.:

<c:out value="${}" >

If you leave out the .map., you'll get an exception complaining that there is "No such property in bean".

- The second thing I learned, was not to forget the scope attribute on your Struts action mappings. I had two action mappings, an initMyAction and myAction, both of which used the same form. I was submitting some initial values to the init form, but they weren't showing up in the JSP that the init form redirected to. And I could see in the debug logs that the <html:form> was causing a new instance of my form bean to be instatiated, when it should have already existed. I put debugging statements in the Action execute() method and I could see the value there, so I knew it was getting set. The problem was that I had left out the scope="request" from the <action> mapping for the initAction, but not from the myAction. So myAction was looking for the bean in the request scope and not finding it. (I'm assuming the default value for scope is "session").

Thursday, August 07, 2003

Just a quickie. I just learned that when you use a <html:password> tag, unless you set the attribute redisplay="false", the value a user enters in the field will appear in the source of the page if it is redisplayed because of an error. The document says the default is true to be consistent with the other field tags, but that seems dangerous to me.