• Post Reply Bookmark Topic Watch Topic
  • New Topic

init parameters for jsp  RSS feed

 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

I have doubt which i have already posted in sun.java forum....but did not get any help from there. My doubt is, JSPs are ultimately servlets,....so just like servlets, can init parameters be defined for jsps also in web.xml ?
Please let me know the syntax also.

Thanks and Regards
Omkar Patkar
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by omkar patkar:
JSPs are ultimately servlets
That is an implementation detail upon which your code should not erly.

Moreover, because modern JSPs should contain no Java code, of what use would such init parameters be?
 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear, but my question was just for knowledge point of view and from point of view of commerical usuage of jsp

When will a code like be be useful in jsps then ?

Can their be any situation where i can use this facility for jsp ?

Thanks and Regards
Omkar Patkar
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by omkar patkar:
Can their be any situation where i can use this facility for jsp ?

Again, not if you want to follow accepted best practices which dictate no Java code in a JSP.

The EL -- which should be used in modern JSPs -- can access context parameters via its built-in variables.
 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok ... so init parameters can be accessed, whether its EL or java code...but then how are init parameters set for jsp ....any sample code would be of great help for me to understand how init parameters can be set for jsp, if they can be accessed using EL.

Thanks and Regards
Omkar Patkar.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was discussed at length in this thread.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by omkar patkar:
Ok ... so init parameters can be accessed, whether its EL or java code..
I did not say that.

I said context parameters can be accessed.
 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ohh Sorry and Thank you also!.... i got the necessary information in the thread specified.

Thanks and Regards
Omkar Patkar
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!