Hi,
I'm having a page like below :

<html><head><body>
<FONT COLOR=RED SIZE=5>
<%@page import ="com.ui.CTransactionManager"%>
<%@page import ="com.ui.CUser"%>
<%
String UserId = request.getParameter("UserId");
CTransactionManager objmanager = new CTransactionManager();
CUser user = objmanager.getUser(UserId);
String m_staff_id = user.getStaffId();
out.print( "Staff Id : " +m_staff_id );
%>
</font></body></head></html>

here i want to pass the m_staff_id field to next page which i'm redirecting from here. Can any one advice how to achive this.

Recommended Answers

All 4 Replies

Use may use session, Jsp actions (forward,include), and simply a querystring for the same.

Can you please give as an example.

QueryString

<%
   String var="10";
   String url="page1.jsp?no=" + var;
   response.sendRedirect(url);
%>

code of page1.jsp should be,

<%
  String no=request.getParameter("no");
  ...
%>

Session,

<%
   session.setAttribute("name","Mr.X");
   response.sendRedirect("page2.jsp");
%>

code of page2.jsp will be,

<%
   String name=(String)session.getAttribute("name");
   ....
%>

Thank you so much. Its working fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.