struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "SanJ.SANJAY" <girish...@gmail.com>
Subject Re: Struts 1 new bean in form.
Date Mon, 05 Oct 2009 16:19:52 GMT



I am setting this new bena in form like this:

private NewBean omg= new NewBean ();

 public NewBean getOmg() {
               return omg;
        }


        public void setOmg(NewBean omg) {
                this.omg= omg;
        }

Now I have the instance of bean (omg) in my form.

So to call the properties inside omg, I call in jsp like this

<html:text tabindex="2" property="omg.alocation" />

for which i get server error saying no getter method for the bean 



Paweł Wielgus wrote:
> 
> Hi,
> where are You setting this bean into form?
> Try < bean:write name="myForm" property="omg" />
> in jsp, it might be null.
> 
> Best greetings,
> Paweł Wielgus.
> 
> 
> 2009/10/5 SanJ.SANJAY <girish.sh@gmail.com>:
>>
>> Hello,
>>
>>       I am using Struts 1. I am having some issue with creating a new
>> bean
>> inside the form.
>>
>> I have JSP with its form. Now I need to add a feature in my same JSP
>> page.
>> With this feature will come lots of new fields in JSP. So I thought
>> instead
>> of writing the fields and getter/setters in the same form, I will create
>> a
>> new bean where I will define all these new fields and getters/setters and
>> then I will instantiate that bean in my form and read those fields in
>> JSP.
>> But JSP is not able to read thos fields. The part of code is below.
>>
>> JSP:
>> <table >
>>
>> <tr>
>>                <td>OSP:</td>
>>        <td >
>> <html:text onchange="adjustCalcs()" property="omg.alocation" />
>>        </td>
>> </tr>
>> </table>
>>
>> This si only one field, but similarly there are set of other fields which
>> I
>> have not mentioned.
>>
>> I have a new bean with getters/setters for these new set of fields and I
>> instantiate that bean in my form like this:
>>
>>  private NewBean omg= new NewBean ();
>>
>>    public NewBean getOmg() {
>>                return omg;
>>        }
>>
>>
>>        public void setOmg(NewBean omg) {
>>                this.omg= omg;
>>        }
>>
>> NewBean.java :
>>
>> private String                          alocation = "";
>>        public String getAlocation() {
>>                return alocationOSP;
>>        }
>>
>>        public void setAlocation(String alocationOSP) {
>>                this.alocationOSP = alocationOSP;
>>        }
>> Any pointers what could be the issue here?
>>
>> The error message I am getting is:
>> No getter method found for this bean omg.alocation
>> --
>> View this message in context:
>> http://www.nabble.com/Struts-1-new-bean-in-form.-tp25753281p25753281.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-1-new-bean-in-form.-tp25753281p25753802.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message