How to communicate with different web applications ? ? ? ?
1 Answer(s)      8 years ago
Posted in : JSP-Servlet


View Answers

July 2, 2008 at 6:48 PM

To send session details from one JSP page to another JSP page you have to use session.putValue() method and after putting value send this to another JSP page by response.encodeURL("show.jsp") and at another page you have to get this putValue() into any variable like "String name =(String)session.getValue("name");" and print or use this in your page and to have this functionality in your JSP application you have to add "<%@ page session="true" %>" in your both JSP pages.

your display.jsp would be like this:---
<%@ page session="true" %>
String name = "Kumar";
String url =response.encodeURL("show.jsp");
<a href='<%=url%>'>show.jsp</a>
show.jsp would be like this...

<%@ page session="true" %>

String name =(String)session.getValue("name");
out.println("Name value in session is "+name);

Related Tutorials/Questions & Answers: