[java ee programming] Re: Help with Homework 4006

2009-03-17 Thread Humberto Barrientos
Person class have got return Name variable. per example public Name
getName() ..
On Tue, Mar 17, 2009 at 4:37 PM, Rodolfo Avila Navarro <
rodolfo.avila.nava...@gmail.com> wrote:

> I initialize in Init.java
>
>
> /**
> * Person
> */
> Person person = new Person ("Rodolfo", "Avila");
> sce.getServletContext().setAttribute("person", person);
>
>
>
> /*-*/
>
> Package (org.apache.taglibs.standard.examples.beans.Person)
>
> public class Person {
>
> //*
> // Instance variables
>
> /** Holds value of property name. */
> public Name name;
>
>
> //*
> // Constructors
>
> public Person() {}
>
> public Person(String firstName,String lastName){
>
> name = new Name();
> name.setFirstName(firstName);
> name.setLastName(lastName);
> System.out.println("Nombre : " + firstName);
> System.out.println("Apellido : " + lastName);
> //name.getName();
> }
> }
>
> // it works well because the outputs are ok
>
>
>
>
> /*-*/
>
> Package (org.apache.taglibs.standard.examples.beans.Person)
>
> 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;
> }
>
> }
>
> /*-*/
>
> response.jsp
>
>
> 
> 
>FirstName and LastName : 
>
>
> 
> 
>
>
> When i run the application this error message appears:
>
>
> 'org.apache.taglibs.standard.examples.beans.Person' does not have 'name'
> property.
>
>
> Some help
>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[java ee programming] Re: Help with Homework 4006

2009-03-17 Thread X. Yin

I think you need to have a getter for your Name class in Person. So
that the JSP can access the name from Person first then get the
first/last name from the name.

like

person.getName().getLastName()

person.getName().getFirstName()

 -xiaohang

On Tue, Mar 17, 2009 at 12:37 PM, Rodolfo Avila Navarro
 wrote:
> I initialize in Init.java
>
>
> /**
> * Person
> */
> Person person = new Person ("Rodolfo", "Avila");
> sce.getServletContext().setAttribute("person", person);
>
>
>
> /*-*/
>
> Package (org.apache.taglibs.standard.examples.beans.Person)
>
> public class Person {
>
>     //*
>     // Instance variables
>
>     /** Holds value of property name. */
>     public Name name;
>
>
>     //*
>     // Constructors
>
>     public Person() {}
>
>     public Person(String firstName,String lastName){
>
>     name = new Name();
>     name.setFirstName(firstName);
>     name.setLastName(lastName);
>     System.out.println("Nombre : " + firstName);
>     System.out.println("Apellido : " + lastName);
>     //name.getName();
>     }
> }
>
> // it works well because the outputs are ok
>
>
>
>
> /*-*/
>
> Package (org.apache.taglibs.standard.examples.beans.Person)
>
> 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;
>     }
>
> }
>
> /*-*/
>
> response.jsp
>
>
> 
>     
>    FirstName and LastName : 
>    
>    
>     
> 
>
>
> When i run the application this error message appears:
>
>
> 'org.apache.taglibs.standard.examples.beans.Person' does not have 'name'
> property.
>
>
> Some help
>
>
> >
>



-- 
Best Regards,
Xiaohang Yin
xiaohang@gmail.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---