• 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

init of servlets and jsp

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where can we provide the infomation of servlet's init() method in jsp
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can't.

You shouldn't need to anyway. JSP aren't meant to hold business logic, only display logic.
If you think you need to put any computation or data manipulation code in a JSP you need to instead rethink your application design.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeroen Wenting:
you can't.

You shouldn't need to anyway. JSP aren't meant to hold business logic, only display logic.
If you think you need to put any computation or data manipulation code in a JSP you need to instead rethink your application design.



You have got the best suggestion, Vara.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>you can't.

Why? Your jsp page may extends your own class and you can have your own
jspInit, jspDestroy

I am not discussing is it good or not, but technically it is possible and it is described in the spec.
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>I am not discussing is it good or not, but technically it is possible

correct, its technically possible.
You have to override _jspInit() in a <%!......%> (declarative tag).

ram.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vara prasad:
where can we provide the infomation of servlet's init() method in jsp



You can declare your JSP page as a servlet in your web.xml file and provide intialization parameters just like you would any other servlet. Then, in your JSP page, you can access the implicit config object (a ServletConfig instance) to access the servlet-specific information related to your JSP page.

Is that what you were asking about?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic