• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

web.xml parameters?

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am try to get the initial parameters from the web.xml file.
Also want to know how to get other tags from the ServletContext.

I do

In my jsp page. And it is not getting the value "com.mycompany.myapp.actions"

Here is my web.xml file


I found that when I call context.getServletContextName() it prints out
the <display-name>StreamBurner Webapp</display-name> in my jsp.

Maybe initial Parameters are only meant for inside servlet tags ???
If is then how do I set initial parameter's for all jsp and servlets in the web.xml file?

Any help would be great.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Init parameters declared within a servlet declaration are specific to that servlet. If you want "global" parameters, you should be using context parameters.
 
Sam Doder
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok , figured it out

by using this snippet in the web.xml

I was able to get the values.

However I also have tags like <error-page> , <welcome-file> , and <session-config>. What are this? I cann't get them with getInitParameter .

What are these I don't think these are context parameters?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sam Doder:
What are these I don't think these are context parameters?


If they're not declared with <context-parameter>, then yeah, they're not context parameters.

I'm not sure exactly what your question is.

If you want to know what all the components of the deployment descriptor are, the Servlet Spec is the document for you.
 
Sam Doder
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I mean is I want to beable to get the values of these tags.

Like say I have

<welcome-file-list id="WelcomeFileList">
<welcome-file>ping.jsp</welcome-file>
</welcome-file-list>

in the web.xml

How would I get the welcome-file value (which is ping.jsp ) from a jsp or servlet?

Their are other tags that you can put into the web.xml (other then config-param , or servlet tags )

I was wondering if their is an yes way to get these tag values from a jsp or servlet? Like say you had a filter, or an error page and you wanted to get the name of the error page in the jsp or servlet.

I know you can just but another config-param tag but I was wondering if you can do it straight from the tag.(Without parsing it's xml )
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. There is no API for that.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic