Hello. I'm still working on this... but I don't have any result yet.
this is my code package org.app.name; public class Name { private String firstName; private String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName() { this.lastName = lastName; } } ****************************** package org.app.person; import org.app.name.Name <http://xxx.xxx.name/>; public class Person { Name name; public Name getName() { return name; } public void setName(Name name) { this.name = name; } } ******************************** response.jsp <jsp:useBean id="person" scope="session" class="org.app.person.Person"></jsp:useBean> I don't understand how to add the firstName property of Name class using <jsp:setProperty name="person" property="person.name.firstName" value="Julian"></jsp:setProperty> and then display the content using <c:out></c:out> tags. Any idea. Thank you so much. 2009/2/21 Leonardo de Carvalho <leofdecarva...@gmail.com> > One option is to use the jsp page "response.jsp" to create the object: > > ... > <jsp:useBean id="person" scope="session" class="org.me.hello.Person"/> > <jsp:setProperty name="person" property="name" value="${mybean.name}"/> > ... > > t+... > > 2009/2/21 juliane.osor...@unilibrebog.edu.co <julian.oso...@gmail.com> > > >> Hello everyone. >> >> The problem is that I don't understand what to do in the homework #7 >> at this point: >> *Create (and initialize) a Person object and save it as an attribute >> called person in the ServletContext scope object during application >> initialization. >> >> There is a Init class that implements ServletContextListener. Do I >> have to create and initialize the Person object in the "private void >> init(ServletContextEvent sce)" method? >> >> ********************************************************** >> package xxx.xxx; >> >> public class Name { >> private String firstName; >> private String lastName; >> >> public String getFirstName() { >> return firstName; >> } >> >> public void setFirstName(String firstName) { >> this.firstName = firstName; >> } >> >> public String getLastName() { >> return lastName; >> } >> >> public void setLastName() { >> this.lastName = lastName; >> } >> } >> >> ********************************************* >> package xxx.xxx; >> >> import xxx.xxx.Name; >> >> public class Person { >> Name name; >> } >> >> ********************************************** >> import xxx.xxx.Person; >> public class Init implements ServletContextListener { >> >> // >> ********************************************************************* >> // ServletContextListener methods >> >> // recovers the one context parameter we need >> public void contextInitialized(ServletContextEvent sce) { >> //p("contextInitialized"); >> init(sce); >> } >> >> public void contextDestroyed(ServletContextEvent sce) { >> //p("contextInitialized"); >> } >> >> // >> ********************************************************************* >> // Initializations >> >> private void init(ServletContextEvent sce) { >> Person person = new Person; >> >> ... >> } >> } >> >> >> Thank you so much. >> >> >> > > > -- > > ---------------------------------------------------------------------------------------------------------- > Erros são, no final das contas, fundamentos da verdade. > Se um homem não sabe o que uma coisa é, > já é um avanço do conhecimento saber o que ela não é. > > Carl Jung > > ---------------------------------------------------------------------------------------------------------- > Leonardo de Carvalho > Bacharel em Ciência da Computação - UFV > Tel: 31 8668 4508 > > ---------------------------------------------------------------------------------------------------------- > > > > -- Julian Osorio Amaya Ingeniería de Sistemas. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---