Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web.xml parameters?

 
Sam Doder
Ranch Hand
Posts: 204
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. There is no API for that.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic