dcsimg
run a class before a .jsp
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   fellow_ls
Posted On:   Sunday, February 15, 2004 05:57 PM

A class (UpdateInfo) must run before a jsp page in order to display the updated infomation on the jsp page. How to do it? Thanks. - Shawn

Re: run a class before a .jsp

Posted By:   Madock_Chiwenda  
Posted On:   Thursday, February 26, 2004 04:00 AM

Depends on when u want it to run:



1. Everytime u run ur jsp? just include code in jsp page, and import thet class at the beginning of ur jsp page.
U could alternatively send a request run a servlet and then "forward" to the jsp. (this is quite basic)



2. Scheduled run: create a servlet which is run on container initialization and within it run a thread which is run after a period of "sleep" (u need threading basics for this)

Re: run a class before a .jsp

Posted By:   Ravi_Kumar  
Posted On:   Friday, February 20, 2004 06:09 AM

declare an inner class in <%!-- --> jsp tags and create an object of this class in the same tags and write a method to call this inner class object

Re: run a class before a .jsp

Posted By:   Pekka_Kosonen  
Posted On:   Wednesday, February 18, 2004 11:24 PM

Use the pages JspInit-method. It compiles to the servlet's init-method.

Re: run a class before a .jsp

Posted By:   Max_Johnson  
Posted On:   Tuesday, February 17, 2004 08:28 AM

Just go around it - insert some java code that would check a boolean parameter, and if it's null (or whatever it should be when a .jsp page is called initially without any parameters passed in request), then call that class and forward the request to itself with that boolean set to true. And if that boolean is true - display that info.
I never implemented this myself, just trying to push you in the right direction.
About | Sitemap | Contact