Hello Friends,
I was trying to retrieve the session value using following code in Java Method. But it gives me error -"session" can not be resolved. ------------------------------------------------------------- String fromDate = session.getAttribute("fromDate"); ------------------------------------------------------------- Am I missing something? Thank you for the help in advance. Su- |
May be using this can help :
HttpSession session = ((HttpServletRequest) request).getSession(); 2009/10/6 su2 <[hidden email]> > > Hello Friends, > > I was trying to retrieve the session value using following code in Java > Method. But it gives me error -"session" can not be resolved. > > ------------------------------------------------------------- > String fromDate = session.getAttribute("fromDate"); > ------------------------------------------------------------- > > Am I missing something? > > Thank you for the help in advance. > > Su- > > -- > View this message in context: > http://www.nabble.com/How-to-get-session-variable-value-in-Java-Method--tp25774516p25774516.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > > |
Hi Pattrick,
I tried your suggestion, and it gives error- "request" cannot be resolved. I am not sure what I am missing. Thank you. Su-
|
In reply to this post by su2
You haven't provided enough information. Where in the program flow is
the Java method? What are you trying to retrieve? What are you trying to achieve? -Adrian su2 wrote: > Hello Friends, > > I was trying to retrieve the session value using following code in Java > Method. But it gives me error -"session" can not be resolved. > > ------------------------------------------------------------- > String fromDate = session.getAttribute("fromDate"); > ------------------------------------------------------------- > > Am I missing something? > > Thank you for the help in advance. > > Su- > |
Hi Adrian,
I have a screen which has bsh file in <actions> and FormWidget in <widgets> tag. I am capturing fromDate and thruDate in Session in .bsh file. Now from FormWidget I am calling Java Methods for the data manipulation. For the data manipulation I need to have access to fromDate and thruDate selected by the user. So here in Java method I am trying to access session variables. I hope it helps in understanding my scenario. Thank you. Su-
|
Why not keep that information in the context? Trying to access session
information in the presentation layer breaks the MVC boundaries. -Adrian su2 wrote: > Hi Adrian, > > I have a screen which has bsh file in <actions> and FormWidget in <widgets> > tag. I am capturing fromDate and thruDate in Session in .bsh file. > > Now from FormWidget I am calling Java Methods for the data manipulation. For > the data manipulation I need to have access to fromDate and thruDate > selected by the user. > > So here in Java method I am trying to access session variables. > > I hope it helps in understanding my scenario. > > Thank you. > Su- > > Adrian Crum wrote: >> You haven't provided enough information. Where in the program flow is >> the Java method? What are you trying to retrieve? What are you trying to >> achieve? >> >> -Adrian >> >> su2 wrote: >>> Hello Friends, >>> >>> I was trying to retrieve the session value using following code in Java >>> Method. But it gives me error -"session" can not be resolved. >>> >>> ------------------------------------------------------------- >>> String fromDate = session.getAttribute("fromDate"); >>> ------------------------------------------------------------- >>> >>> Am I missing something? >>> >>> Thank you for the help in advance. >>> >>> Su- >>> >> > |
Sorry, I was not able to understand - keep the information in the context. Can you please explain in detail.
I really appreciate your help. Thank you. Su-
|
In the screen xml:
<actions> <set field="fromDate" from-field"parameters.fromDate"/> <set field="thruDate" from-field"parameters.thruDate"/> </actions> In the form xml: <actions> <!-- Do something with fromDate and thruDate --> ... </actions> -Adrian su2 wrote: > Sorry, I was not able to understand - keep the information in the context. > Can you please explain in detail. > > I really appreciate your help. > > Thank you. > Su- > > > Adrian Crum wrote: >> Why not keep that information in the context? Trying to access session >> information in the presentation layer breaks the MVC boundaries. >> >> -Adrian >> >> su2 wrote: >>> Hi Adrian, >>> >>> I have a screen which has bsh file in <actions> and FormWidget in >>> <widgets> >>> tag. I am capturing fromDate and thruDate in Session in .bsh file. >>> >>> Now from FormWidget I am calling Java Methods for the data manipulation. >>> For >>> the data manipulation I need to have access to fromDate and thruDate >>> selected by the user. >>> >>> So here in Java method I am trying to access session variables. >>> >>> I hope it helps in understanding my scenario. >>> >>> Thank you. >>> Su- >>> >>> Adrian Crum wrote: >>>> You haven't provided enough information. Where in the program flow is >>>> the Java method? What are you trying to retrieve? What are you trying to >>>> achieve? >>>> >>>> -Adrian >>>> >>>> su2 wrote: >>>>> Hello Friends, >>>>> >>>>> I was trying to retrieve the session value using following code in Java >>>>> Method. But it gives me error -"session" can not be resolved. >>>>> >>>>> ------------------------------------------------------------- >>>>> String fromDate = session.getAttribute("fromDate"); >>>>> ------------------------------------------------------------- >>>>> >>>>> Am I missing something? >>>>> >>>>> Thank you for the help in advance. >>>>> >>>>> Su- >>>>> >> > |
Hi Adrian,
How can I access fromDate and thruDate in Form xml? I tried using fromDate but did not work. Thanks for your help. Su-
|
You need to include some code. I can't answer if I don't know what
you're doing. -Adrian su2 wrote: > Hi Adrian, > > How can I access fromDate and thruDate in Form xml? I tried using fromDate > but did not work. > > Thanks for your help. > Su- > > > > Adrian Crum wrote: >> In the screen xml: >> >> <actions> >> <set field="fromDate" from-field"parameters.fromDate"/> >> <set field="thruDate" from-field"parameters.thruDate"/> >> </actions> >> >> In the form xml: >> >> <actions> >> <!-- Do something with fromDate and thruDate --> >> ... >> </actions> >> >> -Adrian >> >> su2 wrote: >>> Sorry, I was not able to understand - keep the information in the >>> context. >>> Can you please explain in detail. >>> >>> I really appreciate your help. >>> >>> Thank you. >>> Su- >>> >>> >>> Adrian Crum wrote: >>>> Why not keep that information in the context? Trying to access session >>>> information in the presentation layer breaks the MVC boundaries. >>>> >>>> -Adrian >>>> >>>> su2 wrote: >>>>> Hi Adrian, >>>>> >>>>> I have a screen which has bsh file in <actions> and FormWidget in >>>>> <widgets> >>>>> tag. I am capturing fromDate and thruDate in Session in .bsh file. >>>>> >>>>> Now from FormWidget I am calling Java Methods for the data >>>>> manipulation. >>>>> For >>>>> the data manipulation I need to have access to fromDate and thruDate >>>>> selected by the user. >>>>> >>>>> So here in Java method I am trying to access session variables. >>>>> >>>>> I hope it helps in understanding my scenario. >>>>> >>>>> Thank you. >>>>> Su- >>>>> >>>>> Adrian Crum wrote: >>>>>> You haven't provided enough information. Where in the program flow is >>>>>> the Java method? What are you trying to retrieve? What are you trying >>>>>> to >>>>>> achieve? >>>>>> >>>>>> -Adrian >>>>>> >>>>>> su2 wrote: >>>>>>> Hello Friends, >>>>>>> >>>>>>> I was trying to retrieve the session value using following code in >>>>>>> Java >>>>>>> Method. But it gives me error -"session" can not be resolved. >>>>>>> >>>>>>> ------------------------------------------------------------- >>>>>>> String fromDate = session.getAttribute("fromDate"); >>>>>>> ------------------------------------------------------------- >>>>>>> >>>>>>> Am I missing something? >>>>>>> >>>>>>> Thank you for the help in advance. >>>>>>> >>>>>>> Su- >>>>>>> >> > |
I followed your suggestion and in screen I have following code.
<actions> <set field="fromDate" from-field"parameters.fromDate"/> <set field="thruDate" from-field"parameters.thruDate"/> </actions> Now I want to print the user selected fromDate and thruDate in my Form. Thank you. Su-
|
Use a display field.
-Adrian su2 wrote: > I followed your suggestion and in screen I have following code. > > <actions> > <set field="fromDate" from-field"parameters.fromDate"/> > <set field="thruDate" from-field"parameters.thruDate"/> > </actions> > > Now I want to print the user selected fromDate and thruDate in my Form. > > Thank you. > Su- > > > Adrian Crum wrote: >> You need to include some code. I can't answer if I don't know what >> you're doing. >> >> -Adrian >> >> su2 wrote: >>> Hi Adrian, >>> >>> How can I access fromDate and thruDate in Form xml? I tried using >>> fromDate >>> but did not work. >>> >>> Thanks for your help. >>> Su- >>> >>> >>> >>> Adrian Crum wrote: >>>> In the screen xml: >>>> >>>> <actions> >>>> <set field="fromDate" from-field"parameters.fromDate"/> >>>> <set field="thruDate" from-field"parameters.thruDate"/> >>>> </actions> >>>> >>>> In the form xml: >>>> >>>> <actions> >>>> <!-- Do something with fromDate and thruDate --> >>>> ... >>>> </actions> >>>> >>>> -Adrian >>>> >>>> su2 wrote: >>>>> Sorry, I was not able to understand - keep the information in the >>>>> context. >>>>> Can you please explain in detail. >>>>> >>>>> I really appreciate your help. >>>>> >>>>> Thank you. >>>>> Su- >>>>> >>>>> >>>>> Adrian Crum wrote: >>>>>> Why not keep that information in the context? Trying to access session >>>>>> information in the presentation layer breaks the MVC boundaries. >>>>>> >>>>>> -Adrian >>>>>> >>>>>> su2 wrote: >>>>>>> Hi Adrian, >>>>>>> >>>>>>> I have a screen which has bsh file in <actions> and FormWidget in >>>>>>> <widgets> >>>>>>> tag. I am capturing fromDate and thruDate in Session in .bsh file. >>>>>>> >>>>>>> Now from FormWidget I am calling Java Methods for the data >>>>>>> manipulation. >>>>>>> For >>>>>>> the data manipulation I need to have access to fromDate and thruDate >>>>>>> selected by the user. >>>>>>> >>>>>>> So here in Java method I am trying to access session variables. >>>>>>> >>>>>>> I hope it helps in understanding my scenario. >>>>>>> >>>>>>> Thank you. >>>>>>> Su- >>>>>>> >>>>>>> Adrian Crum wrote: >>>>>>>> You haven't provided enough information. Where in the program flow >>>>>>>> is >>>>>>>> the Java method? What are you trying to retrieve? What are you >>>>>>>> trying >>>>>>>> to >>>>>>>> achieve? >>>>>>>> >>>>>>>> -Adrian >>>>>>>> >>>>>>>> su2 wrote: >>>>>>>>> Hello Friends, >>>>>>>>> >>>>>>>>> I was trying to retrieve the session value using following code in >>>>>>>>> Java >>>>>>>>> Method. But it gives me error -"session" can not be resolved. >>>>>>>>> >>>>>>>>> ------------------------------------------------------------- >>>>>>>>> String fromDate = session.getAttribute("fromDate"); >>>>>>>>> ------------------------------------------------------------- >>>>>>>>> >>>>>>>>> Am I missing something? >>>>>>>>> >>>>>>>>> Thank you for the help in advance. >>>>>>>>> >>>>>>>>> Su- >>>>>>>>> >> > |
I tried
<field name="fromDate" title="date"> <display description="${fromDate}"/> </field> and <field name="fromDate" title="date"> <display/> </field> But neither of them worked.
|
Free forum by Nabble | Edit this page |