divvela
asked on
Forwarding to a new jsp without passing quesry string parameters
All :
Is there any to forward to a new JSP ( lets says Test2.jsp ) without passing Query string parameters from another JSP ( lets says Test1.jsp ).
But the limitation is
1) i should not use response.sendReidrect() method
2) The redirect should not pass the Query string parameters from original request to new JSP
I am trying to use RequestDispatcher.redirect (request,r esponse) , but it is passing the Query string parameters to new JSP.
Thanks in advance for your help.
Srinivas
Is there any to forward to a new JSP ( lets says Test2.jsp ) without passing Query string parameters from another JSP ( lets says Test1.jsp ).
But the limitation is
1) i should not use response.sendReidrect() method
2) The redirect should not pass the Query string parameters from original request to new JSP
I am trying to use RequestDispatcher.redirect
Thanks in advance for your help.
Srinivas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check this out, too: http://java.sun.com/products/jsp/syntax/1.2/syntaxref1212.html#15694
ASKER
Anthony,
<jsp:forward .......> is also passing Query string parameters from original request to New JSP. I don't want to pass the query string parameters to new JSP.
<jsp:forward .......> is also passing Query string parameters from original request to New JSP. I don't want to pass the query string parameters to new JSP.
I can't see any documented way around this (though I don't have as much experience with Servlets/JSP as some of the other experts here).
divvela, could you elaborate a bit about why you need to strip the parameters? Some insight might allow one of us to see a different way of approaching the problem.
divvela, could you elaborate a bit about why you need to strip the parameters? Some insight might allow one of us to see a different way of approaching the problem.
ASKER
jimmack,
I have two JSP's Test1.jsp and Test2.jsp. We will get a request to Test1.jsp with some query string parameters
like this http://server/test1.jsp?par1=1&par2=2....etc
Whenever one of the QueryString parameter(par1,par2 etc....) values are not in the form we expect our JSP will throw ILLEGALARGUMENTEXPECTION . Now what want todo is,
whenever we get the ILLEGALARGUMENTEXPECTION expection because of those query string values we want to redirect it to a Test2.jsp without Querystring values.
I can do it using response.sendRedirect(). But our code somehow does not allow todo this.
So i need a way to redirect it to Test2.jsp from Test1.jsp by stripping off QUery string parameters . Hope i have explained it in a better way. Let me know if you have further more questions .. Thanks you very much for your response.
Srinivas
I have two JSP's Test1.jsp and Test2.jsp. We will get a request to Test1.jsp with some query string parameters
like this http://server/test1.jsp?par1=1&par2=2....etc
Whenever one of the QueryString parameter(par1,par2 etc....) values are not in the form we expect our JSP will throw ILLEGALARGUMENTEXPECTION . Now what want todo is,
whenever we get the ILLEGALARGUMENTEXPECTION expection because of those query string values we want to redirect it to a Test2.jsp without Querystring values.
I can do it using response.sendRedirect(). But our code somehow does not allow todo this.
So i need a way to redirect it to Test2.jsp from Test1.jsp by stripping off QUery string parameters . Hope i have explained it in a better way. Let me know if you have further more questions .. Thanks you very much for your response.
Srinivas
The query string will appear as this
http://server/test1.jsp?par1=1&par2=2....etc
if your <form method="get">. Use "post" instead.
http://server/test1.jsp?par1=1&par2=2....etc
if your <form method="get">. Use "post" instead.
ASKER
anthony,
The request from a software on the client machine. Its not a website . So i cannot change it to Post method.
Srinivas
The request from a software on the client machine. Its not a website . So i cannot change it to Post method.
Srinivas
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you don't want the Client to interact with your JSP you can also do this
Test1.jsp
..........
Your JSP CODE
.......
<HTML>
<HEAD>
</HEAD>
<BODY>
<P> Please Wait..... </P>
<SCRIPT>
top.location.href="test2.j sp"
</SCRIPT>
</BODY>
</HTML>
This will call Test2.jsp without any parameters and and without client inteeact.
But as Kennethxu says I don't know why you don't want to make a response.sendRedirect....
Javier
Test1.jsp
..........
Your JSP CODE
.......
<HTML>
<HEAD>
</HEAD>
<BODY>
<P> Please Wait..... </P>
<SCRIPT>
top.location.href="test2.j
</SCRIPT>
</BODY>
</HTML>
This will call Test2.jsp without any parameters and and without client inteeact.
But as Kennethxu says I don't know why you don't want to make a response.sendRedirect....
Javier