You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Steen Bjerre Andersen <st...@bjerre-andersen.dk> on 2002/09/22 01:20:16 UTC

Redirecting in jsp

Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried  response.sendRedirect(url) with no luck,
then I tried

<%@ page import = "org.apache.turbine.util.RunData" %>

<%
String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&amp;hl=da&amp;lr=");

	}
%>
<html> .....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Redirecting in jsp

Posted by Steen Bjerre Andersen <st...@bjerre-andersen.dk>.
I found another solution. I've made a jsp portlet that just contains an
iframe and nothing else. The src for the iframe is my search page
(soeg.jsp). Soeg.jsp is placed outside Jetspeed in another webapplication
under Tomcat. Now redirecting works within the jsp portlet.

-Steen

-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 24. september 2002 23:31
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


I see what you mean. I do rem running into that problem sometime ago and I
could fnd no soultion so I was forced to use...

<META HTTP-EQUIV=Refresh CONTENT="0; URL=<%= next_url %>"/>

This will work... Not the 'java' soultion but it works.

Good Luck.

-----Original Message-----
From: Steen Bjerre Andersen [mailto:steen@bjerre-andersen.dk]
Sent: Tuesday, September 24, 2002 3:06 PM
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


Ok here it is. I commented out all redirects, but one. I've also tried
<jsp:forward...> instead of redirect.

When I use action="" in the form, the form is submitted to soeg.jsp itself.
I can request the input fields and print them with out.println. When I use
action="<jetspeed:link template="soeg.jsp" />"> I have no idea as to where
the form is submitted, I get a blank page, with the jetspeed top and side
bars. I get the IllegalState exception no matter what the action is set to
in the form.

soeg.jsp is placed in WEB-INF/templates/jsp/portlets/html/


I'm running Jetspeed 1.4b1 under Tomcat 4.0.

Regards
-Steen




-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 24. september 2002 00:00
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


Humm, that means that somwhere in your code you were already trying to a
redirect...

Why dont you send the entire code content...

you cant use <jsp:forward page="<%= next_url %>"/>

and some other form of redirect as well


and if worse comes to worse try...

<META HTTP-EQUIV=Refresh CONTENT="0; URL=<%= next_url %>"/>

-----Original Message-----
From: Steen Bjerre Andersen [mailto:steen@bjerre-andersen.dk]
Sent: Monday, September 23, 2002 4:57 PM
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


That does not help. I still get  "IllegalStateException: Cannot forward
after response has been committed".
It seems like that I cannot use the response object from the RunData object.
When I try:

HttpServletResponse resp = rundata.getResponse();
resp.isCommited();

it returns true. Maybe it is because I submit my form to the jsp page
itself?

regards
-Steen


-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 23. september 2002 23:27
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


I always use....

String next_url = "http://www.google.com/search?q=" + soeg + "&hl=da&lr=";

<jsp:forward page="<%= next_url %>"/>

-----Original Message-----
From: Jeffrey Owens [mailto:jogoat99@yahoo.com]
Sent: Monday, September 23, 2002 4:24 PM
To: Jetspeed Users List
Subject: Re: Redirecting in jsp



I am also having the same problem. Is this a bug or are we doing something
wrong?
 Steen Bjerre Andersen wrote:Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried response.sendRedirect(url) with no luck,
then I tried



String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&hl=da&lr=");

	}
%>
.....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail:
For additional commands, e-mail:


Jeffrey Owens


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Redirecting in jsp

Posted by Anthony Smith <an...@fedex.com>.
I see what you mean. I do rem running into that problem sometime ago and I
could fnd no soultion so I was forced to use...

<META HTTP-EQUIV=Refresh CONTENT="0; URL=<%= next_url %>"/>

This will work... Not the 'java' soultion but it works.

Good Luck.

-----Original Message-----
From: Steen Bjerre Andersen [mailto:steen@bjerre-andersen.dk]
Sent: Tuesday, September 24, 2002 3:06 PM
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


Ok here it is. I commented out all redirects, but one. I've also tried
<jsp:forward...> instead of redirect.

When I use action="" in the form, the form is submitted to soeg.jsp itself.
I can request the input fields and print them with out.println. When I use
action="<jetspeed:link template="soeg.jsp" />"> I have no idea as to where
the form is submitted, I get a blank page, with the jetspeed top and side
bars. I get the IllegalState exception no matter what the action is set to
in the form.

soeg.jsp is placed in WEB-INF/templates/jsp/portlets/html/


I'm running Jetspeed 1.4b1 under Tomcat 4.0.

Regards
-Steen




-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 24. september 2002 00:00
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


Humm, that means that somwhere in your code you were already trying to a
redirect...

Why dont you send the entire code content...

you cant use <jsp:forward page="<%= next_url %>"/>

and some other form of redirect as well


and if worse comes to worse try...

<META HTTP-EQUIV=Refresh CONTENT="0; URL=<%= next_url %>"/>

-----Original Message-----
From: Steen Bjerre Andersen [mailto:steen@bjerre-andersen.dk]
Sent: Monday, September 23, 2002 4:57 PM
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


That does not help. I still get  "IllegalStateException: Cannot forward
after response has been committed".
It seems like that I cannot use the response object from the RunData object.
When I try:

HttpServletResponse resp = rundata.getResponse();
resp.isCommited();

it returns true. Maybe it is because I submit my form to the jsp page
itself?

regards
-Steen


-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 23. september 2002 23:27
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


I always use....

String next_url = "http://www.google.com/search?q=" + soeg + "&hl=da&lr=";

<jsp:forward page="<%= next_url %>"/>

-----Original Message-----
From: Jeffrey Owens [mailto:jogoat99@yahoo.com]
Sent: Monday, September 23, 2002 4:24 PM
To: Jetspeed Users List
Subject: Re: Redirecting in jsp



I am also having the same problem. Is this a bug or are we doing something
wrong?
 Steen Bjerre Andersen wrote:Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried response.sendRedirect(url) with no luck,
then I tried



String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&hl=da&lr=");

	}
%>
.....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail:
For additional commands, e-mail:


Jeffrey Owens


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Redirecting in jsp

Posted by Steen Bjerre Andersen <st...@bjerre-andersen.dk>.
Ok here it is. I commented out all redirects, but one. I've also tried
<jsp:forward...> instead of redirect.

When I use action="" in the form, the form is submitted to soeg.jsp itself.
I can request the input fields and print them with out.println. When I use
action="<jetspeed:link template="soeg.jsp" />"> I have no idea as to where
the form is submitted, I get a blank page, with the jetspeed top and side
bars. I get the IllegalState exception no matter what the action is set to
in the form.

soeg.jsp is placed in WEB-INF/templates/jsp/portlets/html/


I'm running Jetspeed 1.4b1 under Tomcat 4.0.

Regards
-Steen




-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 24. september 2002 00:00
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


Humm, that means that somwhere in your code you were already trying to a
redirect...

Why dont you send the entire code content...

you cant use <jsp:forward page="<%= next_url %>"/>

and some other form of redirect as well


and if worse comes to worse try...

<META HTTP-EQUIV=Refresh CONTENT="0; URL=<%= next_url %>"/>

-----Original Message-----
From: Steen Bjerre Andersen [mailto:steen@bjerre-andersen.dk]
Sent: Monday, September 23, 2002 4:57 PM
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


That does not help. I still get  "IllegalStateException: Cannot forward
after response has been committed".
It seems like that I cannot use the response object from the RunData object.
When I try:

HttpServletResponse resp = rundata.getResponse();
resp.isCommited();

it returns true. Maybe it is because I submit my form to the jsp page
itself?

regards
-Steen


-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 23. september 2002 23:27
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


I always use....

String next_url = "http://www.google.com/search?q=" + soeg + "&hl=da&lr=";

<jsp:forward page="<%= next_url %>"/>

-----Original Message-----
From: Jeffrey Owens [mailto:jogoat99@yahoo.com]
Sent: Monday, September 23, 2002 4:24 PM
To: Jetspeed Users List
Subject: Re: Redirecting in jsp



I am also having the same problem. Is this a bug or are we doing something
wrong?
 Steen Bjerre Andersen wrote:Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried response.sendRedirect(url) with no luck,
then I tried



String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&hl=da&lr=");

	}
%>
.....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail:
For additional commands, e-mail:


Jeffrey Owens


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

RE: Redirecting in jsp

Posted by Anthony Smith <an...@fedex.com>.
Humm, that means that somwhere in your code you were already trying to a
redirect...

Why dont you send the entire code content...

