You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ka...@i2.com on 2002/05/30 13:23:06 UTC

javax.servlet.jsp.JspException: No getter method for property name of bean org.apache.struts.taglib.html.BEAN

Hi All,

i know it sounds pretty basic. But am not sure why the jsp page is unable 
to find the getter for a property.
I have a simple results page which looks like this.

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<!-- I guess i don't have to do this when i use struts . It is a subclass 
of ActionForm class-->
<%@ page import="com.i2.forms.WelForm"%>

<!-- This works. ie when i do a simple lookup on the attribute -->
<%
    WelForm form = (WelForm)request.getAttribute("WelForm");
    System.out.println(form.getName());
    System.out.println( form.getCountry());
%>


<html:html locale="true">
<head>
<title>Results page</title>
<html:base/>
</head>

<html:form action="/checkLogin.do">

   <!-- This works too -->
    <jsp:getProperty name="WelForm" property="name"/>
    <jsp:getProperty name="WelForm" property="country"/> 
 
    <!-- This does NOT work
    <html:text property="name"/>
    <html:text property="country"/> 

</html:form>
</body>
</html:html>

This is what i do in my Action class...
 
        request.setAttribute(mapping.getAttribute(), welForm);
        System.out.println(mapping.getAttribute()) --> prints "WelForm"


Please help.

regards
karthik.

Re: javax.servlet.jsp.JspException: No getter method for property name of beanorg.apache.struts.taglib.html.BEAN

Posted by Dave Derry <dd...@acm.org>.
----- Original Message -----
From: <Ka...@i2.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, May 30, 2002 7:23 AM
Subject: javax.servlet.jsp.JspException: No getter method for property name
of beanorg.apache.struts.taglib.html.BEAN


>
> <html:html locale="true">
> <head>
> <title>Results page</title>
> <html:base/>
> </head>
>
> <html:form action="/checkLogin.do">
>
>    <!-- This works too -->
>     <jsp:getProperty name="WelForm" property="name"/>
>     <jsp:getProperty name="WelForm" property="country"/>
>
>     <!-- This does NOT work
>     <html:text property="name"/>
>     <html:text property="country"/>
>
> </html:form>
> </body>
> </html:html>
>


Do you have a form-bean entry for WelForm in your strus-config.xml, and does
the mapping for action checkLogin reference that form-bean? <action
path="checkLogin"  name="WelForm"  scope="request">

If so, what you have should work. If not, then the html:text doesn't know
where to look for the property, and you will need to add the name attribute:
<html:text  name="WelForm"  property="XXX"/>

Hope this helps,
Dave D


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: javax.servlet.jsp.JspException: No getter method for property name of bean org.apache.struts.taglib.html.BEAN

Posted by Rajesh Kalluri <rk...@manduca.com>.
Karthik you have to mention the handle to the form bean in your html:text
just like you did in your jsp:getProperty.
Also make sure thats the name of the form bean you setup in your struts
config or the one you put in one of your sessions.


look at the snippet below.

Regards
Rajesh Kalluri

<html:form action="/checkLogin.do">

   <!-- This works too -->
    <jsp:getProperty name="WelForm" property="name"/>
    <jsp:getProperty name="WelForm" property="country"/>

    <!-- This does NOT work
    <html:text property="name"/>
    <html:text property="country"/>


 <!-- This should  work---->
    <html:text name="WelForm" property="name"/>
    <html:text name="WelForm" property="country"/>

</html:form>
</body>
</html:html>

-----Original Message-----
From: Karthik_Gurumurthy@i2.com [mailto:Karthik_Gurumurthy@i2.com]
Sent: Thursday, May 30, 2002 7:23 AM
To: struts-user@jakarta.apache.org
Subject: javax.servlet.jsp.JspException: No getter method for property
name of bean org.apache.struts.taglib.html.BEAN


Hi All,

i know it sounds pretty basic. But am not sure why the jsp page is unable
to find the getter for a property.
I have a simple results page which looks like this.

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<!-- I guess i don't have to do this when i use struts . It is a subclass
of ActionForm class-->
<%@ page import="com.i2.forms.WelForm"%>

<!-- This works. ie when i do a simple lookup on the attribute -->
<%
    WelForm form = (WelForm)request.getAttribute("WelForm");
    System.out.println(form.getName());
    System.out.println( form.getCountry());
%>


<html:html locale="true">
<head>
<title>Results page</title>
<html:base/>
</head>

<html:form action="/checkLogin.do">

   <!-- This works too -->
    <jsp:getProperty name="WelForm" property="name"/>
    <jsp:getProperty name="WelForm" property="country"/>

    <!-- This does NOT work
    <html:text property="name"/>
    <html:text property="country"/>

</html:form>
</body>
</html:html>

This is what i do in my Action class...

        request.setAttribute(mapping.getAttribute(), welForm);
        System.out.println(mapping.getAttribute()) --> prints "WelForm"


Please help.

regards
karthik.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>