struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Penrose" <Andrew.Penr...@ward.ie>
Subject Type Conversion Issue
Date Mon, 23 Apr 2007 18:00:09 GMT
Hi Guys,

I have an ArrayList of say Car models which we are displaying on a page.
The status field of the model sets the default value of a select
dropdown using a <s:select> tag on the page. When I go to update the
status we can't seem to get type conversion working.....the id of the
collection object returned is always null...and when we try the below
with %{car.id}) it gives us a null error on the setProperty for status.

<s:select list="#{'ok':'ok',
'cancelled':'cancelled','complete':'complete'}"
                                      name="carList(%{car.id}).status"
                                      value="%{status}"/>

Our bean has the following with apprropriate getters and setters:
.
.
@Entity
@Table(name = "tblCar")
public class Car extends BaseObject implements Serializable {

    protected long id=-1; protected String status;.
.
.


Our Action class has a list called carList:

.
.
public class MyCarAction extends BaseAction {

    private List <Car>carList = new ArrayList();

    public List<Car> getCarList() {
        return this.carList;
    } 

   public void setCarList(List<Car> carList) {
        this.carList = carList;
    }

.
.

Our conversion file MyCarAction-conversion.properties contains:

 
KeyProperty_carList=id
Element_carList=CreateIfNull_carList=true

 

Our iterator in jsp page is:

 
<s:iterator value="carList" id="carBean">

                    <tr>
                       <td><s:property value="dateApplied"/></td>
                        <td><s:property value="job.jobTitle"/></td>
                        <td>
                            <s:select list="#{'Submitted':'Submitted',
'Reply Received':'Reply
Received','Interview':'Interview','Closed':'Closed'}"
 
name="carList(%{carBean.id}).status"
                                      value="%{status}"/>
                       </td>
                   </tr>
</s:iterator>

 

Any help appreciated,

                                                            

 

Yours Sincerely,

 

Andrew 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message