You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by su2 <sh...@pexsupply.com> on 2009/07/24 03:26:18 UTC
Java Class
Hi All,
I have created a new component, it has a form widget, with FirstName,
LastName and Submit Button.
the target of my form is processFirstForm and method is post.
I am able to see the firstname, lastname, submit button but when I fill up
the form and click submit it goes to my desired new screen - OneFormScreen
but its blank.
I have added java handler in controller.xml
My Screen is
***********************************************************************************************
<screen name="OneFormScreen">
<section>
<widgets>
<decorator-screen name="xhtml-decorator">
<decorator-section name="body">
<label text="A Screen with just 1 form."/>
<include-form name="FirstForm"
location="component://calculator/widget/calculator/calcForms.xml"/>
<section>
<condition><not><if-empty field-name="parameters.submit"/></not></condition>
<widgets>
<container><label text="firstName: ${parameters.firstName}"/>
</container>
<container><label text="lastName: ${parameters.lastName}"/>
</container>
<container><label text="combined: ${parameters.combined}"/>
</container>
<container><label text="submit: ${parameters.submit}"/></container>
<container><label text="All the parameters we received:"/>
</container>
<container><label text="${parameters.allParams}"/></container>
</widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
***********************************************************************************************
controller.xml has
***********************************************************************************************
<request-map uri="processFirstForm">
<event type="java" path="org.ofbiz.calculator.calculator.calculatorEvents"
invoke="processFirstForm"/>
<response name="success" type="view" value="OneFormScreen"/>
</request-map>
<view-map name="OneFormScreen" type="screen"
page="component://calculator/widget/calculator/calcScreens.xml#OneFormScreen"/>
***********************************************************************************************
My Java class is
*******************************************************************************************
public class calculatorEvents {
public static String processFirstForm(HttpServletRequest
request,HttpServletResponse response){
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
request.setAttribute("combined", firstName + " " + lastName);
request.setAttribute("allParams", UtilHttp.getParameterMap(request));
request.setAttribute("submit", "Submitted");
return "success";
}
}
*******************************************************************************************
I would really appreciate your help.
Thanks in advance.
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24637295.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by su2 <sh...@pexsupply.com>.
Hi Chirag,
I tried removing (<event type="java"
path="org.ofbiz.calculator.calculator.calculatorEvents"
invoke="processFirstForm"/> ) from controller.xml and
(<condition><not><if-empty
field-name="parameters.submit"/></not></condition>) from calcScreens.xml, it
goes to my desired uri - processFirstForm passing firstname and lastname but
since other attributes are declared in Java class its not showing.
So I think the issue is somewhere in <event> but not sure where and how to
find and resolve that.
Thanks.
Chirag Manocha-2 wrote:
>
> Not sure, but is your java class at right location and its package name
> given properly ? If yes, put a Debug log message before return "success".
>
> Regards
> --
> Chirag Manocha
> HotWax Media Pvt. Ltd.
> Website :- www.hotwaxmedia.com
> Contact :- +91-98263-19099
>
>
>
> su2 wrote:
>> Hi Charles,
>>
>> Yeah, my java is good. but when I remove (<event type="java"
>> path="org.ofbiz.calculator.calculator.calculatorEvents"
>> invoke="processFirstForm"/> ) from controller.xml and
>> (<condition><not><if-empty
>> field-name="parameters.submit"/></not></condition>) from calcScreens.xml,
>> it
>> goes to my desired uri - processFirstForm passing firstname and lastname
>> but
>> since other attributes are declared in Java class its not showing.
>>
>> So I think the issue is somewhere in <event> but not sure where and how
>> to
>> find and resolve that.
>>
>> Thanks.
>>
>>
>>
>> SELC Sales Div wrote:
>>
>>> Hi Shuchi,
>>>
>>> During compiling that Java ... is there any error response?
>>>
>>> - Charles TJ
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: su2 [mailto:shuchi@pexsupply.com]
>>> Sent: 24 Juli 2009 21:30
>>> To: user@ofbiz.apache.org
>>> Subject: Re: Java Class
>>>
>>>
>>>
>>> Hi Awdesh,
>>>
>>> my calcForms.xml
>>>
>>> ****************************************************************************
>>> *
>>> <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>
>>> xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
>>>
>>> <form name="FirstForm" type="single" target="processFirstForm">
>>> <field name="firstName"><text/></field>
>>> <field name="lastName"><text/></field>
>>> <field name="submit"><submit/></field>
>>> </form>
>>> </forms>
>>> ****************************************************************************
>>> *
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24647134.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by Chirag Manocha <ch...@hotwaxmedia.com>.
Not sure, but is your java class at right location and its package name
given properly ? If yes, put a Debug log message before return "success".
Regards
--
Chirag Manocha
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Contact :- +91-98263-19099
su2 wrote:
> Hi Charles,
>
> Yeah, my java is good. but when I remove (<event type="java"
> path="org.ofbiz.calculator.calculator.calculatorEvents"
> invoke="processFirstForm"/> ) from controller.xml and
> (<condition><not><if-empty
> field-name="parameters.submit"/></not></condition>) from calcScreens.xml, it
> goes to my desired uri - processFirstForm passing firstname and lastname but
> since other attributes are declared in Java class its not showing.
>
> So I think the issue is somewhere in <event> but not sure where and how to
> find and resolve that.
>
> Thanks.
>
>
>
> SELC Sales Div wrote:
>
>> Hi Shuchi,
>>
>> During compiling that Java ... is there any error response?
>>
>> - Charles TJ
>>
>>
>>
>> -----Original Message-----
>> From: su2 [mailto:shuchi@pexsupply.com]
>> Sent: 24 Juli 2009 21:30
>> To: user@ofbiz.apache.org
>> Subject: Re: Java Class
>>
>>
>>
>> Hi Awdesh,
>>
>> my calcForms.xml
>>
>> ****************************************************************************
>> *
>> <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>
>> xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
>>
>> <form name="FirstForm" type="single" target="processFirstForm">
>> <field name="firstName"><text/></field>
>> <field name="lastName"><text/></field>
>> <field name="submit"><submit/></field>
>> </form>
>> </forms>
>> ****************************************************************************
>> *
>>
>>
>>
>>
>>
>
>
RE: Java Class
Posted by su2 <sh...@pexsupply.com>.
Hi Charles,
Yeah, my java is good. but when I remove (<event type="java"
path="org.ofbiz.calculator.calculator.calculatorEvents"
invoke="processFirstForm"/> ) from controller.xml and
(<condition><not><if-empty
field-name="parameters.submit"/></not></condition>) from calcScreens.xml, it
goes to my desired uri - processFirstForm passing firstname and lastname but
since other attributes are declared in Java class its not showing.
So I think the issue is somewhere in <event> but not sure where and how to
find and resolve that.
Thanks.
SELC Sales Div wrote:
>
>
> Hi Shuchi,
>
> During compiling that Java ... is there any error response?
>
> - Charles TJ
>
>
>
> -----Original Message-----
> From: su2 [mailto:shuchi@pexsupply.com]
> Sent: 24 Juli 2009 21:30
> To: user@ofbiz.apache.org
> Subject: Re: Java Class
>
>
>
> Hi Awdesh,
>
> my calcForms.xml
>
> ****************************************************************************
> *
> <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
>
> <form name="FirstForm" type="single" target="processFirstForm">
> <field name="firstName"><text/></field>
> <field name="lastName"><text/></field>
> <field name="submit"><submit/></field>
> </form>
> </forms>
> ****************************************************************************
> *
>
>
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24646355.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
RE: Java Class
Posted by SELC Sales Div <se...@bdg.centrin.net.id>.
Hi Shuchi,
During compiling that Java ... is there any error response?
- Charles TJ
-----Original Message-----
From: su2 [mailto:shuchi@pexsupply.com]
Sent: 24 Juli 2009 21:30
To: user@ofbiz.apache.org
Subject: Re: Java Class
Hi Awdesh,
my calcForms.xml
****************************************************************************
*
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
<form name="FirstForm" type="single" target="processFirstForm">
<field name="firstName"><text/></field>
<field name="lastName"><text/></field>
<field name="submit"><submit/></field>
</form>
</forms>
****************************************************************************
*
Re: Java Class
Posted by su2 <sh...@pexsupply.com>.
Hi Awdesh,
my calcForms.xml
*****************************************************************************
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
<form name="FirstForm" type="single" target="processFirstForm">
<field name="firstName"><text/></field>
<field name="lastName"><text/></field>
<field name="submit"><submit/></field>
</form>
</forms>
*****************************************************************************
awdesh parihar wrote:
>
> Paste your form contain here .
> --
> Awdesh Parihar
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24645555.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by su2 <sh...@pexsupply.com>.
I think I am able to print the error and it says
**********************************
The Following Errors Occurred:
Error calling event: org.ofbiz.webapp.event.EventHandlerException: Error
invoking event, the class org.ofbiz.calculator.calculator.calculatorEvents
was not found
**********************************
I have the class calculatorEvents in calculatorEvents.java which resides
in component - calculator > src > org > ofbiz > calculator > calculator >
calculatorEvents.java
my calculatorEvents.java is
**********************************
package org.ofbiz.calculator.calculator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ofbiz.base.util.UtilHttp;
public static String processFirstForm(HttpServletRequest
request,HttpServletResponse response){
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
request.setAttribute("combined", firstName + " " + lastName);
request.setAttribute("allParams", UtilHttp.getParameterMap(request));
request.setAttribute("submit", "Submitted");
return "success";
}
}
**********************************
Thanks.
awdesh parihar wrote:
>
> Paste your form contain here .
> --
> Awdesh Parihar
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24651340.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by BJ Freeman <bj...@free-man.net>.
couple of things to check is that you have the calculator/lib and there
is a Jar in there that has your compile calculator.class.
that the ofbiz-component.xml has path to calculator/lib
su2 sent the following on 7/24/2009 1:21 PM:
> I think I am able to print the error and it says
>
> **********************************
> The Following Errors Occurred:
>
> Error calling event: org.ofbiz.webapp.event.EventHandlerException: Error
> invoking event, the class org.ofbiz.calculator.calculator.calculatorEvents
> was not found
>
> **********************************
> I have the class calculatorEvents in calculatorEvents.java which resides
> in component - calculator > src > org > ofbiz > calculator > calculator >
> calculatorEvents.java
>
> my calculatorEvents.java is
>
> **********************************
> package org.ofbiz.calculator.calculator;
>
>
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import org.ofbiz.base.util.UtilHttp;
>
> public static String processFirstForm(HttpServletRequest
> request,HttpServletResponse response){
> String firstName = request.getParameter("firstName");
> String lastName = request.getParameter("lastName");
> request.setAttribute("combined", firstName + " " + lastName);
> request.setAttribute("allParams", UtilHttp.getParameterMap(request));
> request.setAttribute("submit", "Submitted");
> return "success";
> }
>
> }
> **********************************
>
>
> Thanks.
>
>
>
> awdesh parihar wrote:
>> Paste your form contain here .
>> --
>> Awdesh Parihar
>>
>>
>
--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.
Re: Java Class
Posted by Awdesh Parihar <aw...@gmail.com>.
Paste your form contain here .
--
Awdesh Parihar
Re: Java Class
Posted by su2 <sh...@pexsupply.com>.
Hi Chirag,
I am getting blank screen
Thanks.
Chirag Manocha-2 wrote:
>
> Are you getting the blank screen or blank values for your labels ?
>
> Regards
> --
> Chirag Manocha
> HotWax Media Pvt. Ltd.
> Website :- www.hotwaxmedia.com
> Contact :- +91-98263-19099
>
>
>
> su2 wrote:
>> Hi Adwesh,
>>
>> If I remove (<condition><not><if-empty
>> field-name="parameters.submit"/></not></condition>), on 1st screen
>> (OneForm)
>> below my FirstName, LastName, Submit buttong I get following which are in
>> OneFormScreen but was surrounded by <condition>
>> FirstName:
>> lastName:
>> combined:
>> submit:
>> All the parameters we received:
>>
>> Once I fill the form and click submit button it goes to desired uri -
>> processFirstForm, but still gives me blank screen.
>>
>> Thanks.
>>
>>
>> awdesh parihar wrote:
>>
>>> Just remove condition
>>> (<condition><not><if-empty field-name="parameters.submit"
>>> /></not></condition>
>>> )you are putting on screen and try same process again .
>>>
>>> --
>>> --
>>> Awdesh Parihar
>>> HotWax Media Pvt. Ltd.
>>> Website :- www.hotwaxmedia.com
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24646190.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by Chirag Manocha <ch...@hotwaxmedia.com>.
Are you getting the blank screen or blank values for your labels ?
Regards
--
Chirag Manocha
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Contact :- +91-98263-19099
su2 wrote:
> Hi Adwesh,
>
> If I remove (<condition><not><if-empty
> field-name="parameters.submit"/></not></condition>), on 1st screen (OneForm)
> below my FirstName, LastName, Submit buttong I get following which are in
> OneFormScreen but was surrounded by <condition>
> FirstName:
> lastName:
> combined:
> submit:
> All the parameters we received:
>
> Once I fill the form and click submit button it goes to desired uri -
> processFirstForm, but still gives me blank screen.
>
> Thanks.
>
>
> awdesh parihar wrote:
>
>> Just remove condition
>> (<condition><not><if-empty field-name="parameters.submit"
>> /></not></condition>
>> )you are putting on screen and try same process again .
>>
>> --
>> --
>> Awdesh Parihar
>> HotWax Media Pvt. Ltd.
>> Website :- www.hotwaxmedia.com
>>
>>
>>
>
>
Re: Java Class
Posted by su2 <sh...@pexsupply.com>.
Hi Adwesh,
If I remove (<condition><not><if-empty
field-name="parameters.submit"/></not></condition>), on 1st screen (OneForm)
below my FirstName, LastName, Submit buttong I get following which are in
OneFormScreen but was surrounded by <condition>
FirstName:
lastName:
combined:
submit:
All the parameters we received:
Once I fill the form and click submit button it goes to desired uri -
processFirstForm, but still gives me blank screen.
Thanks.
awdesh parihar wrote:
>
> Just remove condition
> (<condition><not><if-empty field-name="parameters.submit"
> /></not></condition>
> )you are putting on screen and try same process again .
>
> --
> --
> Awdesh Parihar
> HotWax Media Pvt. Ltd.
> Website :- www.hotwaxmedia.com
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24644718.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by Awdesh Parihar <aw...@gmail.com>.
Just remove condition
(<condition><not><if-empty field-name="parameters.submit"
/></not></condition>
)you are putting on screen and try same process again .
--
--
Awdesh Parihar
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Re: Java Class
Posted by su2 <sh...@pexsupply.com>.
Hi Awdesh,
The URI for my OneFormScreen is processFirstForm. Once I submit the form it
does go to the processFirstForm uri but screen is blank.
Thanks.
awdesh parihar wrote:
>
> Are you able to see OneFormScreen fields on your screen after form
> submission ?
>
> --
> --
> Awdesh Parihar
> HotWax Media Pvt. Ltd.
> Website :- www.hotwaxmedia.com
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24644359.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by Awdesh Parihar <aw...@gmail.com>.
Are you able to see OneFormScreen fields on your screen after form
submission ?
--
--
Awdesh Parihar
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Re: Java Class
Posted by su2 <sh...@pexsupply.com>.
Yes, I do
Following is my xhtml-decorator
***************************************************
<screen name="xhtml-decorator">
<section>
<widgets>
<include-screen name="header"/>
<decorator-section-include name="body"/>
<include-screen name="footer"/>
</widgets>
</section>
</screen>
***************************************************
Thanks.
Chirag Manocha-2 wrote:
>
> Do you have xhtml-decorator in your calcScreens.xml ?
>
>
> Regards
> --
> Chirag Manocha
> HotWax Media Pvt. Ltd.
> Website :- www.hotwaxmedia.com
> Contact :- +91-98263-19099
>
>
>
> su2 wrote:
>> Hi All,
>>
>> I have created a new component, it has a form widget, with FirstName,
>> LastName and Submit Button.
>>
>> the target of my form is processFirstForm and method is post.
>>
>> I am able to see the firstname, lastname, submit button but when I fill
>> up
>> the form and click submit it goes to my desired new screen -
>> OneFormScreen
>> but its blank.
>>
>> I have added java handler in controller.xml
>>
>> My Screen is
>> ***********************************************************************************************
>> <screen name="OneFormScreen">
>> <section>
>> <widgets>
>> <decorator-screen name="xhtml-decorator">
>> <decorator-section name="body">
>> <label text="A Screen with just 1 form."/>
>> <include-form name="FirstForm"
>> location="component://calculator/widget/calculator/calcForms.xml"/>
>> <section>
>> <condition><not><if-empty
>> field-name="parameters.submit"/></not></condition>
>> <widgets>
>> <container><label text="firstName: ${parameters.firstName}"/>
>> </container>
>> <container><label text="lastName: ${parameters.lastName}"/>
>> </container>
>> <container><label text="combined: ${parameters.combined}"/>
>> </container>
>> <container><label text="submit: ${parameters.submit}"/></container>
>> <container><label text="All the parameters we received:"/>
>> </container>
>> <container><label text="${parameters.allParams}"/></container>
>> </widgets>
>> </section>
>> </decorator-section>
>> </decorator-screen>
>> </widgets>
>> </section>
>> </screen>
>>
>> ***********************************************************************************************
>>
>> controller.xml has
>> ***********************************************************************************************
>> <request-map uri="processFirstForm">
>> <event type="java"
>> path="org.ofbiz.calculator.calculator.calculatorEvents"
>> invoke="processFirstForm"/>
>> <response name="success" type="view" value="OneFormScreen"/>
>> </request-map>
>>
>> <view-map name="OneFormScreen" type="screen"
>> page="component://calculator/widget/calculator/calcScreens.xml#OneFormScreen"/>
>> ***********************************************************************************************
>> My Java class is
>>
>> *******************************************************************************************
>> public class calculatorEvents {
>> public static String processFirstForm(HttpServletRequest
>> request,HttpServletResponse response){
>> String firstName = request.getParameter("firstName");
>> String lastName = request.getParameter("lastName");
>> request.setAttribute("combined", firstName + " " + lastName);
>> request.setAttribute("allParams", UtilHttp.getParameterMap(request));
>> request.setAttribute("submit", "Submitted");
>> return "success";
>> }
>>
>> }
>> *******************************************************************************************
>>
>> I would really appreciate your help.
>>
>> Thanks in advance.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Java-Class-tp24637295p24643093.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
Re: Java Class
Posted by Chirag Manocha <ch...@hotwaxmedia.com>.
Do you have xhtml-decorator in your calcScreens.xml ?
Regards
--
Chirag Manocha
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Contact :- +91-98263-19099
su2 wrote:
> Hi All,
>
> I have created a new component, it has a form widget, with FirstName,
> LastName and Submit Button.
>
> the target of my form is processFirstForm and method is post.
>
> I am able to see the firstname, lastname, submit button but when I fill up
> the form and click submit it goes to my desired new screen - OneFormScreen
> but its blank.
>
> I have added java handler in controller.xml
>
> My Screen is
> ***********************************************************************************************
> <screen name="OneFormScreen">
> <section>
> <widgets>
> <decorator-screen name="xhtml-decorator">
> <decorator-section name="body">
> <label text="A Screen with just 1 form."/>
> <include-form name="FirstForm"
> location="component://calculator/widget/calculator/calcForms.xml"/>
> <section>
> <condition><not><if-empty field-name="parameters.submit"/></not></condition>
> <widgets>
> <container><label text="firstName: ${parameters.firstName}"/>
> </container>
> <container><label text="lastName: ${parameters.lastName}"/>
> </container>
> <container><label text="combined: ${parameters.combined}"/>
> </container>
> <container><label text="submit: ${parameters.submit}"/></container>
> <container><label text="All the parameters we received:"/>
> </container>
> <container><label text="${parameters.allParams}"/></container>
> </widgets>
> </section>
> </decorator-section>
> </decorator-screen>
> </widgets>
> </section>
> </screen>
>
> ***********************************************************************************************
>
> controller.xml has
> ***********************************************************************************************
> <request-map uri="processFirstForm">
> <event type="java" path="org.ofbiz.calculator.calculator.calculatorEvents"
> invoke="processFirstForm"/>
> <response name="success" type="view" value="OneFormScreen"/>
> </request-map>
>
> <view-map name="OneFormScreen" type="screen"
> page="component://calculator/widget/calculator/calcScreens.xml#OneFormScreen"/>
> ***********************************************************************************************
> My Java class is
>
> *******************************************************************************************
> public class calculatorEvents {
> public static String processFirstForm(HttpServletRequest
> request,HttpServletResponse response){
> String firstName = request.getParameter("firstName");
> String lastName = request.getParameter("lastName");
> request.setAttribute("combined", firstName + " " + lastName);
> request.setAttribute("allParams", UtilHttp.getParameterMap(request));
> request.setAttribute("submit", "Submitted");
> return "success";
> }
>
> }
> *******************************************************************************************
>
> I would really appreciate your help.
>
> Thanks in advance.
>
>