Hi all,
This is more a general portlet question but I'm not sure where to post this,
I hope you will be able to help me out.
I have read a few times that one should prepend some elements in a JSP file
with <portlet:namespace /> to avoid name collisions in the final HTML page.
While this is obvious for JavaScript functions and all "id" attributes of
HTML tags, should this be done for all "name" attributes too?
I'm asking because the behavior I observe in the following isn't what I
expect:
JSP:
<form method="POST" action="<portlet:actionURL><portlet:param
name='action'
value='saveSubscriptions' /></portlet:actionURL>">
Email:
<input type="text" name="<portlet:namespace />email"
value="${reference.subscriberEmail}" />
<input type="submit" name="<portlet:namespace />submit"
value="Save" />
</form>
Portlet:
public void processAction(ActionRequest request, ActionResponse
response) {
if
("saveSubscriptions".equals(request.getParameter(ACTION_PARAMETER_NAME))) {
final BasicContentSubscriptionUpdateRequest updateReq = new
BasicContentSubscriptionUpdateRequest();
updateReq.setSubscriberEmail(request.getParameter("email"));
// ...
}
}
In the portlet, request.getParameter("email") cannot find the "email"
parameter and so returns null. If I remove the <portlet:namespace/> in the
corresponding JSP tag, request.getParameter("email") does find the parameter
and returns the correct value. Interestingly, this scenario was working
fine with the IBM Portlet API, where the request was stripping the namespace
from the parameter.
Is this behavior normal? Won't there be a possible collision if other HTML
tags use the same name?
Cheers,
GB
--
View this message in context:
http://www.nabble.com/ActionRequest-and-parameter-namespacing-tf4959992.html#a14206018
Sent from the Pluto - User mailing list archive at Nabble.com.