You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Brett G. Palmer" <pb...@qwest.net> on 2001/04/18 07:11:19 UTC
Another bean:iterate question
I've been working on this <bean:iterate ... > problem for some time now. I
finally had to use a scriplet to get it to work. I am trying to get a list
of FieldTypes from a record controller (PrimaryServer below) which implement
an AbstractField object (this may be the entire problem ... let me know if
Abstract objects will cause problems). The controller has a method called
getFieldList which returns an Iterator of these AbstractField objects. I
then want to get the name of each field using the property getFielName().
The following is a snippet of my Jsp page. Tomcat always returns with an
error saying it "can't find bean 'field' in scope null".
<logic:iterate id="field" name="PrimaryServer" property="fieldList"
type="com.iic.dbsync.IntField">
<tr>
<td align="center"> <jsp:getProperty name="PrimaryServer"
property="fieldList"/>
<bean:write name="field" property="fielName"/> </td>
<td> <html:text property="field2" size="100" /></td>
</tr>
</logic:iterate>
Here is the scriplet that I wrote to finally get the results that I wanted.
<% Iterator iter = PrimaryServer.getFieldList();
while( iter.hasNext() ) {
AbstractField field = (AbstractField) iter.next();
String fieldName = field.getFieldName();
%>
<tr>
<td align="center"> <%=fieldName%> </td>
<td> <html:text property="field2" size="100" /></td>
</tr>
<% }
%>
The iterator tag still trips me up from time to time. If anyone has any
suggestions I would appreciate them. I have enjoyed reading the previous
postings concerning the iterator tag.
Thanks again,
Brett
Re: radio buttion checked
Posted by Jean-Noel Ribette <je...@improve.fr>.
<html:radio property="fd" value="aValue"/>
Your form bean must have a property "fd". If the value of this property is equals to "aValue" the button will be
checked.
Jean-Noel
----- Original Message -----
From: Sundaram Ramasamy <su...@percipia.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, April 18, 2001 3:24 PM
Subject: radio buttion checked
> Hello.
>
> How do I define the following radio button using htlm:radio tag. I don't
> find the checked attribute
> In html:radio tag.
>
> <input type="radio" name="fd" value="" checked>
>
> Thank & regards
> sundaram
>
>
Re: radio buttion checked
Posted by Thierry Cools <th...@s1.com>.
This is done by checking the value of your radio tag and the value returned by your getter method.
e.g if you have
<html:radio property='xxx' value="1" />
<html:radio property="xxx" value="2" />
if the getXxx method returns "2" the second radio button will be selected.
Thierry
Thierry Cools
Senior Java Developer
S1 Brussels
Kleine Kloosterstraat, 23
1932 st. Stevens-Woluwe
Belgium
Tel : +32 2 200 43 82
Email : thierry.cools@s1.com
----- Original Message -----
From: Sundaram Ramasamy
To: struts-user@jakarta.apache.org
Sent: Wednesday, April 18, 2001 3:24 PM
Subject: radio buttion checked
Hello.
How do I define the following radio button using htlm:radio tag. I don't
find the checked attribute
In html:radio tag.
<input type="radio" name="fd" value="" checked>
Thank & regards
sundaram
radio buttion checked
Posted by Sundaram Ramasamy <su...@percipia.com>.
Hello.
How do I define the following radio button using htlm:radio tag. I don't
find the checked attribute
In html:radio tag.
<input type="radio" name="fd" value="" checked>
Thank & regards
sundaram
Re: Another bean:iterate question
Posted by Jim Crossley <jc...@ifleet.com>.
I've received that error before when I forgot to include the taglib
directive for the logic library. That would prevent the "field" bean
from being created and result in the error you're seeing.
"Brett G. Palmer" wrote:
>
> I've been working on this <bean:iterate ... > problem for some time now. I
> finally had to use a scriplet to get it to work. I am trying to get a list
> of FieldTypes from a record controller (PrimaryServer below) which implement
> an AbstractField object (this may be the entire problem ... let me know if
> Abstract objects will cause problems). The controller has a method called
> getFieldList which returns an Iterator of these AbstractField objects. I
> then want to get the name of each field using the property getFielName().
> The following is a snippet of my Jsp page. Tomcat always returns with an
> error saying it "can't find bean 'field' in scope null".
>
> <logic:iterate id="field" name="PrimaryServer" property="fieldList"
> type="com.iic.dbsync.IntField">
> <tr>
> <td align="center"> <jsp:getProperty name="PrimaryServer"
> property="fieldList"/>
> <bean:write name="field" property="fielName"/> </td>
> <td> <html:text property="field2" size="100" /></td>
> </tr>
> </logic:iterate>
>
> Here is the scriplet that I wrote to finally get the results that I wanted.
>
> <% Iterator iter = PrimaryServer.getFieldList();
> while( iter.hasNext() ) {
> AbstractField field = (AbstractField) iter.next();
> String fieldName = field.getFieldName();
> %>
> <tr>
> <td align="center"> <%=fieldName%> </td>
> <td> <html:text property="field2" size="100" /></td>
> </tr>
> <% }
> %>
>
> The iterator tag still trips me up from time to time. If anyone has any
> suggestions I would appreciate them. I have enjoyed reading the previous
> postings concerning the iterator tag.
>
> Thanks again,
>
> Brett