RE: R: Back Browser Button After Logout and Reload so that continue working

2004-06-24 Thread manoj JC
Along the same lines
In the Login.do
You should have something like
HttpSession session = httpServletRequest.getSession( true );
if ( session != null ) {
  session.setAttribute("loggedin", true);
}
And in Logout.do
You should have something like
HttpSession session = httpServletRequest.getSession( false );
if ( session != null ) {
  session.setAttribute("loggedin", false);
}
The way I have done is, I have divided my action classes into two types. One 
for logged in users and other for not logged in users. In struts-config one 
of the attributs of the action class is "requiredlogin=yes" or 
"requiredlogin=no"

In the actionservlet, I check if the current action's "requiredlogin=yes"
if it is then check for the value session.getAttribute("loggedin"); If it is 
false, you redirect the page to a login.do else you would send it to correct 
action class.

Folks, please let me know if this a convoluted way of achieving this.
From: "Amleto Di Salle" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: R: Back Browser Button After Logout and Reload so that continue 
working
Date: Thu, 24 Jun 2004 16:53:40 +0200

Hi,
one possible solution is to invalidate the session inside the
"LogoffAction".
HttpSession session = httpServletRequest.getSession( false );
if ( session != null ) {
session.invalidate();
}
If you have already done and the problem remains, maybe you are using
HttpServletRequest.getSession() method (or getSession(true)) inside the
Actions (or "BaseAction" if you use a base class for your all actions,
in order to validate the users).
BR
/Amleto
-Messaggio originale-
Da: Ricardo Andres Quintero [mailto:[EMAIL PROTECTED]
Inviato: giovedì 24 giugno 2004 15.41
A: [EMAIL PROTECTED]
Oggetto: Back Browser Button After Logout and Reload so that continue
working
Hello my friends
Followed i attach a message i found in the internet.
I have found some conceptual solutions about this problem,
but i DO need an example that works to solve it.
The conceptual solution talks about a token syncronizer. I don't know
how to write it.
Thank you in advanced.
<%-- THE PROBLEM --%>
Hello,
I used Struts to develop a web app which has a login form to permit
access to different functionnalities via a menu page. I use a session
var I set at login to check if the user has not logged out. The problem
that I have is, once I do the logoff, if I use the Back button of the
browser to the menu page and do a refresh a new session gets created and
I'm able to use the app. I have a filter to do the verification but I
tried before doing it in each Action and I have the same problem. I
don't access .jsp pages directly, I have an Action for each of them. I
read some posts but none seems to talk about my specific problem.
It sounds like a begginer caveat but I have no idea what should I do or
what am I doing wrong. Any help appreciated,
Cezar
<%-- END OF THE PROBLEM --%>
--
Ricardo Andrés Quintero R.
Ubiquando Ltda.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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


Re: How to execute an initialization by using another servlet entry in web.xml

2004-06-24 Thread manoj JC
That sounds like a good method. I will try that. Thank you Nicolas.
And thank you Geeta for your suggestion also.

From: "Nicolas De Loof" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Re: How to execute an initialization by using another servlet 
entry in web.xml
Date: Thu, 24 Jun 2004 16:47:40 +0200

You should put the configuration object into application scope 
(servletContext) so it can be accessed from any servlet /
jsp of your app.

You can put MyXMLParserServlet itself into servletcontext and access it 
from struts action by:

MyXMLParserServlet conf = (MyXMLParserServlet)
getServlet().getServletContext().getAttribute(MyXMLParserServlet.CONF_BEAN);
I'd suggest to define an interface for methods used by actions, to be able 
to change it easier if needed :

class MyXMLParserServlet extends HttpServlet implements IConf {
...
interface IConf {
public final static String CONF_BEAN = "..."
Element getElement();
}
in action :
IConf conf = (IConf) 
getServlet().getServletContext().getAttribute(ICond.CONF_BEAN);

Nico.
> Thank you for answering the first part of the question.
>
> What I am trying to do is, this MyXMLParserServlet(the new entry in 
web.xml)
> parses an XML file. From my main ActionServlet.process() , I want to do
> something like MyXMLParserServlet.getElement() . I won't be calling this
> method from the init() method of my actionServlet.
>
> Thanks again.
>
> >From: Bill Siggelkow <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: How to execute an initialization by using another servlet
> >entry in web.xml
> >Date: Thu, 24 Jun 2004 08:51:29 -0400
> >
> >If you are using approach #3 then extend HttpServlet. However, you 
should
> >not need to be accessing the ActionServlet from the init servlet. 
Perhaps
> >you could provide some more background on what you are trying to
> >accomplish.
> >
> >manoj JC wrote:
> >
> >>Can somebody provide some sample code to do this. Please look at this 
link
> >>http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization.
> >>I want to use #3 approach mentioned in this link.
> >>
> >>My questions are :
> >>
> >>(A stupid question) Does this initialization class that I would 
specify in
> >>web.xml, should it be a servlet,ActionServlet, or most importantly 
could
> >>it be a just an ordinary java class.
> >>
> >>How do I access this servlet entry(this instance of class) from my 
main
> >>ActionServlet?
> >>
> >>Thank you
> >>
> >>_
> >>MSN Toolbar provides one-click access to Hotmail from any Web page – 
FREE
> >>download! 
http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _
> Make the most of your family vacation with tips from the MSN Family 
Travel
> Guide! http://dollar.msn.com
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


Our name has changed.  Please update your address book to the following 
format: "[EMAIL PROTECTED]".

This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the 
person to whom it is addressed. If you are not the intended recipient,  you 
are not authorized to read, print, retain, copy, disseminate,  distribute, 
or use this message or any part thereof. If you receive this  message in 
error, please notify the sender immediately and delete all  copies of this 
message.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/

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


Re: How to execute an initialization by using another servlet entry in web.xml

2004-06-24 Thread manoj JC
Thank you for answering the first part of the question.
What I am trying to do is, this MyXMLParserServlet(the new entry in web.xml) 
parses an XML file. From my main ActionServlet.process() , I want to do 
something like MyXMLParserServlet.getElement() . I won't be calling this 
method from the init() method of my actionServlet.

Thanks again.
From: Bill Siggelkow <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: How to execute an initialization by using another servlet 
entry in web.xml
Date: Thu, 24 Jun 2004 08:51:29 -0400

If you are using approach #3 then extend HttpServlet. However, you should 
not need to be accessing the ActionServlet from the init servlet. Perhaps 
you could provide some more background on what you are trying to 
accomplish.

manoj JC wrote:
Can somebody provide some sample code to do this. Please look at this link 
http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization.
I want to use #3 approach mentioned in this link.

My questions are :
(A stupid question) Does this initialization class that I would specify in 
web.xml, should it be a servlet,ActionServlet, or most importantly could 
it be a just an ordinary java class.

How do I access this servlet entry(this instance of class) from my main 
ActionServlet?

Thank you
_
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Make the most of your family vacation with tips from the MSN Family Travel 
Guide! http://dollar.msn.com

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


How to execute an initialization by using another servlet entry in web.xml

2004-06-23 Thread manoj JC
Can somebody provide some sample code to do this. Please look at this link 
http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization.
I want to use #3 approach mentioned in this link.

My questions are :
(A stupid question) Does this initialization class that I would specify in 
web.xml, should it be a servlet,ActionServlet, or most importantly could it 
be a just an ordinary java class.

How do I access this servlet entry(this instance of class) from my main 
ActionServlet?

Thank you
_
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/

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


RE: How to read a large XML file in the ActionServlet

2004-06-23 Thread manoj JC
Thank you very much for your suggestions, Frank. That was really helpful.

From: "Frank Zammetti" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: RE: How to read a large XML file in the ActionServlet
Date: Wed, 23 Jun 2004 14:30:27 -0400
I don't care how good of an XML parser you are using, parsing virtually any 
XML file on a per-request basis is a Bad Idea (tm).  You definitely want to 
find a way to (a) store the parsed information in memory, or (b) maybe read 
it from a database, which may or may not actually wind up being any better 
depending on numerous factors.

I used to have to use a custom framework here at work before my glorious 
leaders finally decided to listen to us architects an use Struts.  This 
framework used XML "profile" database, much like struts-config.xml.  Early 
on, this thing was reading this file for EVERY request, just to determine 
which controller element to execute and where to forward to afterwards.  
Apps built on this thing were just barely OK on killer hardware.  Well, the 
very first week I was using the thing, I rewrote the preprocessor that 
parsed this file and instead read it in once at app startup and then read 
the data in memory.  True, there was no longer a way to do real-time 
profile changes without downing the app, but all of a sudden our apps were 
flying like nobody's business, and server load decreased for the same 
number of concurrent users by a HUGE factor.  Needless to say, people were 
rather happy.

I can't stress the point enough: parsing XML per-request is almost never a 
good idea.  Making your myXmlClass class static (well, the result of the 
XML parsing static anyway) is one way to go, and might be the best way, 
performance-wise.  Do the parsing from a Struts plug-in, store it in a 
HashMap or whatever you need it to be in that class as a static member, and 
your problem will probably go away.

Frank

From: "manoj JC" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: How to read a large XML file in the ActionServlet
Date: Wed, 23 Jun 2004 14:15:08 -0400
Hi
I want to read a a large XML file for each request that comes to the 
ActionServlet.
This is for a reporting application. What I did was I created seperate XML 
file where I have specified the action elements and its related 
subelements. So when I get the request I get the corresponding XML node 
from the XML file for that action and based on its subelements I enter a 
log into a database.

So I have my customized ActionServlet. And I am instantiating myXmlClass 
in the process method. And I call a method called 
myXmlClassObject.getXMLLogMessage() for each request (for each Action 
class).
What is the recommended way to do this.

The problem that I am having is that the application freezes at the line 
"instantiate myXmlClass " in the process method of my servlet.

Currently my code look like this
//MyActionServlet.java
init()
{
//perform initialization()
super.init()
}
process()
{
//do stuff
instantiate myXmlClass (which has a _saxparser.parse() method)
myXmlClassObject.getXMLLogMessage()//some database calls underneath it for 
some logging
//do stuff
}

Should I make a static object of myXmlClass in my actionServlet.
Should I put myXmlClass into session, and check for each request whether 
this object exists in session, if not create it.

Please help!!
_
Make the most of your family vacation with tips from the MSN Family Travel 
Guide! http://dollar.msn.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Watch the online reality show Mixed Messages with a friend and enter to win 
a trip to NY 
http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/01/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Watch the online reality show Mixed Messages with a friend and enter to win 
a trip to NY 
http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/01/

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


How to read a large XML file in the ActionServlet

2004-06-23 Thread manoj JC
Hi
I want to read a a large XML file for each request that comes to the 
ActionServlet.
This is for a reporting application. What I did was I created seperate XML 
file where I have specified the action elements and its related subelements. 
So when I get the request I get the corresponding XML node from the XML file 
for that action and based on its subelements I enter a log into a database.

So I have my customized ActionServlet. And I am instantiating myXmlClass in 
the process method. And I call a method called 
myXmlClassObject.getXMLLogMessage() for each request (for each Action 
class).
What is the recommended way to do this.

The problem that I am having is that the application freezes at the line 
"instantiate myXmlClass " in the process method of my servlet.

Currently my code look like this
//MyActionServlet.java
init()
{
//perform initialization()
super.init()
}
process()
{
//do stuff
instantiate myXmlClass (which has a _saxparser.parse() method)
myXmlClassObject.getXMLLogMessage()//some database calls underneath it for 
some logging
//do stuff
}

Should I make a static object of myXmlClass in my actionServlet.
Should I put myXmlClass into session, and check for each request whether 
this object exists in session, if not create it.

Please help!!
_
Make the most of your family vacation with tips from the MSN Family Travel 
Guide! http://dollar.msn.com

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