You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Alfors <pe...@irista.com> on 2001/02/01 17:12:11 UTC

session ids cont...

I.E. 5.0 and 5.5 generate unique session ids for each simultaneous
browser session.  However, both Netscape 4.7 and Netscape 6 return the
same Id.

I dont think that URL-rewriting will help in this situation.  If I
understand URL-rewriting correctly, all that is happening is that the
session id is being tacked on the end of the request URL.

Has anyone else run into this problem (and hopefully come up with a
solution?)

One alternative is to generate my own session object with a unique Id
the frist time the user makes a request.  Then the action controller
could manage the sessions, while the pages use URL-rewriting to notify
the action controller which session to use.

I don't particularly care for this solution, so I am hoping that I am
over-looking something simple.  :)

Pete

Re: session ids cont...

Posted by Maya Muchnik <mm...@pumatech.com>.
It was posted as a Subject : "what starts session?", Date: Wed, 24 Jan 2001
16:07:49 -0800 (PST) and  responses were followed.


"Steven D. Wilkinson" wrote:

> >
> > In taglibs-user@jakarta.apache.org this issue was discussed (why and when
> > IE supports different sessionID, and Netscape - not). The main thing is,
> > Netscape is reading any cookies from one file, IE - from different files.
>
> Do you have a reference to said article?  If not how about the subject and date?
> Hum... IE and Netscape sharing the same id?  I never thought they could.  I
> guess I already realized that they store cookies in different files.  Is that
> what was being asked?
>
> Steve


Re: Performance Issues with Struts

Posted by Wong Kok Wai <wo...@yahoo.com>.
Tag instance creation aside, I don't see how a smart
JSP page compiler can optimise away the method calls
to the tag: Looking at page 107 of the JSP 1.1 specs,
it is obvious there are alot of overhead for using a
tag. Don't get me wrong: I love tag lib in general,
especially Struts, which make it possible to
componentise the web tier. However, IHMO tag is not
suitable for all cases and a developer has to choose
to use them selectively.

--- "Craig R. McClanahan"
<Cr...@eng.sun.com> wrote:
> 
> As above, you are starting from an incorrect
> assumption about tag instance
> creation.  A smarter JSP page compiler will do a
> much better job than current
> implementations do -- and this will be a particular
> area of focus in Tomcat
> 4.0 as time goes on.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/

Re: Performance Issues with Struts

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Rajan Gupta wrote:

> Has anybody used Struts in a largescale application and witnessed
> performance issues. It seems to me that the cost of creating & destroying
> tags in a JSP page would create a lot of overhead on the JVM.

There is no requirement that custom tag instances be created and destroyed
every time.  In fact, the spec has a lot of explicit stuff to enable pooling
of custom tag instances that have the same set of attribute values
specified.  Many servlet containers (including Tomcat) do not yet take
advantage of this, and generate pretty stupid code.

One other thing to note -- the overhead cost of object creation and
destruction varies by VM, but in general is *substantially* lower in modern
1.2 and 1.3 VMs, so the whole issue has less performance impact than it used
to.

> By putting
> all HTML elements as tags would there be not a significant overhead of
> creating & destroying the tags. Of course the destroying would be handled
> by the garbage collector, but that could get significant.
> If all HTML code are tags, simple IF-ELSE statements are also tags and
> typically you could have more than 2-5 IF statements in a page.
>

As above, you are starting from an incorrect assumption about tag instance
creation.  A smarter JSP page compiler will do a much better job than current
implementations do -- and this will be a particular area of focus in Tomcat
4.0 as time goes on.

>
> Is there some type of optimization built in struts to handle it or I am
> missing something in my understanding.
>
> Thx in advance for your responses.
> Rajan
>

Craig McClanahan



Re: Performance Issues with Struts

Posted by Wong Kok Wai <wo...@yahoo.com>.
Actually what you've described applies for any tag
lib. My approach is use Struts (or any tag lib)
selectively. For example, I would use <html:form> tag
but use HTML for the input elements. Instead of using
<bean:write>, I would use scriptlets to print the
information. Same goes for tags like
<logic:ifPresent>, <logic:ifNotPresent>, etc...


--- Rajan Gupta <rg...@yahoo.com> wrote:
> Has anybody used Struts in a largescale application
> and witnessed
> performance issues. It seems to me that the cost of
> creating & destroying
> tags in a JSP page would create a lot of overhead on
> the JVM. By putting
> all HTML elements as tags would there be not a
> significant overhead of
> creating & destroying the tags. Of course the
> destroying would be handled
> by the garbage collector, but that could get
> significant.
> If all HTML code are tags, simple IF-ELSE statements
> are also tags and
> typically you could have more than 2-5 IF statements
> in a page.
> 
> Is there some type of optimization built in struts
> to handle it or I am
> missing something in my understanding.
> 
> Thx in advance for your responses.
> Rajan
> 
> 


__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

forms with arrays

Posted by John Hunt <te...@yahoo.com>.
Hi
I have a variable number of combo,text pairs ( like
name value pairs ).
If I use struts form, it would lead me to have
variable number of calls if I have a direct mapping
with the input fields.
So I want to use arrays. I want to associate the name
value pairs ( combo to text ). From the form bean
perspective how can I recognize the mapping? As to
which combos the user chose because they go under the
same name as I am using an array.
Thanks
Hunt

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Performance Issues with Struts

Posted by Rajan Gupta <rg...@yahoo.com>.
Has anybody used Struts in a largescale application and witnessed
performance issues. It seems to me that the cost of creating & destroying
tags in a JSP page would create a lot of overhead on the JVM. By putting
all HTML elements as tags would there be not a significant overhead of
creating & destroying the tags. Of course the destroying would be handled
by the garbage collector, but that could get significant.
If all HTML code are tags, simple IF-ELSE statements are also tags and
typically you could have more than 2-5 IF statements in a page.

Is there some type of optimization built in struts to handle it or I am
missing something in my understanding.

Thx in advance for your responses.
Rajan




__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: session ids cont...

Posted by "Steven D. Wilkinson" <st...@acm.org>.
> 
> In taglibs-user@jakarta.apache.org this issue was discussed (why and when
> IE supports different sessionID, and Netscape - not). The main thing is,
> Netscape is reading any cookies from one file, IE - from different files.

Do you have a reference to said article?  If not how about the subject and date?
Hum... IE and Netscape sharing the same id?  I never thought they could.  I
guess I already realized that they store cookies in different files.  Is that
what was being asked?  

Steve

Re: session ids cont...

Posted by Maya Muchnik <mm...@pumatech.com>.
In taglibs-user@jakarta.apache.org this issue was discussed (why and when
IE supports different sessionID, and Netscape - not). The main thing is,
Netscape is reading any cookies from one file, IE - from different files.

Peter Alfors wrote:

> I.E. 5.0 and 5.5 generate unique session ids for each simultaneous
> browser session.  However, both Netscape 4.7 and Netscape 6 return the
> same Id.
>
> I dont think that URL-rewriting will help in this situation.  If I
> understand URL-rewriting correctly, all that is happening is that the
> session id is being tacked on the end of the request URL.
>
> Has anyone else run into this problem (and hopefully come up with a
> solution?)
>
> One alternative is to generate my own session object with a unique Id
> the frist time the user makes a request.  Then the action controller
> could manage the sessions, while the pages use URL-rewriting to notify
> the action controller which session to use.
>
> I don't particularly care for this solution, so I am hoping that I am
> over-looking something simple.  :)
>
> Pete


Re: session ids cont...

Posted by Jannik Nørgaard Steen <js...@digitalzone.dk>.
I have just tested our web application prototype on Netscape 4.7 and there
are no problems
with URL-rewriting and jessionid's.
The servlet container (Resin 1.1.5) picks the right sessions for the right
clients.

We use a mix of hardcoded with dynamic jsessionid insertion, Struts
<html:link> and Javascript generated links on our pages and it works fine.



The following principles were used:

- Hardcoded links: <a
href='http://host/execute/action;jsessionid=<%=session.getId()%>'>Text</a>

- Struts: well it does it by itself.

- JavaScript: call a function with parameter jessionid obtained from session
object and use it to build link. Example:

 function openInfoWin(host, oid, sessionID)
 {
  var hostURL = "http://"+host+";jsessionid="+sessionID+"?oid="+oid;
  window.open(hostURL, "InfoWin", "scrollbars=no, resizable=yes, width=600,
height=800");
 }


We always put the jsessionid right after the URL since it is a path
parameter and *not* a request parameter.
Remember to use semicolon as divider or else it will not be picked up.

Could you provide an example of your nonworking JSP or Java code ?

----- Original Message -----
From: "Peter Alfors" <pe...@irista.com>
To: "struts-user" <st...@jakarta.apache.org>
Sent: Thursday, February 01, 2001 5:12 PM
Subject: session ids cont...


> I.E. 5.0 and 5.5 generate unique session ids for each simultaneous
> browser session.  However, both Netscape 4.7 and Netscape 6 return the
> same Id.
>
> I dont think that URL-rewriting will help in this situation.  If I
> understand URL-rewriting correctly, all that is happening is that the
> session id is being tacked on the end of the request URL.
>
> Has anyone else run into this problem (and hopefully come up with a
> solution?)
>
> One alternative is to generate my own session object with a unique Id
> the frist time the user makes a request.  Then the action controller
> could manage the sessions, while the pages use URL-rewriting to notify
> the action controller which session to use.
>
> I don't particularly care for this solution, so I am hoping that I am
> over-looking something simple.  :)
>
> Pete
>


Re: session ids cont...

Posted by Peter Alfors <pe...@irista.com>.

"Steven D. Wilkinson" wrote:

> Peter,
> > I.E. 5.0 and 5.5 generate unique session ids for each simultaneous
> > browser session.  However, both Netscape 4.7 and Netscape 6 return the
> > same Id.

>
> What do you mean by simultaneous browser sessions.  If you create a new window
> CTL+N in IE5.0 you get the same id. (Is this simultaneous?)

If I start Netscape 4.7 from my desktop (2 instances of it) and go to the same page
in my webapp.  I can printout the session id on the screen.  Both browser instances
will have the same session id.
However, two instances of IE 5.0 will have different IDs.  (this is what I want).

>
>
> I thought that both netscape and IE generate new id's if you launch the browser
> from the desktop.  I also thought both netscape and IE use the same id's if you
> create a new window from an existing window.
>

I haven't tried creating a new window from either netscape or IE.  But if this will
cause both windows to have the same session, then this is something I need to
handle also.

>
> I use IE5.0 for my testing and this is that way it works, at least with the
> build from 01-28-2001.  I can create a new browser window from the current one
> and both have the same jsessionid.
>

I am using IE 5.0 & 5.5 and Netscape 4.7 & 6 for testing.

>
> I'm using Tomcat4.0-m5 for my testing.  I don't know what you are using.
>

I am using Tomcat 3.2

>
> Are you using the <html:link> for all of your links?  And are you using
> <html:action> for all of your actions?  I found that if you don't you will have
> a problem.  It's either all or nothing.  If it's nothing your on your own.  At
> least that has been my experience.
>

Right now I am NOT encoding my links.  However, if my assumptions are correct...
Encoding the links will not help me.  Encoding adds the session id as a query
string to the links.  If the two windows have the same session, then the links (in
each window) will still use the same session.

>
> Steve

Here is the problem I am running across.   I use beans that store information
pertaining to a specific record in the database.  When a user selects an item from
a list, the bean is populated and placed in the session.  I put it in the session
because subsequent pages require this beans information as well.  However, if the
user has two browser windows running, sharing a session, it is possible for the
user to update the data for the bean in one window, and then retrieve incorrect
information in the other window.

It is very probable that a user will want to have multiple browsers running so that
he/she can compare data.

I hope you can all follow that.  I don't think that I described it very well.


Re: session ids cont...

Posted by "Steven D. Wilkinson" <st...@acm.org>.
Peter,
> I.E. 5.0 and 5.5 generate unique session ids for each simultaneous
> browser session.  However, both Netscape 4.7 and Netscape 6 return the
> same Id.

What do you mean by simultaneous browser sessions.  If you create a new window
CTL+N in IE5.0 you get the same id. (Is this simultaneous?) 

I thought that both netscape and IE generate new id's if you launch the browser
from the desktop.  I also thought both netscape and IE use the same id's if you
create a new window from an existing window.  

I use IE5.0 for my testing and this is that way it works, at least with the
build from 01-28-2001.  I can create a new browser window from the current one
and both have the same jsessionid.  

I'm using Tomcat4.0-m5 for my testing.  I don't know what you are using.

Are you using the <html:link> for all of your links?  And are you using
<html:action> for all of your actions?  I found that if you don't you will have
a problem.  It's either all or nothing.  If it's nothing your on your own.  At
least that has been my experience.  

Steve