you cant use <jsp:forward page="<%= next_url %>"/>

and some other form of redirect as well


and if worse comes to worse try...

<META HTTP-EQUIV=Refresh CONTENT="0; URL=<%= next_url %>"/>

-----Original Message-----
From: Steen Bjerre Andersen [mailto:steen@bjerre-andersen.dk]
Sent: Monday, September 23, 2002 4:57 PM
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


That does not help. I still get  "IllegalStateException: Cannot forward
after response has been committed".
It seems like that I cannot use the response object from the RunData object.
When I try:

HttpServletResponse resp = rundata.getResponse();
resp.isCommited();

it returns true. Maybe it is because I submit my form to the jsp page
itself?

regards
-Steen


-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 23. september 2002 23:27
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


I always use....

String next_url = "http://www.google.com/search?q=" + soeg + "&hl=da&lr=";

<jsp:forward page="<%= next_url %>"/>

-----Original Message-----
From: Jeffrey Owens [mailto:jogoat99@yahoo.com]
Sent: Monday, September 23, 2002 4:24 PM
To: Jetspeed Users List
Subject: Re: Redirecting in jsp



I am also having the same problem. Is this a bug or are we doing something
wrong?
 Steen Bjerre Andersen wrote:Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried response.sendRedirect(url) with no luck,
then I tried



String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&hl=da&lr=");

	}
%>
.....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail:
For additional commands, e-mail:


Jeffrey Owens


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Redirecting in jsp

Posted by Steen Bjerre Andersen <st...@bjerre-andersen.dk>.
That does not help. I still get  "IllegalStateException: Cannot forward
after response has been committed".
It seems like that I cannot use the response object from the RunData object.
When I try:

HttpServletResponse resp = rundata.getResponse();
resp.isCommited();

it returns true. Maybe it is because I submit my form to the jsp page
itself?

regards
-Steen


-----Original Message-----
From: Anthony Smith [mailto:anthony.smith@fedex.com]
Sent: 23. september 2002 23:27
To: Jetspeed Users List
Subject: RE: Redirecting in jsp


I always use....

String next_url = "http://www.google.com/search?q=" + soeg + "&hl=da&lr=";

<jsp:forward page="<%= next_url %>"/>

-----Original Message-----
From: Jeffrey Owens [mailto:jogoat99@yahoo.com]
Sent: Monday, September 23, 2002 4:24 PM
To: Jetspeed Users List
Subject: Re: Redirecting in jsp



I am also having the same problem. Is this a bug or are we doing something
wrong?
 Steen Bjerre Andersen wrote:Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried response.sendRedirect(url) with no luck,
then I tried



String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&hl=da&lr=");

	}
%>
.....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail:
For additional commands, e-mail:


Jeffrey Owens


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Redirecting in jsp

Posted by Anthony Smith <an...@fedex.com>.
I always use....

String next_url = "http://www.google.com/search?q=" + soeg + "&hl=da&lr=";

<jsp:forward page="<%= next_url %>"/>

-----Original Message-----
From: Jeffrey Owens [mailto:jogoat99@yahoo.com]
Sent: Monday, September 23, 2002 4:24 PM
To: Jetspeed Users List
Subject: Re: Redirecting in jsp



I am also having the same problem. Is this a bug or are we doing something
wrong?
 Steen Bjerre Andersen wrote:Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried response.sendRedirect(url) with no luck,
then I tried



String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&hl=da&lr=");

	}
%>
.....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail:
For additional commands, e-mail:


Jeffrey Owens


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Redirecting in jsp

Posted by Jeffrey Owens <jo...@yahoo.com>.
I am also having the same problem. Is this a bug or are we doing something wrong?
 Steen Bjerre Andersen wrote:Hi

I'm trying to do a redirect in a jsp page, but I can't get it to work. Can
somebody help me out? I've tried response.sendRedirect(url) with no luck,
then I tried



String maskine=request.getParameter("mask");
String soeg = request.getParameter("soeg");

RunData data = (RunData)request.getAttribute("rundata");

if ("google".equals(maskine)) {
		data.setRedirectURI("http://www.google.com/search?q=" +
			soeg + "&hl=da&lr=");

	}
%>
.....




I can get the values in the hidden fields in my form, but the redirect will
not work.


Regards

-Steen


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 


Jeffrey Owens


---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!