Hello Mayank, That just did the trick! Thanks a lot for your response.
Thank you!!! TS 2009/12/24 Mayank Singh <want2meetmay...@yahoo.co.in> > > > In your page.jsp > > you have written > > *"<html:text property="onlyChild.name"/>"* > > *now you are trying to access "name" field within "onlyChild" object, which > is null or not initialized.* > > To get rid of this problem, you can modify your getter method of > "onlyChild" > field in Father class from > > public Child getOnlyChild() { > return this.onlyChild > } > > to > > public Child getOnlyChild() { > if(this.onlyChild == null) > this.onlyChild = new Child(); //Initialize the object > return this.onlyChild > } > > From next time, make sure that whenever you have to access any property of > an object within JSP, the parent object is initialized. Struts tag library > can only take of uninitialized property if they are of primitive data type > or wrapper classed. For eg. String, Integer, Float, Double etc... > > I hope this helps. > > Thanks. > > On Tue, Dec 22, 2009 at 11:22 PM, Thiago Santana > <thiagoeca...@gmail.com<thiagoecatia%40gmail.com> > >wrote: > > > > > > > > Hello, > > > > My previous use of Struts was on a very very simple application and I was > > able to do well with it. But now I am have a more complex model which I > am > > not being able to get around with as I have to build a html form whose > > property maps to the attribute of an attribute of the ActionForm. My > doubt > > relies on how to access this "sub-attribute" on teh html form? > > > > In case this is not to clear, I have the following, very unreal scenario: > > > > package sample; > > > > import java.util.*; > > import org.apache.actions.*; > > > > public class Father extends ActionForm{ > > > > private String name; > > private Child onlyChild; > > > > //....Getters and setters....// > > } > > > > --------------------------------------------------------- > > > > package sample; > > > > import java.util.*; > > import org.apache.actions.*; > > > > public class Child extends ActionForm{ > > > > private String name; > > private int age; > > > > //...Getters and setters...// > > } > > > > ---------------------------------------------------------- > > > > page.jsp > > > > (...) > > > > <html:form action="fatherAction"> > > Name: <html:text property="name"/><br/> > > <b>Child details</b><br/> > > Only child name: <html:text > > property="onlyChild.name"/><!--????????--><br/> > > Only child age: <html:text > > property="onlyChild.age"/><!----????????????---> > > </html:form> > > > > (...) > > > > ---------------------------------------------------------- > > > > When I try it like the example above I get error as it the > > onlyChild.whatever does not exist, does no map to a known attribute it is > > null.... Please let me know how to achieve that... Your help is much > > appreciated... > > > > Merry Xmas in advance!!! > > > > -- > > Thank you, > > TS > > +55 21 7524-9415 > > > > [Non-text portions of this message have been removed] > > > > > > > > -- > Mayank > > [Non-text portions of this message have been removed] > > __._,_.___ > Reply to sender <?subject=Re:+%5BJava%5D+Guidance+on+Struts+1.3> | Reply > to > group<java_offic...@yahoogroups.com?subject=re:+%5BJava%5D+Guidance+on+Struts+1.3> > Messages in this > topic<http://groups.yahoo.com/group/Java_Official/message/32292;_ylc=X3oDMTM2YmNhZWdiBF9TAzk3MzU5NzE0BGdycElkAzYzMDcxNjIEZ3Jwc3BJZAMxNzA1MDA2OTA1BG1zZ0lkAzMyMjk1BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTI2MjA0MjUxNwR0cGNJZAMzMjI5Mg-->( > 2) > Recent Activity: > > - New > Members<http://groups.yahoo.com/group/Java_Official/members;_ylc=X3oDMTJmMDUwdTduBF9TAzk3MzU5NzE0BGdycElkAzYzMDcxNjIEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzEyNjIwNDI1MTc-?o=6> > 35 > - New > Files<http://groups.yahoo.com/group/Java_Official/files;_ylc=X3oDMTJnaGN2YTU0BF9TAzk3MzU5NzE0BGdycElkAzYzMDcxNjIEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZmaWxlcwRzdGltZQMxMjYyMDQyNTE3> > 2 > > Visit Your > Group<http://groups.yahoo.com/group/Java_Official;_ylc=X3oDMTJlNWlxYnNiBF9TAzk3MzU5NzE0BGdycElkAzYzMDcxNjIEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTI2MjA0MjUxNw--> > Start > a New > Topic<http://groups.yahoo.com/group/Java_Official/post;_ylc=X3oDMTJlNm9lbGs3BF9TAzk3MzU5NzE0BGdycElkAzYzMDcxNjIEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTI2MjA0MjUxNw--> > Visit http://aiaiai.com or http://jgame.org for more groups to join. > Java Official Group is created for the following topics: Java 2 Enterprise > Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, > XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks. > Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY > MARKETPLACE > > Going Green: Your Yahoo! Groups resource for green > living<http://us.ard.yahoo.com/SIG=14kt9nmkb/M=493064.13814333.13821539.13298430/D=groups/S=1705006905:MKP1/Y=YAHOO/EXP=1262049717/L=/B=EqsweEPDhFE-/J=1262042517905605/K=BGMZytxE4EK1CMEgC7551g/A=5922843/R=0/SIG=11ckn2mo6/*http://advision.webevents.yahoo.com/green/> > ------------------------------ > > Going Green: Your Yahoo! Groups resource for green > living<http://us.ard.yahoo.com/SIG=14k7nrsi9/M=493064.13814537.13821737.10835568/D=groups/S=1705006905:MKP1/Y=YAHOO/EXP=1262049717/L=/B=E6sweEPDhFE-/J=1262042517905605/K=BGMZytxE4EK1CMEgC7551g/A=5922843/R=0/SIG=11ckn2mo6/*http://advision.webevents.yahoo.com/green/> > [image: Yahoo! > Groups]<http://groups.yahoo.com/;_ylc=X3oDMTJkbGY2ajhzBF9TAzk3MzU5NzE0BGdycElkAzYzMDcxNjIEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMjYyMDQyNTE3> > Switch to: > Text-Only<java_official-traditio...@yahoogroups.com?subject=change+delivery+format:+Traditional>, > Daily > Digest<java_official-dig...@yahoogroups.com?subject=email+delivery:+Digest>• > Unsubscribe<java_official-unsubscr...@yahoogroups.com?subject=unsubscribe>• > Terms > of Use <http://docs.yahoo.com/info/terms/> > . > > __,_._,___ > -- Thank you, TS +55 21 7524-9415 -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en