This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes No getter method for property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "No getter method for property" Watch "No getter method for property" New topic

No getter method for property

RajaDelhiwala Babu

Joined: Feb 08, 2005
Posts: 5
Hi :

I am getting following exception when running my struts example:

E SRVE0026E: [Servlet Error]-[No getter method for property lastname of bean mybean]: javax.servlet.jsp.JspException: No getter method for property lastname of bean mybean
at org.apache.struts.util.RequestUtils.lookup(
at org.apache.struts.taglib.bean.WriteTag.doStartTag(
at org.apache.jsp._test._jspService(

my jsp looks like this :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page


<bean efine id="mybean" value="" />
<bean:write name="mybean" property="lastname" />
<html:form action="com/abc/">

I am also writing my bean code too:

public class TestBean {
private String lastname,firstname;
* @return
public String getFirstname() {
return firstname;

* @return
public String getLastname() {
return lastname;

* @param string
public void setFirstname(String string) {
firstname = string;

* @param string
public void setLastname(String string) {
lastname = string;


I am unable to understand why this is happening,even I have checked the case of property lastname,this is exactly what is in the jsp.
please help

Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

<bean efine id="mybean" value="" />
is like saying,
String mybean = "";

Try using the type attribute instead of the value attribute.
See the documentation for more details.

A good workman is known by his tools.
Have you checked out Aspose?
subject: No getter method for property
It's not a secret anymore!