You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Johnson, Kaerstin" <kj...@systechnologies.com> on 2005/08/02 17:34:43 UTC

RE: Can u help me...I have a problem related to struts.

Sounds like you probably have a case problem. 
Please make sure that you reference Title with the capital T throughout
the struts, jsp and bean. 

I can see your set method references title with lower case, this is
probably the culprit. 

Hope this helps. 

-----Original Message-----
From: Swapnil Patil [mailto:swapnil123patil@gmail.com] 
Sent: Tuesday, August 02, 2005 11:13 AM
To: Johnson, Kaerstin
Subject: Can u help me...I have a problem related to struts.

Hi Johnson,

I am vary sorry for mailling on your personal email address.I had
posted my problem on the mailing list but till now don't get any
reply. If you have time plz take a look.



      I am new in  Struts framework. I had created simple Form
containging 2
members variables as

Form1
{
 String Title;
 Collection col;
}
I had created getter setter for both the members.


Now in my jsp page
I had coded like <html:form action="/DisplayGraphStep2">
 ( DisplayGraphStep2 is linked with the above Form1.)

Now

if try like <html:text property="col"/> then it works
but i try for  <html:text property="Title"/> I get an exception ;

---- Root Cause -----
javax.servlet.ServletException: No getter method for property Title of
bean org.apache.struts.taglib.html.BEAN
      at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:530)
      at
org.apache.jsp.graphStep1_jsp._jspService(graphStep1_jsp.java:90)
      at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

setTitle(String title) and getTitle() methods are present in Form1 class


mapping is like
<form-bean name="GraphStep1Form"  type="GraphStep1Form"/>
<action path    ="/DisplayGraphStep2"
           type   ="DisplayGraphStep2"
           name =  "GraphStep1Form">
       <forward  name  =       "success"       path
="/graphStep2.jsp"/>

Thanks in Advance.
Swapnil Patil



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can u help me...I have a problem related to struts.

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Swapnil Patil" <sw...@gmail.com>

> I had tried with the variable names like
> String sTitle;
> boolean bTest;
>
> <html:text property="sTitle"/>
> <html:text property="bTest"/>
> and both times I got same type of exception. but supricing it works for
> <html:text property="col"/> ( col is declared as Collection in the Form)

Not surprising at all. :)  The secret is in the JavaBeans specification 
which lays out the rules about how method names are decapitalized to get 
property names (and vice versa).

Download the specification here:
   http://java.sun.com/products/javabeans/docs/spec.html

The easiest thing to do is name your properties with two or more lowercase 
letters prior to the first capital letter.

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can u help me...I have a problem related to struts.

Posted by Jeff Beal <jb...@gmail.com>.
Hopefully by now you've read the aforementioned JavaBeans
specification.  It does say that if the method name has two
consecutive capital letters after get and set, the property name is
not de-capitalized.  So, for your method getSTitle, the property name
should also be STitle.  If the name of your method were getSoTitle,
the property name would be soTitle.

-- Jeff

On 8/2/05, Swapnil Patil <sw...@gmail.com> wrote:
> My code is like this.
> public class GraphStep1Form extends ActionForm
> {
>     String sTitle;
>     boolean bTest;
>     Collection col;
> 
>     public boolean isBTest() {
>         return bTest;
>     }
>     public String getSTitle() {
>         return sTitle;
>     }
>     public void setSTitle(String title) {
>         sTitle = title;
>     }
>     public void setBTest(boolean test) {
>         bTest = test;
>     }
> 
>     public Collection getCol() {
>         return col;
>     }
>     public void setCol(Collection col) {
>         this.col = col;
>     }
> }//end GraphStep1Form
> 
> config.xml
> <form-bean name="GraphStep1Form" type="GraphStep1Form"/>
> 
> <action path    ="/DisplayGraphStep2"
>      type ="DisplayGraphStep2"
>      name = "GraphStep1Form"
>      scope ="request">
>    <forward  name="success" path="/graphStep2.jsp"/>
> </action>
> 
> jsp file
> <%@ taglib uri="/tags/struts-html" prefix="html" %>
> <HTML>
> <BODY>
>         <html:errors/>
>         <html:form action="/DisplayGraphStep2">
>                 Username:<html:text property="col"/>
>                 <HR>
>                 Password:<html:text property="bTest"/></TD>
>                 <HR>
>                 <html:submit/>
>         </html:form>
> </BODY>
> </HTML>
> 
> 
> I am getting Exceptiuon for
> <html:text property="bTest"/> and for
> <html:text property="sTitle"/>
> 
> but not for
> <html:text property="col"/>
> 
> On 8/2/05, Dave Newton <ne...@pingsite.com> wrote:
> > Swapnil Patil wrote:
> >
> > >I had tried with the variable names like
> > >String sTitle;
> > >boolean bTest;
> > >
> > ><html:text property="sTitle"/>
> > ><html:text property="bTest"/>
> > >and both times I got same type of exception. but supricing it works for
> > ><html:text property="col"/> ( col is declared as Collection in the Form)
> > >
> > >
> > You must follow the JavaBean naming conventions. For sTitle what does
> > your getter look like?
> >
> > Dave
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can u help me...I have a problem related to struts.

