HttpServletResponse sending Parameter to a JSP?

D

Duke

public class Portal extends HttpServlet{
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
String name="Duke";
response.sendRedirect("show.jsp");
}
}

in the abow servlet Howto send the name variable as the parameter to
the show.jsp
Thank
DUKE
 
A

Arne Vajhøj

Duke said:
public class Portal extends HttpServlet{
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
String name="Duke";
response.sendRedirect("show.jsp");
}
}

in the abow servlet Howto send the name variable as the parameter to
the show.jsp

For redirect you will need to put in the URL.

If you used forward then you could have just stored in in
the request object.

Arne
 
A

Arne Vajhøj

Arne said:
For redirect you will need to put in the URL.

If you used forward then you could have just stored in in
the request object.

BTW, if your app supports login you should use response.encodeURL !

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top