Hi,

Managed to solve one of the problems so that the selection list now shows, but 
it shows empty. 
Still debugging why it shows empty when there is DB data loaded on the bean to 
display.

To get the selection list to show:

Hibernate required the method: 
> public void setRoomType(RoomType roomType) {
as shown below.

But for Cocoon I had to create the following "overriden" method
otherwise Cocoon would keep throwing:
> > An Error Occurred
> > Incorrect value type for "data.roomType" (expected class java.lang.Long, 
> > got class
> > br.com.hotelman.datatypes.RoomType).

//"overriden" method created for cocoon binding
public void setRoomTypeId(Long id) {
}

Also created the corresponding getter, 
and then changed the following:

    <fd:field id="roomTypeId" required="true">
      <fd:datatype base="long"/>
      <fd:selection-list type="flow-jxpath" list-path="roomTypes" 
label-path="description"
value-path="id" />
      <fd:label>Room type:</fd:label>
    </fd:field>

To use roomTypeId (instead of roomType).  And also the

  <fb:value id="roomTypeId" path="roomTypeId"/>

And

   <ft:widget-label id="roomTypeId"/>
   <ft:widget id="roomTypeId"/>

Still working on why the selection list displays empty.

Kind regards, ANdre'


--- Andre Cesta <[EMAIL PROTECTED]> wrote:

> 
> Can anybody answer this?  Perhaps send me an email with
> working selection box <-> bean binding classes/pipeline/forms 
> example?
> 
> --- Andre Cesta <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> > 
> > I wonder if you can help me bind selection boxes to beans.
> > (other properties on this very same form are binding just fine)
> > 
> > Code snippets and exception for my attempt are shown below.
> > I've searched the list archives and web without luck for solutions.  The 
> > cocoon samples (car,
> > country selectors are for XML binding and did not help much on the bean 
> > binding side).
> > --------------------------------8<---------------------
> > Software: a study project on the area of hotel rooms management,
> > where room type is (luxe, standard, etc).
> > --------------------------------8<---------------------
> > Cocoon version: 2.1.7
> > --Bean Room.java (also questions posed on comments-----
> > public class Room ...
> > ....
> > public Collection getRoomTypes() throws ... {
> > //returns a LinkedList by the way.
> > }
> > 
> > public void setRoomType(RoomType roomType) {
> > //Should I also provide a overriden version with Long argument
> > //to set the room type for binding reasons?
> > ...
> > }
> > 
> > public RoomType getRoomType() {
> > ...
> > }
> > --room_model.xml----------------8<---------------------
> > ...
> >     </fd:field>
> >     <fd:field id="roomType" required="true">
> >       <fd:datatype base="long"/>
> >       <fd:selection-list type="flow-jxpath" list-path="roomTypes" 
> > label-path="description"
> > value-path="id" />
> >       <fd:label>Room type:</fd:label>
> >     </fd:field>
> >   </fd:widgets>
> > ...
> > --Exception thrown by cocoon--------8<---------------------
> > An Error Occurred
> > Incorrect value type for "data.roomType" (expected class java.lang.Long, 
> > got class
> > br.com.hotelman.datatypes.RoomType).
> > 
> > org.apache.avalon.framework.CascadingRuntimeException:
> > "resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 184: 
> > uncaught JavaScript
> > exception: at room (file:/C:/cocoon-2.1.7/build/webapp/forms2/flow/room.js, 
> > Line 28) at
> > (resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 184):
> > java.lang.RuntimeException: Incorrect value type for "data.roomType" 
> > (expected class
> > java.lang.Long, got class br.com.hotelman.datatypes.RoomType).
> > 
> > cause: java.lang.RuntimeException: Incorrect value type for "data.roomType" 
> > (expected class
> > java.lang.Long, got class br.com.hotelman.datatypes.RoomType).
> > ---Room.js (flow)---------------8<---------------------
> > function room(form) {
> > var id = cocoon.request.getParameter("id");
> > var room = null;
> > room = Packages.br.com.hotelman.datatypes.Room.findById(id);
> > form.load(room);
> > form.showForm("room-display-pipeline");
> > form.save(room);
> > cocoon.sendPage("room-success-pipeline", { "room": room });
> > }
> > --Pipeline-----------------------8<---------------------
> >      <map:match pattern="room.flow*">
> >        <map:call function="handleForm">
> >          <map:parameter name="function" value="room"/>
> >          <map:parameter name="form-definition" 
> > value="forms/room_model.xml"/>
> >          <map:parameter name="bindingURI" value="forms/room_bind_bean.xml"/>
> >        </map:call>
> >      </map:match>
> > --Template room_template.xml----8<---------------------
> > ...
> >       <br/>
> >       <ft:widget-label id="roomType"/>
> >       <ft:widget id="roomType"/>
> >       <br/>
> > ...
> >       <input type="submit"/>
> > ...
> > 
> > ---room_bind_bean.xml-----------8<---------------------
> > ....
> >   <fb:value id="roomType" path="roomType"/>
> >   <fb:value id="lastInspected" path="lastInspected"/>
> > </fb:context>
> > --------------------------------8<---------------------
> > 
> > Feel free to package your working selection box form files and
> > bean and send to [EMAIL PROTECTED] so I can use as example.
> > 
> > Kind regards, Andre
> > 
> > 
> >             
> > ___________________________________________________________ 
> > NEW Yahoo! Cars - sell your car and browse thousands of new and used cars 
> > online!
> > http://uk.cars.yahoo.com/
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
>       
>       
>               
> ___________________________________________________________ 
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail
> http://uk.messenger.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



                
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]