how to get value defined in web.xml ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get value defined in web.xml ?

sqlien
Hi,

in my method implementation of my service i want to get a value of variable which is defined in my web.xml like this:

<context-param>
     <param-name>myVariable</param-name>
     <param-value>value</param-value>
</context-param>

I remember that i dont use the following code code because i have not access to th object "request" in my method implementation. i means i can't get the object "request" from the object "DispatchContext":

ServletContext context =(ServletContext) request.getAttribute("ServletContext");

context.getInitParameter("myVariable")



please how to do that ?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

BJ Freeman
take a look at
   public static String getWebSiteId(ServletRequest request)


sqlien sent the following on 11/13/2007 4:43 AM:

> Hi,
>
> in my method implementation of my service i want to get a value of variable
> which is defined in my web.xml like this:
>
> <context-param>
>      <param-name>myVariable</param-name>
>      <param-value>value</param-value>
> </context-param>
>
> I remember that i dont use the following code code because i have not access
> to th object "request" in my method implementation. i means i can't get the
> object "request" from the object "DispatchContext":
>
> ServletContext context =(ServletContext)
> request.getAttribute("ServletContext");
>
> context.getInitParameter("myVariable")
>
>
>
> please how to do that ?
>
> thanks
>
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

BJ Freeman
sorry did not read all the way

look at
public class DispatchContext

BJ Freeman sent the following on 11/13/2007 5:14 AM:

> take a look at
>    public static String getWebSiteId(ServletRequest request)
>
>
> sqlien sent the following on 11/13/2007 4:43 AM:
>> Hi,
>>
>> in my method implementation of my service i want to get a value of variable
>> which is defined in my web.xml like this:
>>
>> <context-param>
>>      <param-name>myVariable</param-name>
>>      <param-value>value</param-value>
>> </context-param>
>>
>> I remember that i dont use the following code code because i have not access
>> to th object "request" in my method implementation. i means i can't get the
>> object "request" from the object "DispatchContext":
>>
>> ServletContext context =(ServletContext)
>> request.getAttribute("ServletContext");
>>
>> context.getInitParameter("myVariable")
>>
>>
>>
>> please how to do that ?
>>
>> thanks
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

vijay Si
${parameters.PARAMETER_NAME}

egg.  <decorator-screen name="main-decorator" location="${parameters.*
mainDecoratorLocation*}">
and the corresponding web.xml has

 <context-param>
    <param-name>*mainDecoratorLocation*</param-name>

<param-value>component://party/widget/partymgr/CommonScreens.xml</param-value>
    <description>The location of the main-decorator screen to use for this
webapp; referred to as a context variable in screen def XML
files.</description>
  </context-param>


On Nov 13, 2007 6:51 PM, BJ Freeman <[hidden email]> wrote:

> sorry did not read all the way
>
> look at
> public class DispatchContext
>
> BJ Freeman sent the following on 11/13/2007 5:14 AM:
> > take a look at
> >    public static String getWebSiteId(ServletRequest request)
> >
> >
> > sqlien sent the following on 11/13/2007 4:43 AM:
> >> Hi,
> >>
> >> in my method implementation of my service i want to get a value of
> variable
> >> which is defined in my web.xml like this:
> >>
> >> <context-param>
> >>      <param-name>myVariable</param-name>
> >>      <param-value>value</param-value>
> >> </context-param>
> >>
> >> I remember that i dont use the following code code because i have not
> access
> >> to th object "request" in my method implementation. i means i can't get
> the
> >> object "request" from the object "DispatchContext":
> >>
> >> ServletContext context =(ServletContext)
> >> request.getAttribute("ServletContext");
> >>
> >> context.getInitParameter("myVariable")
> >>
> >>
> >>
> >> please how to do that ?
> >>
> >> thanks
> >>
> >
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

sqlien
In reply to this post by sqlien
Hi,
thak your for your responses, but my problem is  not yet resolved :
1) i can not use  public static String getWebSiteId(ServletRequest request) because  i have not the object request from DispatcherContext
2) I have tack a look at DispatcherContext no method appropriated for my problem

Thanks you

sqlien wrote
Hi,

in my method implementation of my service i want to get a value of variable which is defined in my web.xml like this:

<context-param>
     <param-name>myVariable</param-name>
     <param-value>value</param-value>
</context-param>

I remember that i dont use the following code code because i have not access to th object "request" in my method implementation. i means i can't get the object "request" from the object "DispatchContext":

ServletContext context =(ServletContext) request.getAttribute("ServletContext");

context.getInitParameter("myVariable")



please how to do that ?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

BJ Freeman
http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams

sqlien sent the following on 11/14/2007 2:46 AM:

> Hi,
> thak your for your responses, but my problem is  not yet resolved :
> 1) i can not use  public static String getWebSiteId(ServletRequest request)
> because  i have not the object request from DispatcherContext
> 2) I have tack a look at DispatcherContext no method appropriated for my
> problem
>
> Thanks you
>
>
> sqlien wrote:
>> Hi,
>>
>> in my method implementation of my service i want to get a value of
>> variable which is defined in my web.xml like this:
>>
>> <context-param>
>>      <param-name>myVariable</param-name>
>>      <param-value>value</param-value>
>> </context-param>
>>
>> I remember that i dont use the following code code because i have not
>> access to th object "request" in my method implementation. i means i can't
>> get the object "request" from the object "DispatchContext":
>>
>> ServletContext context =(ServletContext)
>> request.getAttribute("ServletContext");
>>
>> context.getInitParameter("myVariable")
>>
>>
>>
>> please how to do that ?
>>
>> thanks
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

