How to add new context parameter to WebApp [message #151169] |
Fri, 09 December 2005 00:43 |
Eclipse User |
|
|
|
Originally posted by: wul99.yahoo.com
I use WTP 1.0RC1 and I am trying to add new context parameter to web.xml,
but I cannot find a way to do so.
In WebApp , I can get list of context parameters and it includes list of
ParamValue. But ParamValue is a interface. I wonder if there is such a
factory class that allows me to create an instance of ParamValue?
Thanks
William
|
|
|
Re: How to add new context parameter to WebApp [message #151177 is a reply to message #151169] |
Fri, 09 December 2005 01:10 |
Eclipse User |
|
|
|
Originally posted by: enorman.webmethods.com
William, try the following code: (also
https://bugs.eclipse.org/bugs/show_bug.cgi?id=119442 discusses how to do
this):
String name = "name1";
String value= "value1";
String description = "description1";
// If J2EE 1.4, add the param value and description info instances to the
context params
if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
// Create 1.4 common param value
ParamValue param = CommonFactory.eINSTANCE.createParamValue();
param.setName(name);
param.setValue(value);
if (description != null) {
// Create 1.4 common descripton value
Description descriptionObj =
CommonFactory.eINSTANCE.createDescription();
descriptionObj.setValue(description);
// Set the description on the param
param.getDescriptions().add(descriptionObj);
param.setDescription(description);
}
// Add the context param
webApp.getContextParams().add(param);
}
// If J2EE 1.2 or 1.3, use the servlet specific context param instances
else {
// Create the web init param
ContextParam param =
WebapplicationFactory.eINSTANCE.createContextParam();
// Set the param name
param.setParamName(name);
// Set the param value
param.setParamValue(value);
if (description != null) {
// Set the param description
param.setDescription(description);
}
// Add the context param
webApp.getContexts().add(param);
}
"William" <wul99@yahoo.com> wrote in message
news:baca5bdcead715a93b13b9cbfa6f5c8a$1@www.eclipse.org...
>
> I use WTP 1.0RC1 and I am trying to add new context parameter to web.xml,
> but I cannot find a way to do so.
>
>
> In WebApp , I can get list of context parameters and it includes list of
> ParamValue. But ParamValue is a interface. I wonder if there is such a
> factory class that allows me to create an instance of ParamValue?
>
>
> Thanks
>
> William
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02956 seconds