Re: How to handle refresh

2004-06-20 Thread suhash . c

Hi Mike,

We are aware that the transactional
token needs to be used for this purpose.
But we don't know the details thereof.
Need some more info on that.
Searched a lot but could not find any
details.
Had tried the resetToken method of the
Action class but nothing happened.

Suhash 





mike <[EMAIL PROTECTED]>

06/21/2004 12:02 PM




Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>





To
"Struts Users Mailing
List" <[EMAIL PROTECTED]>, "Struts Users Mailing List"
<[EMAIL PROTECTED]>


cc



Subject
Re: How to handle refresh








This is somewhat impossible to answer without more
information, but the 
basic Idea is probably to not allow records to be saved with a refresh
or a 
resubmittal of a form through the use of a token in your action classes.

At 11:22 PM 6/20/2004, [EMAIL PROTECTED] wrote:

>Hi all,
>
>           We wish to customise the behaviour
of IE refresh by just making 
> it fetch the latest data from the db.
>           It works fine in list and edit
screens where the last action 
> was a fetch.
>           But if the user has previously
saved a record, refresh causes 
> the save action to be executed once again, contrary to what we wish
to 
> achieve.
>           Is there any way in which we customise
this behaviour?
>
>
>TIA,
>
>Suhash
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

ForwardSourceID:NT56BE
   
DISCLAIMER: The information contained in this message is intended only and solely for 
the addressed individual or entity indicated in this message and for the exclusive use 
of the said addressed individual or entity indicated in this message (or responsible 
for delivery
of the message to such person) and may contain legally privileged and confidential 
information belonging to Tata Consultancy Services. It must not be printed, read, 
copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person 
other than the
addressee. Unauthorized use, disclosure or copying is strictly prohibited and may 
constitute unlawful act and can possibly attract legal action, civil and/or criminal. 
The contents of this message need not necessarily reflect or endorse the views of Tata 
Consultancy Services
on any subject matter. Any action taken or omitted to be taken based on this message 
is entirely at your risk and neither the originator of this message nor Tata 
Consultancy Services takes any responsibility or liability towards the same. Opinions, 
conclusions and any other
information contained in this message that do not relate to the official business of 
Tata Consultancy Services shall be understood as neither given nor endorsed by Tata 
Consultancy Services or any affiliate of Tata Consultancy Services. If you have 
received this message in error,
you should destroy this message and may please notify the sender by e-mail. Thank you.


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

how to implement checked option with tag in struts

2004-06-20 Thread Asim Ghosh
hello guys

how do i implement checked option with 

example:


in struts how to...?

asim




-
 ALL-NEW Yahoo! Messenger - so many all-new ways to express yourself 

Re: How to handle refresh

2004-06-20 Thread mike
This is somewhat impossible to answer without more information, but the 
basic Idea is probably to not allow records to be saved with a refresh or a 
resubmittal of a form through the use of a token in your action classes.

At 11:22 PM 6/20/2004, [EMAIL PROTECTED] wrote:
Hi all,
  We wish to customise the behaviour of IE refresh by just making 
it fetch the latest data from the db.
  It works fine in list and edit screens where the last action 
was a fetch.
  But if the user has previously saved a record, refresh causes 
the save action to be executed once again, contrary to what we wish to 
achieve.
  Is there any way in which we customise this behaviour?

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


Re: jstl trouble

2004-06-20 Thread mike
Which scope you want the data in depends on your needs (request, session, 
application, database).

At 11:23 PM 6/20/2004, javen fang wrote:
this is in struts mailing list, and you MUST be using
Struts
So in struts, we avoid to use scriptlets in JSP page.
All your data is prepared in struts Action

--- Pavlikus <[EMAIL PROTECTED]> wrote:
> Hello all.
>
> <%
>   UserSessionInfo info = (UserSessionInfo)
>
>
session.getAttribute(UserSessionInfo.USER_SESSION_INFO_KEY);
>
>   
>   out.println(info.getUser().getLogin());
> %>
>
> Later on page:
>
> 
> 
> 
>
> Please tell me where my mistake.
> Also, is there ways to avoid scriptlets on my jsp?
> I use  but it always try to create new
> instance
> of UserSessionInfo, instead of find it in session.
>
>
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>

__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
-
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]


Re: How to retrive the values from DB in JSPs

2004-06-20 Thread mike
Have you looked at the tags?
At 11:01 PM 6/20/2004, sougata wrote:
Hi All
I am working with struts framework.I have a JSP page (index,jsp) here I am
population a Dropdown from database.Where to populate the driopdown.Actually
my DAO class is returning a List of dropdown values.In JSP shall I call the
DAO class.But I am sure this will be a bad practise.Can anyone help
Sougata
-
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]


How to handle refresh

2004-06-20 Thread suhash . c

Hi all,

          We
wish to customise the behaviour of IE refresh by just making it fetch the
latest data from the db.
          It
works fine in list and edit screens where the last action was a fetch.
          But
if the user has previously saved a record, refresh causes the save action
to be executed once again, contrary to what we wish to achieve.
          Is
there any way in which we customise this behaviour? 
           
        

TIA,

Suhash
DISCLAIMER: The information contained in this message is intended only and solely for 
the addressed individual or entity indicated in this message and for the exclusive use 
of the said addressed individual or entity indicated in this message (or responsible 
for delivery
of the message to such person) and may contain legally privileged and confidential 
information belonging to Tata Consultancy Services. It must not be printed, read, 
copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person 
other than the
addressee. Unauthorized use, disclosure or copying is strictly prohibited and may 
constitute unlawful act and can possibly attract legal action, civil and/or criminal. 
The contents of this message need not necessarily reflect or endorse the views of Tata 
Consultancy Services
on any subject matter. Any action taken or omitted to be taken based on this message 
is entirely at your risk and neither the originator of this message nor Tata 
Consultancy Services takes any responsibility or liability towards the same. Opinions, 
conclusions and any other
information contained in this message that do not relate to the official business of 
Tata Consultancy Services shall be understood as neither given nor endorsed by Tata 
Consultancy Services or any affiliate of Tata Consultancy Services. If you have 
received this message in error,
you should destroy this message and may please notify the sender by e-mail. Thank you.


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

Re: jstl trouble

2004-06-20 Thread javen fang
this is in struts mailing list, and you MUST be using
Struts

So in struts, we avoid to use scriptlets in JSP page.
All your data is prepared in struts Action



--- Pavlikus <[EMAIL PROTECTED]> wrote:
> Hello all.
> 
> <%
>   UserSessionInfo info = (UserSessionInfo)
>
>
session.getAttribute(UserSessionInfo.USER_SESSION_INFO_KEY);
> 
>   
>   out.println(info.getUser().getLogin());
> %>
> 
> Later on page:
> 
> 
> 
> 
> 
> Please tell me where my mistake.
> Also, is there ways to avoid scriptlets on my jsp?
> I use  but it always try to create new
> instance
> of UserSessionInfo, instead of find it in session.
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 




__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

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



Re: where to call the DAO

2004-06-20 Thread javen fang
In your Action where JSP comes from. 

In Action get the list from DAO, and
request.setAttribute, and in the JSP use


--- sougata <[EMAIL PROTECTED]> wrote:
> Hi All
> I am working with struts framework.I have a JSP page
> (index,jsp) here I am
> population a Dropdown from database.Where to
> populate the driopdown.Actually
> my DAO class is returning a List of dropdown
> values.In JSP shall I call the
> DAO class.But I am sure this will be a bad
> practise.Can anyone help
> Sougata
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 




__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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



where to call the DAO

2004-06-20 Thread sougata
Hi All
I am working with struts framework.I have a JSP page (index,jsp) here I am
population a Dropdown from database.Where to populate the driopdown.Actually
my DAO class is returning a List of dropdown values.In JSP shall I call the
DAO class.But I am sure this will be a bad practise.Can anyone help
Sougata


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



How to retrive the values from DB in JSPs

2004-06-20 Thread sougata
Hi All
I am working with struts framework.I have a JSP page (index,jsp) here I am
population a Dropdown from database.Where to populate the driopdown.Actually
my DAO class is returning a List of dropdown values.In JSP shall I call the
DAO class.But I am sure this will be a bad practise.Can anyone help
Sougata


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



user@struts.apache.org

2004-06-20 Thread Asim Ghosh
hello guys
 
 how do i implement checked option with 
 
example:

 
in struts how to...?
 
asim


-
 ALL-NEW Yahoo! Messenger - so many all-new ways to express yourself 

Please Help Me To Convert My JSP Scripting Elements To Tags

2004-06-20 Thread Caroline Jen
I am converting all the scripting elements in my JSP
to  tags.  I have decided to go one step at
the time -- I only want to print out one basic number
as a start.

 My action class passes an object "TotalPosts" in
the following way to my JSP:

request.setAttribute( "TotalPosts", new Integer(
totalPosts ) );
return ( mapping.findForward( "success" ) );

and the following scripting elements in my JSP display
the value of TotalPosts well:

int totalPosts  = ( ( Integer
)request.getAttribute( "TotalPosts" ) ).intValue();

