Hi Emmanuel,

<jsp:useBean id="person" scope="session"
class="org.apache.taglibs.standard.examples.beans.Person" />

>        <jsp:setProperty name="person" property="*"  />


 What are you trying to do with these lines?
Are you aware that what you're doing on the first line is creating a new
Person bean that has a session scope if there's no bean with "person" as its
id?
And you are setting all of the properties of that Person bean with nothing
on the second line?
I assume this is not what you wanted to do instead you want to access the
Person bean you set in servletContext which I think is called the
application scope. If you want to access that you could have used
${applicationScope.person.name.firstName} and
${applicationScope.person.name.lastName} where applicationScope sets the
server to look in application scope only instead of going thru the other
scopes first.

 <table border="1">
    <c:forEach var="person" items="${persons}">
      <tr>
        <td><c:out value="${person.name.firstName}"/> </td>

>      <td><c:out value="${person.name.lastName}"/> </td>
>   </tr>
>  </c:forEach>

</table>


Where did you set the collection "persons"? Remember that when you use EL in
JSP it does not print null but instead an empty String if it encounters a
null value.


Regards,

Bob
On Wed, Nov 11, 2009 at 9:21 PM, emmanuel <emmanuel.fan...@mindspring.com>wrote:

>
> Help Class,
> Can anyone help with lab 4006?  I don't know why First and Last names were
> not displaying.
>
> I have this codes in Name Class.
>
> package org.apache.taglibs.standard.examples.beans;
>
> 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(String lastName) {
>        this.lastName = lastName;
>    }
> }
>
> ---------------------------------------------------------
> I have this codes in Person Class.
>
> package org.apache.taglibs.standard.examples.beans;
>
> public class Person {
>
>    private Name name;
>
>    public Name getName() {
>        return name;
>    }
>    public void setName(Name name) {
>        this.name = name;
>    }
> }
>
> ---------------------------------------------------------
> I placed this code at the end of Init.
>
>  import org.apache.taglibs.standard.examples.beans.*;
>        Name name = new Name();
>        name.setFirstName("Emmanuel");
>        name.setLastName("Faneye");
>
>        Person person = new Person();
>        person.setName(name);
>
>        sce.getServletContext().setAttribute("person", person);
>
> ---------------------------------------------------------
>
> This code goes to the end of reponse.
>
>  <jsp:useBean id="person" scope="session"
> class="org.apache.taglibs.standard.examples.beans.Person" />
>        <jsp:setProperty name="person" property="*"  />
>        <br>
>        <br>
>
>        <table border="1">
>            <c:forEach var="person" items="${persons}">
>              <tr>
>                <td><c:out value="${person.name.firstName}"/> </td>
>                <td><c:out value="${person.name.lastName}"/> </td>
>              </tr>
>           </c:forEach>
>        </table>
>
>
> Thanks for any 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to