Arron, was this in some documentation that I failed to read.  If so, could
you please point me to it.  I will try this at home tonight.

Thanks.
-AP_

-----Original Message-----
From: Arron Bates [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 3:37 PM
To: Struts Users Mailing List
Subject: Re: Is there a better way to write this code?


You have three options on starting the nested tags.

nested:form - extends html:form
html:form - naturally
nested:root - this is the "formless" option for starting off. It requires
only a "name" attribute which has to match the name of a bean which is in
"scope". This can be done by defining a bean in the struts-config.xml and
have it put in session scope, or you can use the <jsp:useBean/> tag and set
the name of the nested:root tag to the name of the bean in this jap:useBean
tag.

One other thing...

<nested:iterate id="profile" name="profileHeaders" property="profiles">
</nested:iterate>

...there's no need to set the "name" property here. It will be ignored by
the nested tags anyway, as they must rely on the founded name set by the
parent tags.


Arron.


Alex Paransky wrote:

>Some background:
>
>I am using Struts 1.0.1.  The nested tags were obtained from
>http://www.keyboardmonkey.com/struts.  I could not find a reference manual
>for the nested tags, but looking at the .TDL it appears as they were
>intended to be a 1-to-1 mapping with struts.  So I simply replaced
><logic:iterate ... with <nested:iterate ... (where logic references the
>struts-logic.tld and nested references the nested-tags.tld).  I even
removed
>the code in the tag, so it looked like this:
>
><nested:iterate id="profile" name="profileHeaders" property="profiles">
></nested:iterate>
>
>In the examples on the www.keyboardmonkey.com/struts site, all the tags
were
>used inside of a form.  I don't have a form, perhaps that's why I was
>getting a null pointer exception.  I am new with STRUTS so I do not know
why
>this is happening and I have not had a chance to dig into the source code
>yet.
>
>Thanks.
>-AP_
>
>-----Original Message-----
>From: Arron Bates [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, January 15, 2002 10:30 PM
>To: Struts Users Mailing List
>Subject: Re: Is there a better way to write this code?
>
>
>For one, I recommend getting your properties into getter/setter
>methodology. Simply so you can use the wealth that is the Struts tagging
>system (as it's (the bean spec Struts runs against for it's model
>components) kind of what it's all about).
>
>By "'raw' String" do you mean the object's "toString()" method?... Any
>property that yields and object to be written out will have it's
>"toString()" method called to write it to the output.
>
>I'm also curious about your "null pointer" issue with the nested
>extension (for some reason :).
>Can I get a hold of the bean and JSP you were trying to run it with?...
>
>Arron.
>
>
>Alex Paransky wrote:
>
>>I am pretty new with struts and wrote the following .JSP code.  Is there a
>>better way to write this?  I could not find a tag in STRUTS to let me just
>>get the property from the object.  My object does not have get/set
methods,
>>so I had to resort to using <%= tag.  Is there a tag in STRUTS that would
>>just access the "raw" String attribute of the object instead of calling
>>get/set?
>>
>>I also tried using the keyboardmonkey nested library, but kept getting
>>NullPointerExceptions when nested:iterate would execute
>>
>><jsp:useBean id="profileHeaders"
>>class="com.myprofiles.client.web.bean.MemberProfileHeadersBean" />
>><logic:iterate id="profile" name="profileHeaders" property="profiles"
>>type="com.myprofiles.service.common.ProfileHeaderValue">
>> <%=profile.name%>
>> <%=profile.description%>
>></logic:iterate>
>>
>>Thanks.
>>
>>
>>-AP_
>>www: http://www.alexparansky.com
>>
>>
>>--
>>To unsubscribe, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>>For additional commands, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>



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


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

Reply via email to