<%=totalPosts%>  // I am able to print out the correct

value without any problem.

Now, I have the struts-html-el.tld downloaded and put
the following in my application's web.xml file:

  
/tags/struts-html-el
   
/WEB-INF/lib/struts-html-el.tld
  

And in my JSP, I imported the following:

<%@ taglib uri="/tags/struts-html-el" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/tiles" prefix="tiles" %>

I replaced:

int totalPosts = ( ( Integer )request.getAttribute(
"TotalPosts" ) ).intValue();
with 


And I replaced:

<%=totalPosts%>
with
 

I cannot print out anything.  I got a 'BLANK'.

There must be something I missed.  What did go wrong?




__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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



RE: Problems with tiles...

2004-06-20 Thread Thiago Souza
Hi!

Well... What I'm trying to do is to repass the tiles:put to another
nested tile... 

-Original Message-
From: David Friedman [mailto:[EMAIL PROTECTED] 
Sent: quinta-feira, 17 de junho de 2004 19:57
To: Struts Users Mailing List
Subject: RE: Problems with tiles...

Why are you doing a tiles:getAsString inside the tiles:put in your JSP?  I
use it as a normal tag, not within a tiles:put block.  Just my $.02 worth.

Regards,
David

-Original Message-
From: Thiago Souza [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 1:40 PM
To: [EMAIL PROTECTED]
Subject: Problems with tiles...


Hi ppl,


Why this isn't rendering?

in master.jsp
  





in item.content.jsp (defined for "content-layout")


The definition used















The "/tiles/blank.jsp" isn't rendering! Nothing! Neither an error!

Any clue anyone?

Thanks in advance...
Thiago Souza


-
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]



RE: Problems with tiles...

2004-06-20 Thread Thiago Souza
Hi!

Well... What I'm trying to do is to repass the tiles:put to another
nested tile... 

-Original Message-
From: David Friedman [mailto:[EMAIL PROTECTED] 
Sent: quinta-feira, 17 de junho de 2004 19:57
To: Struts Users Mailing List
Subject: RE: Problems with tiles...

Why are you doing a tiles:getAsString inside the tiles:put in your JSP?  I
use it as a normal tag, not within a tiles:put block.  Just my $.02 worth.

Regards,
David

-Original Message-
From: Thiago Souza [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 1:40 PM
To: [EMAIL PROTECTED]
Subject: Problems with tiles...


Hi ppl,


Why this isn't rendering?

in master.jsp
  





in item.content.jsp (defined for "content-layout")


The definition used















The "/tiles/blank.jsp" isn't rendering! Nothing! Neither an error!

Any clue anyone?

Thanks in advance...
Thiago Souza


-
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]



Help for designing & proceed

2004-06-20 Thread Nikhil Sidhaye
Hello Friends,
  I am very new in Struts... Actually I am J2ME developer. 
Recently I shifted to J2EE project. It is typical portal containing 
Manager, Vendor, Member & Agents login. Code is already written in MVC 
paradigm. But for handling all this thing there is only one model & it 
contains all functions for the Vendor, Agent, Member & Manager. The 
instance of Model is held in session object? Database Beans got the data 
using the functions from this model class. I will be very thankful to 
you if any one can guide me how should I proceed for improving 
performance as well as bringing structured & cleanliness in project.

   Currently project is not in struts. I am planning to use Struts 
Framework for this project. How should I proceed? I think there should 
be 4 model. So depending on user type session get populated. Also is 
there any in-built function in struts which can send password over 
internet in encrypted form? Should I give login pages under WEB-INF ?

For messages I use property file which stored all messages. Is 
there any better practice?

   Thanks in advance.
Regards,
Nikhil Sidhaye

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


Re: jstl trouble

2004-06-20 Thread Nikhil Sidhaye
Hello Pavlikus,
I got the same problem. I overcome this problem with very crude method.
use import jsp tag for  getting appropriate classes
First I create 1 instance with 

Then I reinitialise the info with session.getAttribute in JSP.
& then you can use your methods using JSTL or simple java code.
I wonder if

this will run / not. Because I don't try like info.user.login though 
conceptually it sounds pretty good. In my case so I use single different 
methods such as info.user etc.

Please correct me if I am wrong some where. Because It is my learning curve.
Regards,
Nikhil Sidhaye.
Pavlikus wrote:
Hello all.
<%
 UserSessionInfo info = (UserSessionInfo)
   session.getAttribute(UserSessionInfo.USER_SESSION_INFO_KEY);
   
 
 out.println(info.getUser().getLogin());
%>

Later on page:



Please tell me where my mistake.
Also, is there ways to avoid scriptlets on my jsp?
I use  but it always try to create new instance
of UserSessionInfo, instead of find it in session.
-
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]


RE: jstl trouble

2004-06-20 Thread Tim Penhey
You should be able to use the 
where the id of the bean is the key that had been used to set the attribute.

What were you using when your  tag was trying to create 
a new instance?

Tim

> -Original Message-
> From: Pavlikus [mailto:[EMAIL PROTECTED]
> Sent: 20 June 2004 15:22
> To: [EMAIL PROTECTED]
> Subject: jstl trouble
> 
> 
> Hello all.
> 
> <%
>   UserSessionInfo info = (UserSessionInfo)
> session.getAttribute(UserSessionInfo.USER_SESSION_INFO_KEY);
> 
>   
>   out.println(info.getUser().getLogin());
> %>
> 
> Later on page:
> 
> 
> 
> 
> 
> Please tell me where my mistake.
> Also, is there ways to avoid scriptlets on my jsp?
> I use  but it always try to create new instance
> of UserSessionInfo, instead of find it in session.
> 
> 
> -
> 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]



Re: Two questions: validation

2004-06-20 Thread Niall Pemberton
1) You could either validate the page number in each of your Actions or in
the ActionForm. If you do it in the ActionForm the validate() method has the
ActionMapping, so you could check if the mapping name ties up with the page
number.

