tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benin Technologies <benintechnolog...@yahoo.fr>
Subject Re: jsp:getProperty not working
Date Sat, 26 Jan 2013 01:18:11 GMT
thanks for your reply

below my EmployeeBean source code

package org.company.beans;

public class EmployeeBean {
     private int id;
     private String    firstName,
                             lastName,
                             email,
                             department;

     public EmployeeBean(int id) {
         this.id = id;
         firstName = "";
         lastName = "";
         email = "";
         department = "";
     }

     public EmployeeBean() {
         this(0);
     }

     public int getId() {
         return id;
     }

     public void setFirstName(String firstName) {
         this.firstName = firstName;
     }
     public String getFirstName() {
         return firstName;
     }

     public void setLastName(String lastName) {
         this.lastName = lastName;
     }
     public String getLastName() {
         return lastName;
     }

     public void setEmail(String email) {
         this.email = email;
     }
     public String getEmail() {
         return email;
     }

     public void setDepartment(String department) {
         this.department = department;
     }
     public String getDepartment() {
         return department;
     }
}

Le 26/01/2013 02:10, Christopher Schultz a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> To whom it may concern,
>
> On 1/25/13 6:56 PM, Benin Technologies wrote:
>> I'm new to Tomcat/JSP
>>
>> I have a JSP page that instantiates a bean, then it access the
>> bean through a scriptlet, it works fine. But when I replace the
>> scriptlet by a<jsp:getProperty.. tag, it doesn't work
>>
>> Take my code below :<%= employee.getFirstName() %>  IS WORKING, it
>> displays the employee's firstname<jsp:getProperty name="employee"
>> property="firstName" />   IS NOT WORKING, displays nothing
>>
>> any idea why ?
> Can you give us the interface for EmployeeBean? Perhaps "firstName"
> isn't a proper "Java Beans" "property" and so it can't be properly
> detected, while EmployeeBean.getFirstName works just fine.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEAREIAAYFAlEDLRsACgkQ9CaO5/Lv0PC8awCfTPG1cu31z0RwYeolkR+TbHy6
> /TQAniNRX2HjsPZhHyZ3EcH+2zjHHeBF
> =FOIU
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message