All, I have a problem in making ftl display data held in the context. What I am trying is: 1)context.put("customer",customer); in a bsh file 2)in my screens.xml, <screen name="thankyou"> <section> <actions> <script location="component://hotelCalifornia/webapp/hotelCalifornia/WEB-INF/actions/customer.bsh"/> </actions> 3) from my ftl file, Thankyou for booking a room with us ${customer.customerName} I tried printing out the context and it does contain the variable customername. However, the error I get is customer not defined. I have also tried putting my entity Booking in the context and then trying to aceess it through Booking.cusomerName but the same error. Is there something I am missing? ************************************************************************************************************* Another problem I am facing is this: In a request say abc,I m invoking a service which persists an entity say X. In the event of success,I am presenting a view which fetches this entity by primary key and displays it. However, the entity is not being fetched and when I print it out,the result is null. So my question is:at what step is the data persisted and available to be fetched? I hope I have made my questions clear.Thanks everyone in advance ! sangeeta P.s:I got I quick response to my last post and it helped solve my issue.thanks for that too. ============================================================================================================================ Tech Mahindra, formerly Mahindra-British Telecom. Disclaimer: The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if any) are privileged and confidential material of Tech Mahindra and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s). In case you are not the desired addressee, you should delete this message and/or re-direct it to the sender. The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Tech Mahindra. This e-mail message including attachment/(s), if any, is believed to be free of any virus. However, it is the responsibility of the recipient to ensure that it is virus free and Tech Mahindra is not responsible for any loss or damage arising in any way from its use. ============================================================================================================================ _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
What kind of typ is customer?
Is it a GenericValue or HashMap? Maybe you missed something and customer is just a String. In this case you have to write: Thankyou for booking a room with us ${customer} Did you get an exception? Second question: the service you call must return the primarykey to the request, then you can catch this key in you presentation... Kind regards Dimitri Unruh Lynx Consulting Group Johanniskirchplatz 6 D-33615 Bielefeld T: +49 (0) 521 / 52 47 - 408 [hidden email] http://www.lynx.de "Sangeeta Bhatia" <[hidden email]> Sent by: [hidden email] 23.06.2006 15:37 Please respond to ofbiz-user To: <[hidden email]> cc: Subject: [OFBiz] Users - Does FTL pick data from context? All, I have a problem in making ftl display data held in the context. What I am trying is: 1)context.put("customer",customer); in a bsh file 2)in my screens.xml, <screen name="thankyou"> <section> <actions> <script location="component://hotelCalifornia/webapp/hotelCalifornia/WEB-INF/actions/customer.bsh"/> </actions> 3) from my ftl file, Thankyou for booking a room with us ${customer.customerName} I tried printing out the context and it does contain the variable customername. However, the error I get is customer not defined. I have also tried putting my entity Booking in the context and then trying to aceess it through Booking.cusomerName but the same error. Is there something I am missing? ************************************************************************************************************* Another problem I am facing is this: In a request say abc,I m invoking a service which persists an entity say X. In the event of success,I am presenting a view which fetches this entity by primary key and displays it. However, the entity is not being fetched and when I print it out,the result is null. So my question is:at what step is the data persisted and available to be fetched? I hope I have made my questions clear.Thanks everyone in advance ! sangeeta P.s:I got I quick response to my last post and it helped solve my issue.thanks for that too. ============================================================================================================================ Tech Mahindra, formerly Mahindra-British Telecom. Disclaimer: The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if any) are privileged and confidential material of Tech Mahindra and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s). In case you are not the desired addressee, you should delete this message and/or re-direct it to the sender. The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Tech Mahindra. This e-mail message including attachment/(s), if any, is believed to be free of any virus. However, it is the responsibility of the recipient to ensure that it is virus free and Tech Mahindra is not responsible for any loss or damage arising in any way from its use. ============================================================================================================================ _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
In reply to this post by Sangs
Hi,
You are missing one simple thing in first case : When you create the context in the bsh file then in case of entity it is a list(In your case customer is the list). And if you want to fetch the customerName from this list then you should follow these steps : 1) You should iterate this customer list context value through list tag in ftl file :(see below for clarification ) <#list customer as cust> </#list> 2) And in the above list iterate tag "cust" is the Generic Value (or we can say this shows each row from the entity).Now you can display your customerName from this Generic Value.(See Below for clarification) <#list customer as cust> ${cust.CustomerName} </#list> In your case if you want to display your context value(customer list) on the screen where your form values are displaying then just right this ${customer} in the ftl file. I hope this would be helpful to you. Can you explain the second issue in more detail ??(With sample code like the first one) Thanks & Regards Ashish Vijaywargiya |
Free forum by Nabble | Edit this page |