Bean method names have specific syntax rules (do a google search, and the tutorial speaks to these too). try this for your bean code:
public class Person { private Name name; public Person(String firstName, String lastName) { name = new Name(); name.setFirstName(firstName); name.setLastName(lastName); } } ------------------------------------------------------------------------------------------------------------------------------------------------- *Name.java public class Name { public String firstName; public String lastName; public void setFirstName(String firstName){ this.firstName = firstName; } public void setLastName (String lastName){ this.lastName = lastName; } public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } } --- On Fri, 3/13/09, ketul <ketul....@gmail.com> wrote: > From: ketul <ketul....@gmail.com> > Subject: [java ee programming] Lab-4006:Help needed pls > To: "Java EE (J2EE) Programming with Passion!" > <java-ee-j2ee-programming-with-passion@googlegroups.com> > Date: Friday, March 13, 2009, 4:38 PM > * Can any one check what is wrong in my code > > *I can see the page with "Hello" message and very > small table BUT NOT > printing First Name and Last Name: > ---------------------------------------------------------------------------------------------------------------------------------------- > *Response.java > > <jsp:useBean id="mybean" > scope="session" > class="org.me.hello.NameHandler" /> > <jsp:setProperty name="mybean" > property="*" /> > Hello, <jsp:getProperty name="mybean" > property="name" /> > <br> > <br> > > <%-- Exercise Expression Language --%> > <table border="1"> > > <tr> > <td><c:out > value="${person.name.firstName}"/></td> > <td><c:out > value="${person.name.lastName}"/></td> > </tr> > </table> > > ------------------------------------------------------------------------------------------------------------------------------------------ > *InIt.java > > > private void init(ServletContextEvent sce) { > > Person p1 = new Person("Ketul", > "Patel"); > > > sce.getServletContext().setAttribute("per", p1); > } > > ----------------------------------------------------------------------------------------------------------------------------------------------- > *Person.java > > > public class Person { > > private Name name; > > public Person(String firstName, String lastName) { > name = new Name(); > name.setfirstName(firstName); > name.setlastName(lastName); > } > > } > > ------------------------------------------------------------------------------------------------------------------------------------------------- > *Name.java > > > public class Name { > > public String firstName; > public String lastName; > > public void setfirstName(String firstName){ > this.firstName = firstName; > } > public void setlastName (String lastName){ > this.lastName = lastName; > } > > public String getfirstName(){ > return firstName; > } > > public String getlastName(){ > return lastName; > } > > > } > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---