BJ Freeman
In reply to this post by sqlien
DispatcherContext.java along with examples that are in the code should
give you your answer.
for instance it uses Map.
if you look thru ofbiz code you will find examples to help you.

sqlien sent the following on 11/14/2007 2:46 AM:

> Hi,
> thak your for your responses, but my problem is  not yet resolved :
> 1) i can not use  public static String getWebSiteId(ServletRequest request)
> because  i have not the object request from DispatcherContext
> 2) I have tack a look at DispatcherContext no method appropriated for my
> problem
>
> Thanks you
>
>
> sqlien wrote:
>> Hi,
>>
>> in my method implementation of my service i want to get a value of
>> variable which is defined in my web.xml like this:
>>
>> <context-param>
>>      <param-name>myVariable</param-name>
>>      <param-value>value</param-value>
>> </context-param>
>>
>> I remember that i dont use the following code code because i have not
>> access to th object "request" in my method implementation. i means i can't
>> get the object "request" from the object "DispatchContext":
>>
>> ServletContext context =(ServletContext)
>> request.getAttribute("ServletContext");
>>
>> context.getInitParameter("myVariable")
>>
>>
>>
>> please how to do that ?
>>
>> thanks
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

BJ Freeman
and I apologize
DispatcherContext will not help you.

context is a Map.
you have to pull the particular context you want using .get and a cast
so if you find how the web.xml context is stored you will fine how to
retrieve it from the context passed.


BJ Freeman sent the following on 11/14/2007 4:11 AM:

> DispatcherContext.java along with examples that are in the code should
> give you your answer.
> for instance it uses Map.
> if you look thru ofbiz code you will find examples to help you.
>
> sqlien sent the following on 11/14/2007 2:46 AM:
>> Hi,
>> thak your for your responses, but my problem is  not yet resolved :
>> 1) i can not use  public static String getWebSiteId(ServletRequest request)
>> because  i have not the object request from DispatcherContext
>> 2) I have tack a look at DispatcherContext no method appropriated for my
>> problem
>>
>> Thanks you
>>
>>
>> sqlien wrote:
>>> Hi,
>>>
>>> in my method implementation of my service i want to get a value of
>>> variable which is defined in my web.xml like this:
>>>
>>> <context-param>
>>>      <param-name>myVariable</param-name>
>>>      <param-value>value</param-value>
>>> </context-param>
>>>
>>> I remember that i dont use the following code code because i have not
>>> access to th object "request" in my method implementation. i means i can't
>>> get the object "request" from the object "DispatchContext":
>>>
>>> ServletContext context =(ServletContext)
>>> request.getAttribute("ServletContext");
>>>
>>> context.getInitParameter("myVariable")
>>>
>>>
>>>
>>> please how to do that ?
>>>
>>> thanks
>>>
>>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

sqlien
In reply to this post by BJ Freeman
Thanks for your responses
BJ Freeman wrote
http://docs.ofbiz.org/display/OFBTECH/Framework+Introduction+Videos+and+Diagrams

sqlien sent the following on 11/14/2007 2:46 AM:
> Hi,
> thak your for your responses, but my problem is  not yet resolved :
> 1) i can not use  public static String getWebSiteId(ServletRequest request)
> because  i have not the object request from DispatcherContext
> 2) I have tack a look at DispatcherContext no method appropriated for my
> problem
>
> Thanks you
>
>
> sqlien wrote:
>> Hi,
>>
>> in my method implementation of my service i want to get a value of
>> variable which is defined in my web.xml like this:
>>
>> <context-param>
>>      <param-name>myVariable</param-name>
>>      <param-value>value</param-value>
>> </context-param>
>>
>> I remember that i dont use the following code code because i have not
>> access to th object "request" in my method implementation. i means i can't
>> get the object "request" from the object "DispatchContext":
>>
>> ServletContext context =(ServletContext)
>> request.getAttribute("ServletContext");
>>
>> context.getInitParameter("myVariable")
>>
>>
>>
>> please how to do that ?
>>
>> thanks
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

Bilgin Ibryam

<quote author="sqlien">
Thanks for your responses
<quote author="BJ Freeman">

Did you secceed?
If yes, how you did it ? Just curious if i need it one day...
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

sqlien
Unfortunately i have not succeed.


<quote author="Bilgin Ibryam">

<quote author="sqlien">
Thanks for your responses
BJ Freeman wrote
Did you secceed?
If yes, how you did it ? Just curious if i need it one day...
Reply | Threaded
Open this post in threaded view
|

Re: how to get value defined in web.xml ?

jonwimp
Sorry to come in so late in this thread.

Did you mean you want to introduce your own new variable in web.xml, something like how
"mainDecoratorLocation" works?

Jonathon

sqlien wrote:

> Unfortunately i have not succeed.
>
>
>
>
>
> Thanks for your responses
>
> BJ Freeman wrote:
>>
>> Did you secceed?
>> If yes, how you did it ? Just curious if i need it one day...
>>
>