|
|
Monday, January 19, 2004 |
I just spent too long debugging a little problem I was having with the Struts nested tags. With the nested tags, you can define a "root" bean and then access properties off the root with special nested versions of the other Struts tags. This allows you to access properties of beans with syntax like:
<nested:root name="customer"> Name = <nested:write property="name" /> </nested:root>
Which is really cool, especially with some of the more complex tags because you don't have to refer to the parent bean. In theory, this allows you to also nest references to beans contained within the bean with something like:
<nested:root name="customer"> Name = <nested:write property="name" />
<nested:root name="address"> Address Line 1 = <nested:write property="line1" /> Address Line 2 = <nested:write property="line2" /> City = <nested:write property="city" /> </nested:root>
</nested:root>
However, the more you nest the tags within each other, the more flaky things are likely to get. In my recent debugging session, I made the decision that from now on, nested roots should contain at most 1 nested root within them. If you have more than 1 root defined within a root, all the subsequent tags outside the 1st nested root don't work correctly.
As an example, I don't think you should do this:
<nested:root name="customer"> Name = <nested:write property="name" />
<nested:root name="address"> Address Line 1 = <nested:write property="line1" /> Address Line 2 = <nested:write property="line2" /> City = <nested:write property="city" /> </nested:root>
<nested:present name="altContact"> <nested:root name="altContact"> Name = <nested:write property="name"/> </nested:root> </nested:present>
</nested:root>
Because chances are that the tag logic won't determine that altContact is present correctly.
4:37:26 PM
|
|
Because I don't get to do it often enough, I always forget how to get the user id from the servlet container. This is handy if you are letting the container handle the authentication for your application. All you have to do is call request.getUserPrincipal().getName(). This returns the id as a String. Beautiful.
3:07:57 PM
|
|
© Copyright 2004 Tom Pierce.
|
|
|
|
January 2004 |
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
|
|
|
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
Dec Feb |
|
Search
|
Emacs Sources
tsql-indent.el
This is an indentation function for SQL mode. It was written with Transact SQL in mind.
user-add-sql-folding-marks
This is a simple function that adds folding-mode marks to SQL sources. It is quick and dirty, but is fairly useful for me.
remove-line-boundary-in-region
This function removes all the line boundaries in a region. This, in effect, collapses all the lines in the region onto one line.
convert-camel-to-underscore
This function converts all the text that is camel cased in a particular region to underscore separated text.
My Subscriptions
|
|
|