开发者

Problem accesing email property with help of Expression Language/JSTL

In my Servlet:

person.setEmail(eMail);
request.getSession().setAttribute("person", person);

RequestDispatcher rd = req开发者_开发百科uest.getRequestDispatcher("/JSPAddress");
rd.forward(request, response);

My Bean Class:

private String eMail;

public Person(String eMail) {
    setEmail(eMail);
}

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

In my JSPAddress:

<input type="text" size="45" name="email" value='<c:out value="${person.eMail}" />' >

What I want:

  • An email value in textfield, which is set in a Servlet


EL accesses properties by getters, not directly by the field. If your setter is named setEmail() then your getter is likely named getEmail(), so the property name is really email, not eMail.

Thus, this should do

${person.email}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