String action = mapping.getName();
   if (page == 1 && !("/myFirstAction".equals(action)))
   errors.add(...)

Or you could do it in each of your actions in the execute() method...

   public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest,

HttpServletResponse) {

 ActionErrors errors = new ActionErrors();
 if (form.getPage() != 4) {
 errors.add();
 }
 saveErrors(request, errors);
 if (errors.size() > 0)
return mapping.getInputForward();

 }

2) I think it would be a pain to access validator using the Struts
functions - they need it to be configured first, which is done in the XML
file. You could access the Commons Validator functions yourself directly
though:

 Float result = GenericTypeValidator.formatFloat(value);
 if (result == null) {
errors.add(field.getKey(), Resources.getActionMessage(request,
va, field));
}

Niall

- Original Message - 
From: "Jacob Weber" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 20, 2004 3:26 PM
Subject: Two questions: validation


> I have two questions on Struts' validation.
>
> 1. Let's say I have a multi-page form. Each JSP in the form points to a
> different action (or a different method of a DispatchAction), and passes
> the current "page" value to the action. It's possible for someone to
> pass the wrong value of "page" to an action (e.g. by passing it in the
> URL). This means that someone could call the final action in the
> sequence, pass page=0, and bypass all the validation. What's the
> recommended way to prevent this?
>
> 2. I have some validation rules that should only be checked under
> certain conditions. So I'm overriding the ValidatorForm.validate()
> method. Is there a clean way to access Struts' validation functions like
> validateFloat from this method, so I don't have to rewrite them?
>
> Thanks for any help,
> Jacob
>
>
> -
> 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]



jstl trouble

2004-06-20 Thread Pavlikus
Hello all.

<%
  UserSessionInfo info = (UserSessionInfo)
session.getAttribute(UserSessionInfo.USER_SESSION_INFO_KEY);

  
  out.println(info.getUser().getLogin());
%>

Later on page:





Please tell me where my mistake.
Also, is there ways to avoid scriptlets on my jsp?
I use  but it always try to create new instance
of UserSessionInfo, instead of find it in session.


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



Re: Displaying html tag as html with bean:write

2004-06-20 Thread Niall Pemberton
By default  'filters' special html characters converting them to
their 'entity' types so that they render properly - for example '<' is
converted to '>'

You can switch it off using the filter="false" attribute.

  

The JSTL equivalenttag also has an attribute which performs the
same function. I think its "escapeXML"

However if your user really does want to see, for example, the greater than
character then they will have to type in > themselves.

Niall

- Original Message - 
From: "Irfandhy Franciscus" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 20, 2004 3:09 PM
Subject: Displaying html tag as html with bean:write


> Hi All,
>
> I am developing a hibernate-struts base blog. And I would like to have
> my user to be able to use html tag such as :  ;  etc in their
> posts.
>
> The database field that I use to save the user post is in BLOG.
>
> To display their post I use  tag. The problem with this tag
> is that it render the html tag as a string in the page. So if the user
> enters :
>
> 'My post on 20 June ; ' it will display 'My post on 20 June
> ; ' in the page.
>
> Okay to get around this problem I use the old good <%=out.println(...)%>
> . It display the post as 'My Post on 20 June ;'. Everything is perfect
> except for the ';' at the end of the post.
>
> Does anyone know how to ge around this problem. Thanks for the help :D
>
> Regards,
> Irfandhy Franciscus
>
>
> -
> 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]



