Hi all,

Please help me the best solution for initiating application and session
objects in common projects.

Assume

1. I have a jsp web page that use both session and application object of
session user. Meaning that the session and application objects must be
initiated somewhere before the user comes to this jsp page (!!!)

test.jsp
...
<jsp:usebean name="SessionObject" scope="session" class="..."/>
<jsp:usebean name="ApplicationObject" scope="application" class="..."/>
//user SessionObject and ApplicationObject here
...

2. an URL test is mapped to test.jsp
meaning that when user browses localhost://project/test, the test.jsp is
invoked

3. the test URL does not need an Action, because there is no tasks for it.

my current solutions:

1. I have to create one Action for test URL, the Action is responsible to
lookup these objects in Session and Application, if not found the action
initiats SessionObject and Application then put them in Session and Context.
This is bad because:
    It is not worth creating Action like this (waste of time), and of course
in project there is a lot of url like this so the same number of Actions are
created in wasting because we are not sure which direct URL (like above)
user comes first (in order to put the initiation correctly) so we have to
put the initiation as above in all Actions (sure that the next just need to
lookup in Session and Context is enough), it means that the initiation is
put in all actions but the really initiation is occured in only one Action,
then the rest could lookup in Session and Context.

2. I use HttpSessionListener (Servlet 2.3), but I do not know why I
invalidate the session, the Listener's sessionCreate method is not invoked,
it need restart web server.

3. I tried to override the init method in ActionServlet, but it is not good
for both session and application objects initiation.The same as the second
solution, sometimes the init method of ActionServlet is not invoked if I
call above URL (direct URL) it need restart web server

Please help me show best solution
thank in advance
regards
Khang



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to