0

Session & Servlet

asked 2007-04-11 13:44:37 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4255182

By: nobody1

Hello,
i want to download a *.cvs File after click a button, but the GUI should be static. So i try this:
void getFile(){
Window win = new Window();
win.setParent(rootWindow);
win.setMode("popup");
win.doPopup();
win.setVisible(false);

Iframe iF = new Iframe();
iF.setParent(win);

Sessions.getCurrent().setAttribute("attrName",Java.Object);
Sessions.getCurrent().setAttribute("attrName","ObjectTyp");
iF.setSrc("http://localhost:8080/Servlet");
}

this is working with Session in Servlet, but if i'll change the following:
iF.setSrc("http://192.169.0.1:8080/Servlet");
it won't work the Servlet doesn't get any Attributes.

The Servlet has the Following structure in the doGet(HttpServletRequest request, HttpServletResponse response) Method:

response.setContentType("application/x-download");
response.setHeader("Content-Disposition","attachment;filename="file.csv");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();

out.print(session.getAttribute("attrName"));
out.print(session.getAttribute("attrName1"));
}

I don't know why it works with the http://localhost, but never with the IP form Server

I hope someone can help me

-----
nobody1

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2007-04-11 14:19:06 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4255232

By: nobody1

I've logged something with the code above and the chaning IP's:
The SessionCreationTime is by http://localhost:8080/WebApp/Servlet the same
CreationTime:1176290578062
CreationTime:1176290578062
CreationTime:1176290578062

but if I call http://127.0.0.1/WebApp/Servlet or http://192.168.0.1/WebApp/Servlet
different:
CreationTime:1176301009140
CreationTime:1176301019687

So the result is that the session is termianted, but why it won't terminate by localhost?



link publish delete flag offensive edit

answered 2007-04-12 04:45:43 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4256460

By: jumperchen

I think that any difference domain name is different for webapp server.

Jumper

link publish delete flag offensive edit

answered 2007-04-12 05:47:46 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4256488

By: nobody1

thx it work's. The problem was that my pc is server and client together and so i've called locelhost but when i call IP it works fine

nobody1

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-04-11 13:44:37 +0800

Seen: 279 times

Last updated: Apr 12 '07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More