Here is a snippet of my controller.xml
*<request-map uri="submit"> <security https="false" auth="false" /> <event type="java" path="org.mindtree.testapp.EmployeeEvents" invoke="createEmployee"/> <event type="java" path="org.mindtree.testapp.EmployeeEvents" invoke="viewEmployee"/> <response name="success" type="view" value="main" /> </request-map> * can i have two events in it? and through Employee Events i am calling viewEmployeeService in a EmployeeServices.java where i am getting values from database and storing them in map. while i am calling from service name from *EmployeeEvents *can i directly call runsync without sending any map.?? Thanks |
Hi Prabhakar,
The scenario you are given is not properly executed because, in this case the second event(viewEmployee) doesn't works for either success or failure of event(createEmployee). Thus to successfully execute this you have to provide response 'type=request' for first event which on success invoke's another requests and executes second event, and on success of it the response goes to specified view. e.g: <request-map uri="submit"> <security https="false" auth="false" /> <event type="java" path="org.mindtree.testapp.EmployeeEvents" invoke="createEmployee"/> <response name="success" type="request" value="submitSecond" /> </request-map> <request-map uri="submitSecond"> <security https="false" auth="false" /> <event type="java" path="org.mindtree.testapp.EmployeeEvents" invoke="viewEmployee"/> <response name="success" type="view" value="main" /> </request-map> Thanks& regards -- Himanil Gupta, Enterprise Software Developer HotWax Media Pvt. Ltd. Indore http://www.hotwaxmedia.com/ On 07/13/2012 05:42 PM, Prabhakar Pandey wrote: > Here is a snippet of my controller.xml > > *<request-map uri="submit"> > <security https="false" auth="false" /> > <event type="java" path="org.mindtree.testapp.EmployeeEvents" > invoke="createEmployee"/> > <event type="java" path="org.mindtree.testapp.EmployeeEvents" > invoke="viewEmployee"/> > <response name="success" type="view" value="main" /> > </request-map> > * > can i have two events in it? and through Employee Events i am calling > viewEmployeeService in a EmployeeServices.java where i am getting values > from database and storing them in map. > while i am calling from service name from *EmployeeEvents *can i directly > call runsync without sending any map.?? > > Thanks > |
In reply to this post by Prabhakar Pandey
hi Prabhakar,
In this scenario , your second event will not get executed because after getting response success(or error) from first event it will not return back to call the second event. For achieving required functionality you can use response type="request-redirect" in your first response e.g <request-map uri="submit"> <security https="false" auth="false" /> <event type="java" path="org.mindtree.testapp.EmployeeEvents" invoke="createEmployee"/> <response name="success" type="request-redirect" value="submitAgain" /> </request-map> <request-map uri="submitAgain"> <security https="false" auth="false" /> <event type="java" path="org.mindtree.testapp.EmployeeEvents" invoke="viewEmployee"/> <response name="success" type="view" value="main" /> </request-map> Thank you & Regards Mayank Sheth HotWax Media Pvt. Ltd. http://www.hotwaxmedia.com/ On 07/13/2012 05:42 PM, Prabhakar Pandey wrote: > Here is a snippet of my controller.xml > > *<request-map uri="submit"> > <security https="false" auth="false" /> > <event type="java" path="org.mindtree.testapp.EmployeeEvents" > invoke="createEmployee"/> > <event type="java" path="org.mindtree.testapp.EmployeeEvents" > invoke="viewEmployee"/> > <response name="success" type="view" value="main" /> > </request-map> > * > can i have two events in it? and through Employee Events i am calling > viewEmployeeService in a EmployeeServices.java where i am getting values > from database and storing them in map. > while i am calling from service name from *EmployeeEvents *can i directly > call runsync without sending any map.?? > > Thanks > |
In reply to this post by Prabhakar Pandey
Prabhakar,
You can't call runSync in this way because it is wrong syntactically, you have to pass map as parameter while calling runSync. Also you can pass empty map as parameter but in this case service will return error : "IN parameter is missing". Regards Mayank Sheth On 07/13/2012 05:42 PM, Prabhakar Pandey wrote: > Here is a snippet of my controller.xml > > *<request-map uri="submit"> > <security https="false" auth="false" /> > <event type="java" path="org.mindtree.testapp.EmployeeEvents" > invoke="createEmployee"/> > <event type="java" path="org.mindtree.testapp.EmployeeEvents" > invoke="viewEmployee"/> > <response name="success" type="view" value="main" /> > </request-map> > * > can i have two events in it? and through Employee Events i am calling > viewEmployeeService in a EmployeeServices.java where i am getting values > from database and storing them in map. > while i am calling from service name from *EmployeeEvents *can i directly > call runsync without sending any map.?? > > Thanks > |
This post was updated on .
Why dont you use "service-groups"
with that you can call a bundle of services, which run all together with just one call.. steps to archieve it: 1. create a service group xml definition file 2. add this file into your ofbiz-component.xml 3. add the group element to your service group def. file (including all invokes you want to have) 4. call this service group out of your controller - request mapping thats it. |
Thanks everyone.
i want to fetch data from a table. so how can i implement it using java event class and java service class i.e first i go to event class and then call the service class so get the data? On Fri, Jul 13, 2012 at 8:49 PM, Robert G. <[hidden email]> wrote: > Why dont you use "service-groups" > > with that you can call a bundle of services, which run all together with > just one call.. > > > > -- > View this message in context: > http://ofbiz.135035.n4.nabble.com/Java-Service-Classes-tp4634814p4634819.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > |
This is really much to describe in detail. this is sth of the base understanding in ofbiz, with that understanding you can do most of the things...
so I please you to read the following: http://www.amazon.de/Apache-Ofbiz-Cookbook-Ruth-Hoffman/dp/1847199186/ref=sr_1_cc_2?s=aps&ie=UTF8&qid=1342433161&sr=1-2-catcorr there are good descriptions like how to's with examples and so on. If you really want to get steps forward with ofbiz, this is a must have for beginners! It is not, cause we dont want to write the details down, its because otherwise you do not get the important base understanding...at the end, you save time with that! Kindly Robert |
In reply to this post by Prabhakar Pandey
there are two different ways depending oh what you trying to do.
when you have data coming from a webpage you want process, use a event or service to process the data. I suggest mini lang since it takes a lot of coding out of the process. when you want to display information you use the groovy to marshal the data then pass it to the FTL to be rendered. PS. if is best if you join the ofbiz mailing and include past conversations so we can get a sense without hunting through the mailing list. Prabhakar Pandey sent the following on 7/15/2012 10:52 PM: > Thanks everyone. > i want to fetch data from a table. > so how can i implement it using java event class and java service class i.e > first i go to event class and then call the service class so get the data? > > On Fri, Jul 13, 2012 at 8:49 PM, Robert G.<[hidden email]> wrote: > >> Why dont you use "service-groups" >> >> with that you can call a bundle of services, which run all together with >> just one call.. >> >> >> >> -- >> View this message in context: >> http://ofbiz.135035.n4.nabble.com/Java-Service-Classes-tp4634814p4634819.html >> Sent from the OFBiz - User mailing list archive at Nabble.com. >> > |
Free forum by Nabble | Edit this page |