Displaying html tag as html with bean:write

2004-06-20 Thread Irfandhy Franciscus
Hi All,
I am developing a hibernate-struts base blog. And I would like to have 
my user to be able to use html tag such as :  ;  etc in their 
posts.

The database field that I use to save the user post is in BLOG.
To display their post I use  tag. The problem with this tag 
is that it render the html tag as a string in the page. So if the user 
enters :

'My post on 20 June ; ' it will display 'My post on 20 June 
; ' in the page.

Okay to get around this problem I use the old good <%=out.println(...)%> 
. It display the post as 'My Post on 20 June ;'. Everything is perfect 
except for the ';' at the end of the post.

Does anyone know how to ge around this problem. Thanks for the help :D
Regards,
Irfandhy Franciscus
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Two questions: validation

2004-06-20 Thread Jacob Weber
I have two questions on Struts' validation.

1. Let's say I have a multi-page form. Each JSP in the form points to a 
different action (or a different method of a DispatchAction), and passes 
the current "page" value to the action. It's possible for someone to 
pass the wrong value of "page" to an action (e.g. by passing it in the 
URL). This means that someone could call the final action in the 
sequence, pass page=0, and bypass all the validation. What's the 
recommended way to prevent this?

2. I have some validation rules that should only be checked under 
certain conditions. So I'm overriding the ValidatorForm.validate() 
method. Is there a clean way to access Struts' validation functions like 
validateFloat from this method, so I don't have to rewrite them?

Thanks for any help,
Jacob


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



R: Detecting browser close

2004-06-20 Thread Simone - Dev
What I'm proposing to you it's a solution that works only on JS enabled
browsers, but since this is almost the 99,99% of the browser on the
market shouldn't be a problem :-)

On the onClose event of the window object (javascript object) opens a
new window of 10px that is displayed off the screen (8000px left): this
windows will contain a page that close all session specific resources as
soon as the user exit, without having to wait the session timeout to
expire

I used it many times, also to provide a "u forgot to save what you did,
are you sure you want to exit the page?" alert (but this need a
onBeforeClose event that is available only on IE).

Simone

-
Simone Chiaretta
www.piyosailing.com/S
Any sufficiently advanced technology is indistinguishable from magic
"Life is short, play hard"


> -Messaggio originale-
> Da: ksitron [mailto:[EMAIL PROTECTED] 
> Inviato: sabato 19 giugno 2004 23.32
> A: Struts Users Mailing List
> Oggetto: Detecting browser close
> 
> 
> 
> Is there a way to detect when the user closes the browser.
> What I want to do is do clean-up and destroy the session.
> 
> 
> Thanks in advance.
> 
> -- 
> 
> 
> 
> 
> 
> -
> 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]



Re: Detecting browser close

2004-06-20 Thread Pedro Salgado
On 04/06/20 3:49, "mike" <[EMAIL PROTECTED]> wrote:

> There are ways, if you are so adamant about this that you want to use a lot
> of resources.  Are you?
> 
> At 04:53 PM 6/19/2004, Bill Siggelkow wrote:
>> AFAIK this cannot be done -- your best bet is to provide a Logoff link and
>> a reasonable session timeout.
>> 
>> ksitron wrote:
>>> Is there a way to detect when the user closes the browser.
>>> What I want to do is do clean-up and destroy the session.
>>> 

  This will help you clean-up and destroy the session. If you already know
how to accomplish this... Then skip this reply... :)



  I don¹t know the objective you want to accomplish but I had to implement a
UserContainer that was session aware.
  All I had to do is implement the HttpSessionBindingListener on this class.

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/servlet/htt
p/HttpSessionBindingListener.html


  By default, when you destroy the session all attributes are destroyed but
not closed (example: a database connection may still persist but the session
itself doesn't).

  The best way to clean-up/close resources is to define a
ApplicationContainer with a

"private Map map = new HashMap();"

 and then implement something similar to HttpSession

"public final void setAttribute(final String key, final Object value)"
"public final getAttribute(final String key)"

and the 

"public void valueUnbound(HttpSessionBindingEvent event)"

you could also implement this method

"public void valueBound(HttpSessionBindingEvent event)"

to initalize container's configurations/resources.

When a user logs off you just to remove the ApplicationContainer from
session and the unbound method will be called.
When a session times out the ApplicationContainer will be removed from
session and the unbound method will be called.


Pedro Salgado


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