Posted by Swapnil Patil <sw...@gmail.com>.
My code is like this.
public class GraphStep1Form extends ActionForm
{
    String sTitle;
    boolean bTest;
    Collection col;

    public boolean isBTest() {
        return bTest;
    }
    public String getSTitle() {
        return sTitle;
    }
    public void setSTitle(String title) {
        sTitle = title;
    }
    public void setBTest(boolean test) {
        bTest = test;
    }
    
    public Collection getCol() {
        return col;
    }
    public void setCol(Collection col) {
        this.col = col;
    }
}//end GraphStep1Form 

config.xml
<form-bean name="GraphStep1Form" type="GraphStep1Form"/>

<action	path	="/DisplayGraphStep2"
     type ="DisplayGraphStep2"
     name = "GraphStep1Form"
     scope ="request">
   <forward  name="success" path="/graphStep2.jsp"/>
</action>

jsp file
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<HTML>
<BODY>
	<html:errors/>
	<html:form action="/DisplayGraphStep2">
		Username:<html:text property="col"/>
		<HR>
		Password:<html:text property="bTest"/></TD>
		<HR>
		<html:submit/>
	</html:form>
</BODY>
</HTML>


I am getting Exceptiuon for 
<html:text property="bTest"/> and for 
<html:text property="sTitle"/>

but not for 
<html:text property="col"/>

On 8/2/05, Dave Newton <ne...@pingsite.com> wrote:
> Swapnil Patil wrote:
> 
> >I had tried with the variable names like
> >String sTitle;
> >boolean bTest;
> >
> ><html:text property="sTitle"/>
> ><html:text property="bTest"/>
> >and both times I got same type of exception. but supricing it works for
> ><html:text property="col"/> ( col is declared as Collection in the Form)
> >
> >
> You must follow the JavaBean naming conventions. For sTitle what does
> your getter look like?
> 
> Dave
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can u help me...I have a problem related to struts.

Posted by Dave Newton <ne...@pingsite.com>.
Swapnil Patil wrote:

>I had tried with the variable names like
>String sTitle;
>boolean bTest;
>
><html:text property="sTitle"/>
><html:text property="bTest"/>
>and both times I got same type of exception. but supricing it works for 
><html:text property="col"/> ( col is declared as Collection in the Form)
>  
>
You must follow the JavaBean naming conventions. For sTitle what does 
your getter look like?

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can u help me...I have a problem related to struts.

Posted by Swapnil Patil <sw...@gmail.com>.
I had tried with the variable names like
String sTitle;
boolean bTest;

<html:text property="sTitle"/>
<html:text property="bTest"/>
and both times I got same type of exception. but supricing it works for 
<html:text property="col"/> ( col is declared as Collection in the Form)

---- Root Cause -----
javax.servlet.ServletException: No getter method for property sTitle
of bean org.apache.struts.taglib.html.BEAN
javax.servlet.ServletException: No getter method for property bTest of
bean org.apache.struts.taglib.html.BEAN

