Andrew is right. Two very quick comments about your code. I noticed
you didn't have the <portlet:actionURL> tag in your code. You must use
this tag, or you must generate the portlet urls from the Portlet .java
code. You can not just submit back to "yourself" (the current page) as
that is not allowed by the specification.
Second, all forms in Portlets must use the "post" method. And once you
use the post method, you'll need to implement a "processAction" method
if you want the parameters from the post to be visible to the render.
However, you should make sure you fundamentally understand the two phase
nature of portlets, and not just 'pass through' all the work to the
render. Any "state changing" behavior should be done in processAction.
I highly recommend reviewing the article I wrote concerning the
differences between Servlet and Portlet development.
http://support.unicon.net/node/586
If I find some time, I will try to write a new blog post or article for
the same web site, that shows a simple version of a portlet that uses a
form. So far I only have the 'hello world' version that has no forms
documented at:
http://support.unicon.net/node/618
---- Cris J H
Deeþàn Chakravarthÿ wrote:
Hello All,
I have trouble in accessing post variable sent by a form from the
browser inside the Java Portlet code.
I had created a simple JSP that has a simple form which uses POST method.
JSP file:
<%
final String browser_name = (String)
request.getAttribute("javax.servlet.forward.request_uri");
%>
<form name="input" action="<%= browser_name %>" method="post">
Username_post:
<input type="text" name="user_post">
<input type="submit" value="submit_post">
</form>
Portlet Code:
public class FormPortlet extends GenericPortlet
{
public void doView(RenderRequest request,RenderResponse response)
throws PortletException, IOException
{
parseRequestParameters(request);
PortletContext portletcontext = getPortletContext();
PortletRequestDispatcher prd =
portletcontext.getRequestDispatcher("/jsp/form.jsp");
prd.include(request,response);
}
}
How do I access the value entered in user_post input box inside the
Java code and JSP code?
I tried printing all parameters and attributes from the request object,
but could not find the value of user_post.
Thanks a lot,
Deepan
--
Join your friends and colleagues at JA-SIG with Altitude: June 24-27,
2007 in Denver, CO USA.
Featuring keynotes by: Phil Windley, Matt Raible, Matt Asay
Sessions on topics including: CAS, uPortal, Portlets, Sakai, Identity
Management, and Open Source
For more information & registration visit:
http://www.ja-sig.org/conferences/07summer/index.html
---
You are currently subscribed to [email protected] as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--
Join your friends and colleagues at JA-SIG with Altitude: June 24-27, 2007 in
Denver, CO USA.
Featuring keynotes by: Phil Windley, Matt Raible, Matt Asay
Sessions on topics including: CAS, uPortal, Portlets, Sakai, Identity
Management, and Open Source
For more information & registration visit:
http://www.ja-sig.org/conferences/07summer/index.html
---
You are currently subscribed to [email protected] as: [EMAIL
PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]