• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

No getter method for property

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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(RequestUtils.java:968)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:286)
at org.apache.jsp._test._jspService(_test.java:118)

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

import="com.abc.action.TestBean"

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

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

 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using
<bean efine id="mybean" value="com.abc.action.TestBean" />
is like saying,
String mybean = "com.abc.action.TestBean";

Try using the type attribute instead of the value attribute.
See the documentation for more details.
 
Do Re Mi Fa So La Tiny Ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic