• 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

mapping all jsps to single servlets init parameters

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi every i want to access init parameter values in jsp....is there any way to map all jsps to single servlets init-param values..
when i try to do this iam getting error..

<init-param>
<param-name>url</param-name>
<param-value>jdbcracle:thin:@localhost:1521:orcl</param-value>
</init-param>
<init-param>
<param-name>name</param-name>
<param-value>scott</param-value>
</init-param>
<init-param>
<param-name>pass</param-name>
<param-value>tiger</param-value>
</init-param>
<servlet-name>smartcardJSP</servlet-name>
<jsp-file>/*.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>smartcardJSP</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
------------------
when i do this way it is working for single jsp
<init-param>
<param-name>url</param-name>
<param-value>jdbc:oracle:thin:@localhost:1521:orcl</param-value>
</init-param>
<init-param>
<param-name>name</param-name>
<param-value>scott</param-value>
</init-param>
<init-param>
<param-name>pass</param-name>
<param-value>tiger</param-value>
</init-param>
<servlet-name>smartcardJSP</servlet-name>
<jsp-file>/1001.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>smartcardJSP</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
------------------------------------------
if it is not possible tell me the alternative way my application has many jsps......so in all jsps i need to access database...
if possible tell me how can i do this with context parameters
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think it's possible. If you want all your JSPs/Servlets to access your init params, why don't you use <context-param> instead?
 
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic