[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    RE: How to use a CONTEXT value inside the action.xml to specify forwarding to a page in a context (m
From:       "Kevin Duffey" <kduffey () buymedia ! com>
Date:       2000-07-25 4:08:39
[Download RAW message or body]

On that note...

What if my site is set up like so...I have a web app for apples, oranges and
bananas. All three use the same /www root files (jsp pages). In those jsp
pages I have some scriplet code that basically says if the path has a
/apple/ in it, display this. If it has a /oranges/ in it, do this and if it
has /bananas/ in it, display this instead. All 3 web apps use the same "jsp"
pages, so each page only needs to be changed once for all 3 web-apps to be
affected. However, each app needs its own context to make absolutley sure
incase a use is on /bananans/ and hits the BACK button into a previous page,
/apples/, that because they use the same JSP pages data is not
"cross-talked" across the pages for different contexts. Its hard to explain,
but on our site we have 3 types, each needing separate "private" data pools
for each client (3 sessions for each one login), but all 3 using the same
set of pages since they are identically displayed (all 3 apps are very
similar in nature with slight differences in displays depending on the
specific app).


I want links to reflect the specific app they are in. If they switch to
/apples/, all links show /apples/ instead of say /oranges/ or /bananas/.
That is easy to do. In my JSP pages I have them all include the same one
header.inc file (inline it). In there, I have scriplet code that simply does
something like

<%
if( request.getRequestURI().indexOf("/apples/") >= 0 ) {
%>
<h1>APPLES</h1>
<% } else { %>
<h2>ORANAGES OR BANANAS</h2>
<% } %>

This is simple enough for displaying.

My main problem right now is not what clients need..they would only be
logged in to one of the 3. But our "admin" (customer support people really)
need to be logged in to all 3 of them at the same time, using 3 separate
windows. Because cookies from one machine limit the user to one browser
window (in terms of session data being stored via a cookie session id), I
decided to use 3 separate web apps, so that even though the one
client/browser returns the same one cookie id value, the server has 3
separate sessions, one in each context. So, on the admin site, I need to log
in the user one time, but really I need to create 3 separate contexts at one
time. I am doing this like so:

inside the login method I have:

URL url1 = new
URL("/apples/Login.do?command=3&LoginName=xxxx*LoginPassword=xxx");
url1.openConnection();
url1.getContent();

etc..

I do this for the other two as well, substituting /apples/ for /oranges/ and
/bananas/.

The method called by command==3 is:

someMethdo(HttpServletRequest request)
{
  request.getSession(true).setAttribute("ClientSession", someObject);
}

So now..the problem is, inside any page when I do /apples/page.jsp, the
object (someObject) should exist in the /apples/ web-app session for that
client..but it does not. I think the reason is the url1.getContent() is
either not sending the same cookie as the browser is, thus when I attempt to
use my browser "after" the login method creates the 3 contexts, the session
ID is invalid..and thus does not access the same context/session that was
created in the url1.getContent() call. Ofcourse, if I could manually set the
jsessionid cookie key that is used to the same cookie value the browser
would return (if thats possible), this might work.

So...I leave off with that. Any ideas?

Thanks.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic