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 "Wimmer, Matthias" <ma...@scr.siemens.com> on 2002/09/12 17:03:41 UTC

RE: Question about Jetspeed JSP/Portlet

Hi Erzhuan,

you read my posting about the improved JSP portlet, didn't you? 

So you retrieved my code, didn't you? This code for a portlet using JSP is
capable to display the portlet's content using a JavaServer page.
Additionally it is also able to react on action events. I implemented it in
the way the Velocity portlets work. 

So if your URL includes ?action=doSomething and you specified an action
inside of the portlet-entry the method doSomething() of the action object
should be executed. The action object is tied to the portlet entry like
that:
    <parameter name="action" value="portlets.MyAction"/>

Like that the class name for the action object is this one:
    org.apache.jetspeed.modules.actions.portlets.MyAction


There is another thing:
I think you cannot directly access the portlet through its JSP page. So
don't insert a link like:
    http://localhost/jetspeed/hello.jsp?action=doSomething

The link should be generated by the class PortletTemplateLink. In the
current version of Jetspeed this class is deprecated. But I don't know
anything about the new stuff.


hope that helps.

don't hesitate to contact me in case of further questions

Matt






> -----Original Message-----
> From: Mike Zhou [mailto:erzhuanzhou@yahoo.com]
> Sent: Wednesday, September 11, 2002 6:49 PM
> To: Wimmer, Matthias
> Cc: erzhuanzhou@yahoo.com
> Subject: RE: Question about Jetspeed JSP/Portlet
> 
> 
> Hi,
> 
> I've read your email in the jetspeed user list.
> 
> I created a simple JSP page and installed into
> Jetspeed following the instructions below:
> 
> <portlet-entry name="HelloJSP" hidden="false" type="ref" parent="JSP"
application="false">
>     <meta-info>
>         <title>HelloJSP</title>
>         <description>Simple JSP Portlet Example</description>
>     </meta-info>
>     <parameter name="template" value="hello.jsp" hidden="false"/>
>     <media-type ref="html"/>
> </portlet-entry>
>     
> It works fine for me. I would like to pass some action
> parameter to the jsp page from the portlet, do
> something like myJsp.jsp?action=doSomething. I can not
> find any doc on the subjust.
> 
> Do you have any suggestion?
> 
> Thank, Erzhuan
> 
> __________________________________________________
> Yahoo! - We Remember
> 9-11: A tribute to the more than 3,000 lives lost
> http://dir.remember.yahoo.com/tribute
> 

--
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!

Redirecting in jsp

Posted by Steen Bjerre Andersen <st...@bjerre-andersen.dk>.
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>