Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Where can I set the init parameters in WSAD?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I can get the vaule in my jsp using

Many thanks!
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go to your web.xml file and open with web.xml editor.
Select the servlets tab
Select Add and select jsp radio button.
Add your jsp
Highlight jsp and click initialization button
Enter your property name and its initial value.
Hope this helps
Graham
 
yang lu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I tried what you said, still got null value by using config.getInitParameter("parameterName") in JSP page. And what I want is that this parameter can be accessed by any jsps in my application not only one paticular jsp. I know how to do it in VAJ and websphere 3.5. I don't know how can I set up it in WSAD and websphere 4.0.
Many thanks!
 
Graham Mead
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yang,
You're right it does appear to return null when using the config object. After looking thru the internet I still can't see why.
Anyway, as you want all of your jsps to pickup the same parameter i.e at application level, why not open the web.xml file in editor mode, select the general tab and enter a context parameter and value here.
This equates to
<context-param>
<param-name>myName</param-name>
<param-value>Yang Lu</param-value>
</context-param>
in the xml source
You can access the parameter in all jsps via
<%=application.getInitParameter("myName")%>
I've tried it out and this one does work!


Graham
 
yang lu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Graham,
Thanks for your help. Setting a context parameter in web.xml works very well as you suggested. But I am working on moving a legacy application from websphere3.5/VAJ4.0-->WSAD4.03-->websphere 4.04. I don't want to change any exsiting code although I can. I checked the DTD file from SUN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd
Looks like there are no place to config ServletConfig in web.xml.
Many thanks!
    Bookmark Topic Watch Topic
  • New Topic