You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thibaut <la...@ifrance.com> on 2005/12/30 11:00:49 UTC

dropdown

Hi

I try to print a dropdown but i make a mistake. I don't know where is 
the mistake :

In the action :
"
            ArrayList arrayTmp = this.getPartnerListFromDataBase(request);
            request.setAttribute("partnerslist", arrayTmp);
"

Where :
"
    private ArrayList getPartnerListFromDataBase(HttpServletRequest 
request) throws SQLException {
        DataSource dataSource = getDataSource(request);
        Connection connection = dataSource.getConnection();
        Statement statement = connection.createStatement();
        ArrayList jobboardList = new ArrayList();
        String sql = "SELECT id, name FROM partner ORDER BY name ";
        ResultSet rs = statement.executeQuery(sql);
        while(rs.next())
        {
            jobboardList.add(new LabelValueBean(rs.getString("name"), 
Integer.toString(rs.getInt("id"))));
        }
        rs.close();
        return jobboardList;
    }

"

In the Jsp :
"
        <html:select property="product_id_name">
            <html:options collection="partnerslist" property="value" 
labelProperty="label" />
        </html:select>
"

There is the following error message :
"
1javax.servlet.ServletException: No getter method available for property 
product_id_name for bean under name org.apache.struts.taglib.html.BEAN

"

Any idea ?

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


Re: dropdown

Posted by Thibaut <la...@ifrance.com>.
Thank you for your solution (it work with the right Bean) and your advise !

Raghu Kanchustambham a écrit :

>The error means that your action form does not have a getter method for the
>described property.
>If you make sure you have the required property in the actionform and try
>it, it should work fine. Post the code of action form and
>struts-config.xmlif you still cant solve it.
>
>Just a thought: Why is your getPartnerListFromDatabase function taking
>request object as a parameter. This means that you are coupling your front
>tier with data-tier, which may not be a good practice.
>
>Regards,
>Raghu
>
>
>On 12/30/05, Thibaut <la...@ifrance.com> wrote:
>  
>
>>Hi
>>
>>I try to print a dropdown but i make a mistake. I don't know where is
>>the mistake :
>>
>>In the action :
>>"
>>           ArrayList arrayTmp = this.getPartnerListFromDataBase(request);
>>           request.setAttribute("partnerslist", arrayTmp);
>>"
>>
>>Where :
>>"
>>   private ArrayList getPartnerListFromDataBase(HttpServletRequest
>>request) throws SQLException {
>>       DataSource dataSource = getDataSource(request);
>>       Connection connection = dataSource.getConnection();
>>       Statement statement = connection.createStatement();
>>       ArrayList jobboardList = new ArrayList();
>>       String sql = "SELECT id, name FROM partner ORDER BY name ";
>>       ResultSet rs = statement.executeQuery(sql);
>>       while(rs.next())
>>       {
>>           jobboardList.add(new LabelValueBean(rs.getString("name"),
>>Integer.toString(rs.getInt("id"))));
>>       }
>>       rs.close();
>>       return jobboardList;
>>   }
>>
>>"
>>
>>In the Jsp :
>>"
>>       <html:select property="product_id_name">
>>           <html:options collection="partnerslist" property="value"
>>labelProperty="label" />
>>       </html:select>
>>"
>>
>>There is the following error message :
>>"
>>1javax.servlet.ServletException: No getter method available for property
>>product_id_name for bean under name org.apache.struts.taglib.html.BEAN
>>
>>"
>>    
>>



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


Re: dropdown

Posted by Raghu Kanchustambham <kr...@gmail.com>.
The error means that your action form does not have a getter method for the
described property.
If you make sure you have the required property in the actionform and try
it, it should work fine. Post the code of action form and
struts-config.xmlif you still cant solve it.

Just a thought: Why is your getPartnerListFromDatabase function taking
request object as a parameter. This means that you are coupling your front
tier with data-tier, which may not be a good practice.

Regards,
Raghu


On 12/30/05, Thibaut <la...@ifrance.com> wrote:
>
> Hi
>
> I try to print a dropdown but i make a mistake. I don't know where is
> the mistake :
>
> In the action :
> "
>            ArrayList arrayTmp = this.getPartnerListFromDataBase(request);
>            request.setAttribute("partnerslist", arrayTmp);
> "
>
> Where :
> "
>    private ArrayList getPartnerListFromDataBase(HttpServletRequest
> request) throws SQLException {
>        DataSource dataSource = getDataSource(request);
>        Connection connection = dataSource.getConnection();
>        Statement statement = connection.createStatement();
>        ArrayList jobboardList = new ArrayList();
>        String sql = "SELECT id, name FROM partner ORDER BY name ";
>        ResultSet rs = statement.executeQuery(sql);
>        while(rs.next())
>        {
>            jobboardList.add(new LabelValueBean(rs.getString("name"),
> Integer.toString(rs.getInt("id"))));
>        }
>        rs.close();
>        return jobboardList;
>    }
>
> "
>
> In the Jsp :
> "
>        <html:select property="product_id_name">
>            <html:options collection="partnerslist" property="value"
> labelProperty="label" />
>        </html:select>
> "
>
> There is the following error message :
> "
> 1javax.servlet.ServletException: No getter method available for property
> product_id_name for bean under name org.apache.struts.taglib.html.BEAN
>
> "
>
> Any idea ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>