On 8/2/05, BHansard@powersystems.rockwell.com
<BH...@powersystems.rockwell.com> wrote:
>  
> 
> I would recommend changing the capital T to a lowercase t. This is standard.
> I have had problems in the past with having uppercase variable names. This
> is due to the reflection that Struts uses to find associated getters and
> setters.
>  "Johnson, Kaerstin" <kj...@systechnologies.com>
>  
>  
>  
>  
>  
>  
>  
> "Johnson, Kaerstin" <kj...@systechnologies.com> 
> 
> 08/02/2005 11:34 AM 
> Please respond to
>  "Struts Users Mailing List" <us...@struts.apache.org> 
> 
>  
> To
>  <us...@struts.apache.org>, "Swapnil Patil" <sw...@gmail.com> 
> 
>  
> cc
>  
> 
>  
> Subject
>  RE: Can u help me...I have a problem related to struts. 
>  
>  
> 
>  Sounds like you probably have a case problem. 
>  Please make sure that you reference Title with the capital T throughout
>  the struts, jsp and bean. 
>  
>  I can see your set method references title with lower case, this is
>  probably the culprit. 
>  
>  Hope this helps. 
>  
>  -----Original Message-----
>  From: Swapnil Patil [mailto:swapnil123patil@gmail.com] 
>  Sent: Tuesday, August 02, 2005 11:13 AM
>  To: Johnson, Kaerstin
>  Subject: Can u help me...I have a problem related to struts.
>  
>  Hi Johnson,
>  
>  I am vary sorry for mailling on your personal email address.I had
>  posted my problem on the mailing list but till now don't get any
>  reply. If you have time plz take a look.
>  
>  
>  
>       I am new in  Struts framework. I had created simple Form
>  containging 2
>  members variables as
>  
>  Form1
>  {
>  String Title;
>  Collection col;
>  }
>  I had created getter setter for both the members.
>  
>  
>  Now in my jsp page
>  I had coded like <html:form action="/DisplayGraphStep2">
>  ( DisplayGraphStep2 is linked with the above Form1.)
>  
>  Now
>  
>  if try like <html:text property="col"/> then it works
>  but i try for  <html:text property="Title"/> I get an exception ;
>  
>  ---- Root Cause -----
>  javax.servlet.ServletException: No getter method for property Title of
>  bean org.apache.struts.taglib.html.BEAN
>       at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
>  tImpl.java:530)
>       at
> org.apache.jsp.graphStep1_jsp._jspService(graphStep1_jsp.java:90)
>       at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
>  
>  setTitle(String title) and getTitle() methods are present in Form1 class
>  
>  
>  mapping is like
>  <form-bean name="GraphStep1Form"  type="GraphStep1Form"/>
>  <action path    ="/DisplayGraphStep2"
>            type   ="DisplayGraphStep2"
>            name =  "GraphStep1Form">
>        <forward  name  =       "success"       path
>  ="/graphStep2.jsp"/>
>  
>  Thanks in Advance.
>  Swapnil Patil
>  
>  
>  
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>  
>  
>  
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Can u help me...I have a problem related to struts.

Posted by BH...@powersystems.rockwell.com.
I would recommend changing the capital T to a lowercase t.  This is
standard.  I have had problems in the past with having uppercase variable
names.  This is due to the reflection that Struts uses to find associated
getters and setters.


                                                                           
             "Johnson,                                                     
             Kaerstin"                                                     
             <kjohnson@systech                                          To 
             nologies.com>             <us...@struts.apache.org>, "Swapnil  
                                       Patil" <sw...@gmail.com>  
             08/02/2005 11:34                                           cc 
             AM                                                            
                                                                   Subject 
                                       RE: Can u help me...I have a        
             Please respond to         problem related to struts.          
               "Struts Users                                               
               Mailing List"                                               
             <user@struts.apac                                             
                  he.org>                                                  
                                                                           
                                                                           





Sounds like you probably have a case problem.
Please make sure that you reference Title with the capital T throughout
the struts, jsp and bean.

I can see your set method references title with lower case, this is
probably the culprit.

Hope this helps.

-----Original Message-----
From: Swapnil Patil [mailto:swapnil123patil@gmail.com]
Sent: Tuesday, August 02, 2005 11:13 AM
To: Johnson, Kaerstin
Subject: Can u help me...I have a problem related to struts.

Hi Johnson,

I am vary sorry for mailling on your personal email address.I had
posted my problem on the mailing list but till now don't get any
reply. If you have time plz take a look.



      I am new in  Struts framework. I had created simple Form
containging 2
members variables as

Form1
{
 String Title;
 Collection col;
}
I had created getter setter for both the members.


Now in my jsp page
I had coded like <html:form action="/DisplayGraphStep2">
 ( DisplayGraphStep2 is linked with the above Form1.)

Now

if try like <html:text property="col"/> then it works
but i try for  <html:text property="Title"/> I get an exception ;

---- Root Cause -----
javax.servlet.ServletException: No getter method for property Title of
bean org.apache.struts.taglib.html.BEAN
      at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:530)
      at
org.apache.jsp.graphStep1_jsp._jspService(graphStep1_jsp.java:90)
      at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

setTitle(String title) and getTitle() methods are present in Form1 class


mapping is like
<form-bean name="GraphStep1Form"  type="GraphStep1Form"/>
<action path    ="/DisplayGraphStep2"
           type   ="DisplayGraphStep2"
           name =  "GraphStep1Form">
       <forward  name  =       "success"       path
="/graphStep2.jsp"/>

Thanks in Advance.
Swapnil Patil



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org