Re: Binding selection boxes to beans in cocoon forms?
Jason, No problem putting this solution on the Wiki, except that I do not know how I could possibly edit the wiki. I think we could add 8 lines or so to the following page: http://wiki.apache.org/cocoon/WoodyDatatypeReference?highlight=%28selection-list%29 Also, please have a look at the Binding Framework documentation. Search for setSelectionList on it. Did anybody manage to build a concrete example using that technique? Would you be able to post some more snippets of it? How are you setting the selected value from the list? Best regards, Andre' Cesta --- Jason Johnston [EMAIL PROTECTED] wrote: Andre Cesta wrote: Hi All, After receiving zero help from the list on a question posted 6 days ago, I decided to post myself the solution I found for it: http://geocities.com/aacesta/hibernateandcforms.html The problem is integrating hibernate beans with cocoon forms containing selection lists. There were multiple problems faced with the binding of the selection list and then with the selection of the default value. After searching the list archives, google, and also the cocoon examples I was able to put a solution/consolitated example together (the selection list example on cocoon are with XML not with beans). Perhaps now the experts - that have provided no help at all - could review the example and suggest improvements or better ways of doing it. No need to act indignant, that's not likely to motivate anyone to help you out. Keep in mind everyone here, including the experts, are just volunteering their time. I for one looked at your problem and did not see a solution at first glance, but was unable to take the time right away to dig into it deeper. Nobody was trying to snub you or anything. I put the snippets for the solution on an URL for future use: http://geocities.com/aacesta/hibernateandcforms.html Very nice! Perhaps you could put this page on the Cocoon wiki, that way people would be able to find it more easily? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Andre Cesta, BEng, MSc, SCJP, SCJA http://geocities.com/aacesta ___ Yahoo! Photos NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Binding selection boxes to beans in cocoon forms?
Andre Cesta wrote: Jason, No problem putting this solution on the Wiki, except that I do not know how I could possibly edit the wiki. Just like everyone else-- create an account and start editing. Start at http://wiki.apache.org/cocoon/About I think we could add 8 lines or so to the following page: http://wiki.apache.org/cocoon/WoodyDatatypeReference?highlight=%28selection-list%29 Woody is deprecated so that page probably isn't the best place anymore. I was thinking you could just add the page you created as a new page. Also, please have a look at the Binding Framework documentation. Search for setSelectionList on it. Did anybody manage to build a concrete example using that technique? Would you be able to post some more snippets of it? How are you setting the selected value from the list? I have successfully used that setSelectionList method before, though not from within a binding. You might have seen it already but see the following javadoc page has a clear description of how that method works: http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Field.html#setSelectionList(java.lang.Object,%20java.lang.String,%20java.lang.String) --- Jason Johnston [EMAIL PROTECTED] wrote: Andre Cesta wrote: Hi All, After receiving zero help from the list on a question posted 6 days ago, I decided to post myself the solution I found for it: http://geocities.com/aacesta/hibernateandcforms.html The problem is integrating hibernate beans with cocoon forms containing selection lists. There were multiple problems faced with the binding of the selection list and then with the selection of the default value. After searching the list archives, google, and also the cocoon examples I was able to put a solution/consolitated example together (the selection list example on cocoon are with XML not with beans). Perhaps now the experts - that have provided no help at all - could review the example and suggest improvements or better ways of doing it. No need to act indignant, that's not likely to motivate anyone to help you out. Keep in mind everyone here, including the experts, are just volunteering their time. I for one looked at your problem and did not see a solution at first glance, but was unable to take the time right away to dig into it deeper. Nobody was trying to snub you or anything. I put the snippets for the solution on an URL for future use: http://geocities.com/aacesta/hibernateandcforms.html Very nice! Perhaps you could put this page on the Cocoon wiki, that way people would be able to find it more easily? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Binding selection boxes to beans in cocoon forms?
Hi All, After receiving zero help from the list on a question posted 6 days ago, I decided to post myself the solution I found for it: http://geocities.com/aacesta/hibernateandcforms.html The problem is integrating hibernate beans with cocoon forms containing selection lists. There were multiple problems faced with the binding of the selection list and then with the selection of the default value. After searching the list archives, google, and also the cocoon examples I was able to put a solution/consolitated example together (the selection list example on cocoon are with XML not with beans). Perhaps now the experts - that have provided no help at all - could review the example and suggest improvements or better ways of doing it. I put the snippets for the solution on an URL for future use: http://geocities.com/aacesta/hibernateandcforms.html Andre' ___ Yahoo! Photos NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Binding selection boxes to beans in cocoon forms?
Andre Cesta wrote: Hi All, After receiving zero help from the list on a question posted 6 days ago, I decided to post myself the solution I found for it: http://geocities.com/aacesta/hibernateandcforms.html The problem is integrating hibernate beans with cocoon forms containing selection lists. There were multiple problems faced with the binding of the selection list and then with the selection of the default value. After searching the list archives, google, and also the cocoon examples I was able to put a solution/consolitated example together (the selection list example on cocoon are with XML not with beans). Perhaps now the experts - that have provided no help at all - could review the example and suggest improvements or better ways of doing it. No need to act indignant, that's not likely to motivate anyone to help you out. Keep in mind everyone here, including the experts, are just volunteering their time. I for one looked at your problem and did not see a solution at first glance, but was unable to take the time right away to dig into it deeper. Nobody was trying to snub you or anything. I put the snippets for the solution on an URL for future use: http://geocities.com/aacesta/hibernateandcforms.html Very nice! Perhaps you could put this page on the Cocoon wiki, that way people would be able to find it more easily? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Binding selection boxes to beans in cocoon forms?
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:labelRoom 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.xml8- ... /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:labelRoom type:/fd:label /fd:field /fd:widgets ... --Exception thrown by cocoon8- 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.xml8- ... 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
Re: Binding selection boxes to beans in cocoon forms?
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.xml8- ... /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:labelRoom type:/fd:label /fd:field /fd:widgets ... --Exception thrown by cocoon8- 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.xml8- ... 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]