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 "Geelen van, E (Edwin)" <E....@rf.rabobank.nl> on 2001/11/21 09:43:34 UTC

Action attribute of FORM tag - how to reach a portlet?

Hi,

My first post here. I'm developing my first portlets, one of which uses a
form. The form should send it's fields to the same portlet. Now I'm
wondering what to put in the 'action' attribute of the form tag. I've found
how to use JSP, but overhere we use XML/XSLT for the interface definitions
and don't want to use JSP. So, how do I fill this field in the portlet
itself?
I'm now using:

PortletURI url = res.createURI();

This works insofar as the portlet is displayed after the submit, and the
field in present in the URL. But I can't read the field in my Java code. My
complete service method:

public void service(PortletRequest req, PortletResponse res) throws
PortletException, IOException {
	PrintWriter writer = res.getWriter();
	veldje = req.getParameter("invoer");
	PortletURI url = res.createURI();
	writer.println("<form method=\"PUT\" action=\""+url+"\">");
	writer.println(formContent); 		//**** variable contains
form fields
	writer.println("<br><input type=\"submit\">");
	writer.println("</form>");
	writer.println("URL = ["+url+"]<br>");
	writer.println("Field is ["+veldje+"]");
}

What am I doing wrong?

Edwin


================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en 
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en 
de afzender direct te informeren door het bericht te retourneren. 
================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.



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


Re: Action attribute of FORM tag - how to reach a portlet?

Posted by ZHU Jia <ji...@ains.at>.
Just figured that out myself, by default, you should post to
"/jetspeed/portal/NameOfYourPortletInTheRegistry".
Make sure you use the registered name and not the class name.
And in the getContent(RunData runData) method you can do:

        ParameterParser params = runData.getParameters();
        HttpServletRequest req = params.getRequest();

>From there on just use the request object as usual (Servlet/JSP).
Maybe there's other better ways to do that, I'm a newbie myself, this is
just what I found out.

hope that helps!
regards
ZHU Jia

----- Original Message -----
From: "Geelen van, E (Edwin)" <E....@rf.rabobank.nl>
To: "'Jetspeed Users List'" <je...@jakarta.apache.org>
Sent: Wednesday, November 21, 2001 9:43 AM
Subject: Action attribute of FORM tag - how to reach a portlet?


> Hi,
>
> My first post here. I'm developing my first portlets, one of which uses a
> form. The form should send it's fields to the same portlet. Now I'm
> wondering what to put in the 'action' attribute of the form tag. I've
found
> how to use JSP, but overhere we use XML/XSLT for the interface definitions
> and don't want to use JSP. So, how do I fill this field in the portlet
> itself?
> I'm now using:
>
> PortletURI url = res.createURI();
>
> This works insofar as the portlet is displayed after the submit, and the
> field in present in the URL. But I can't read the field in my Java code.
My
> complete service method:
>
> public void service(PortletRequest req, PortletResponse res) throws
> PortletException, IOException {
> PrintWriter writer = res.getWriter();
> veldje = req.getParameter("invoer");
> PortletURI url = res.createURI();
> writer.println("<form method=\"PUT\" action=\""+url+"\">");
> writer.println(formContent); //**** variable contains
> form fields
> writer.println("<br><input type=\"submit\">");
> writer.println("</form>");
> writer.println("URL = ["+url+"]<br>");
> writer.println("Field is ["+veldje+"]");
> }
>
> What am I doing wrong?
>
> Edwin
>
>
> ================================================
> De informatie opgenomen in dit bericht kan vertrouwelijk zijn en
> is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht
> onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en
> de afzender direct te informeren door het bericht te retourneren.
> ================================================
> The information contained in this message may be confidential
> and is intended to be exclusively for the addressee. Should you
> receive this message unintentionally, please do not use the contents
> herein and notify the sender immediately by return e-mail.
>
>
>
> --
> 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>