Hi,
I think your classes should look like this.

public class Name {
    private String firstname;
    private String lastname;

    public Name() {
        this(null, null);
    }

    public Name(String firstname, String lastname) {
        this.firstname = firstname;
        this.lastname = lastname;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }
}

Following code should add the "person" attribute to servlet context.

Person person = new Person(new Name("Mak", "Pandian"));
sce.getServletContext().setAttribute("person", person);

And finally following code should be showing the first name and the last
name.

<jsp:useBean id="person" scope="application" class="org.me.hello.Person"/>
Hello, <c:out value="${person.name.firstname}"/> <c:out
value="${person.name.lastname}"/>!

-- 
Regards,
Artashes Hovasapyan


On Thu, Apr 9, 2009 at 12:42 PM, mak pandian <kolluranipand...@gmail.com>wrote:

>
> Hello
>   I am doing EL home work Since yesterday.But i didn't yet get output.
> First i want to say what i did till now.
>
> 1..I have  modified the helloweb project from online lab document.
>
> 2.I have created two class named person and name as follows.
>
> public class Name {
>
>     static String firstName="mak";
>    static String lastName="pand";
>
>
>
> }
>
>
>
> public class Person {
>
>
>     Name name;
>     public Person(String X,String Y)
>     {
>         name.firstName=X;
>         name.lastName=Y;
>     }
>
>
>
> }
>
>
>
> 3.I have added this class to servletcontext by Init class as follows...
>
>
>
>  Person person=new Person("mak","Pandian");
>   // sce.getServletContext().setAttribute("person", person);
>
>
>
>
>
> 4. added the code in response.jsp as follows
>
> <td><c:out value="${name.firstName}"/></td>
>
>
>
>
>
> But I did not yet get output......................
>
>
>
> What should i do ..
>
>
>
> Thanking You....
>
>
>
> Regards
> KolluraniPandian A
> (Living in Virtual World)
>
>
> --
> Regards
> KolluraniPandian A
> (Living in Virtual World)
> >
>

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

Reply via email to