You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Maya menon <ma...@yahoo.com> on 2007/02/01 19:52:27 UTC

General question

I have a struts based J2ee app which displays data from DB in the results.jsp page. For DB data access, I use a DAO which returns a serialized object. This serialized object, I set it to request object using setAttribute and retrieve it using <bean:write> tag i n jsp page. 
   
  My question is: if users try to open another window and do simultaneous tasks, how can I avoid same user from working in two or more different windows in a Struts based j2ee application ? 
   
  Any thoughts..

 
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.

Re: General question

Posted by Dale Newfield <Da...@Newfield.org>.
Maya menon wrote:
> My question is: if users try to open another window and do
> simultaneous tasks, how can I avoid same user from working in two or
> more different windows in a Struts based j2ee application ?

If your worry is that someone might submit changes to an object that has 
  changed since the generation of the form (and therefore overwrite 
previous changes), maybe a simple solution would be a "version" column 
in your table, only persisting submitted changes where the version still 
matches what's in the DB.

You don't need to use hibernate to do this, but here's their take on 
this: 
http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-declaration-version

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] Re: General question

Posted by Dave Newton <ne...@yahoo.com>.
--- Maya menon <ma...@yahoo.com> wrote:
>   Yes I had the variable initially set in session.
> Then when I did Cntrl+N[open new window] from the
> existing browser window, I see the same result in
> the second window.

If you open a new window in IE it will take the
parameters from the current window and duplicate them
in the new one (AFAICR). But that shouldn't be an
issue, as any request issued from the new window will
not be shared with the original window. Only if you
are keeping data in session is there a possibility of
something being "over-written".

>   what way can the appearence of DB values be
> prevented in multiple windows ? 

If everything is in request then there is no possible
way (that I know of, which doesn't mean much :) that
two browser windows are able to make the same request,
by definition.

d.



 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: General question

Posted by Maya menon <ma...@yahoo.com>.
Dave,
   
  Thanks for the reply.
  Yes I had the variable initially set in session. Then when I did Cntrl+N[open new window] from the existing browser window, I see the same result in the second window.
   
  Even when I set it in request object and do[open new window] the same result is being displayed.
   
  what way can the appearence of DB values be prevented in multiple windows ? 
   
  Thanks

Dave Newton <ne...@yahoo.com> wrote:
  --- Maya menon wrote:
> My question is: if users try to open another
> window and do simultaneous tasks, how can I avoid
> same user from working in two or more different
> windows in a Struts based j2ee application ? 

I don't know as you can (easily), but your scenario
doesn't describe a situation in which that would be a
problem. *Session* variables can be a problem
(browser-dependent) but request-based variables
shouldn't be an issue.

DAve "I think I'm just going to change my legal name
to DAve"




____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



 
---------------------------------
Sucker-punch spam with award-winning protection.
 Try the free Yahoo! Mail Beta.

Re: General question

Posted by Dave Newton <ne...@yahoo.com>.
--- Maya menon <ma...@yahoo.com> wrote:
>   My question is: if users try to open another
> window and do simultaneous tasks, how can I avoid
> same user from working in two or more different
> windows in a Struts based j2ee application ? 

I don't know as you can (easily), but your scenario
doesn't describe a situation in which that would be a
problem. *Session* variables can be a problem
(browser-dependent) but request-based variables
shouldn't be an issue.

DAve "I think I'm just going to change my legal name
to DAve"



 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: General question

Posted by Mauricio Garavaglia <nb...@ncraft.com.ar>.
I think in a bad&ugly (tm) solution using cookies, but you are free to 
give it a try ; )
Put a session scoped flag that says "beenthere" in the Action of your 
primary form.  Null by default this variable will be initialized to 
something the first time the user open your Action. If the user try to 
open it again the "beenthere" variable will be not null and you can 
forward it to somewhere else. Hope this helps. Could post some code but 
imho is quite simple.
Regards

Mauricio Garavaglia

Maya menon wrote:
> I am talking about two browser windows. 
>   User A logs in in browser A and sees DB results in results.jsp page
>    
>   Then, User A open Browser B from Browser A. if he does that, he will see results in two pages, browser A and browser B. and then he will be able to do different edits from different windows. That should be prevented.
>
> "Hartrich, James CTR USTRANSCOM J6" <Ja...@ustranscom.mil> wrote:
>   Are you talking about different browser "windows" or just new "tabs" in
> the same browser? Perhaps try an application scoped variable that tests
> the current user, allowing only one instance of the user to operate the
> app.
>
> -----Original Message-----
> From: Maya menon [mailto:maya_java@yahoo.com] 
> Sent: Thursday, February 01, 2007 12:52 PM
> To: user@struts.apache.org
> Subject: General question
>
> I have a struts based J2ee app which displays data from DB in the
> results.jsp page. For DB data access, I use a DAO which returns a
> serialized object. This serialized object, I set it to request object
> using setAttribute and retrieve it using tag i n jsp page. 
>
> My question is: if users try to open another window and do
> simultaneous tasks, how can I avoid same user from working in two or
> more different windows in a Struts based j2ee application ? 
>
> Any thoughts..
>
>
> ---------------------------------
> Everyone is raving about the all-new Yahoo! Mail beta.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>  
> ---------------------------------
> Finding fabulous fares is fun.
> Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: General question

Posted by Maya menon <ma...@yahoo.com>.
I am talking about two browser windows. 
  User A logs in in browser A and sees DB results in results.jsp page
   
  Then, User A open Browser B from Browser A. if he does that, he will see results in two pages, browser A and browser B. and then he will be able to do different edits from different windows. That should be prevented.

"Hartrich, James CTR USTRANSCOM J6" <Ja...@ustranscom.mil> wrote:
  Are you talking about different browser "windows" or just new "tabs" in
the same browser? Perhaps try an application scoped variable that tests
the current user, allowing only one instance of the user to operate the
app.

-----Original Message-----
From: Maya menon [mailto:maya_java@yahoo.com] 
Sent: Thursday, February 01, 2007 12:52 PM
To: user@struts.apache.org
Subject: General question

I have a struts based J2ee app which displays data from DB in the
results.jsp page. For DB data access, I use a DAO which returns a
serialized object. This serialized object, I set it to request object
using setAttribute and retrieve it using tag i n jsp page. 

My question is: if users try to open another window and do
simultaneous tasks, how can I avoid same user from working in two or
more different windows in a Struts based j2ee application ? 

Any thoughts..


---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



 
---------------------------------
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.

RE: General question

Posted by "Hartrich, James CTR USTRANSCOM J6" <Ja...@ustranscom.mil>.
Are you talking about different browser "windows" or just new "tabs" in
the same browser? Perhaps try an application scoped variable that tests
the current user, allowing only one instance of the user to operate the
app.

-----Original Message-----
From: Maya menon [mailto:maya_java@yahoo.com] 
Sent: Thursday, February 01, 2007 12:52 PM
To: user@struts.apache.org
Subject: General question

I have a struts based J2ee app which displays data from DB in the
results.jsp page. For DB data access, I use a DAO which returns a
serialized object. This serialized object, I set it to request object
using setAttribute and retrieve it using <bean:write> tag i n jsp page. 
   
  My question is: if users try to open another window and do
simultaneous tasks, how can I avoid same user from working in two or
more different windows in a Struts based j2ee application ? 
   
  Any thoughts..

 
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org