aspose file tools*
The moose likes JSP and the fly likes ip and page context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "ip and page context" Watch "ip and page context" New topic
Author

ip and page context

Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
i have a JSP. i set an object in the page context as :

String lang = "en";
pageContext.setAttribute("lang", lang, PageContext.SESSION_SCOPE);

and later access this object. the problem is that when i access this JSP using the ip address of the server, the object is not stored in the page context. the access code throws null pointer exception. But when i access the code using the server name (localhost etc), everything works fine.

can some one please explain.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61622
    
  67

You're not storing anything in the page context. According to your code, you are storing it in the session. And different domains will each get their own session.
[ September 05, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
Originally posted by Bear Bibeault:
You're not storing anything in the page context. According to your code, you are storing it in the session. And different domains will each get their own session.

[ September 05, 2005: Message edited by: Bear Bibeault ]


i cud not understand. can u please explain in detail and give me the remedy.
Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
Originally posted by Bear Bibeault:
You're not storing anything in the page context. According to your code, you are storing it in the session. And different domains will each get their own session.

[ September 05, 2005: Message edited by: Bear Bibeault ]


also, i am accessing the code with the same domain and not diffrent domains...i.e. http://200.200.145.123/myApp and through the diffrent pages the object is not available
Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
i found the problem. at one place in my code i have hard coded the server name in the URL. ip and url dont work together.i.e when the first request is made by ip and the object is set in the page context, later in the session the object has to be accessed from withn the pages called with the ip and not server name. vice versa.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ip and page context