Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Read Data From Action URL
Hi, i have an action url say ,
<liferay-portlet:actionURL name="delete" var="delete">
<param name="entryId" value="<%= entry.getPostId() %>"/>
</liferay-portlet:actionURL>
How do i read these entryId parameter in my controller method
i have tried
ParamUtil.getLong(actionRequest, "entryId");
and
actionRequest.getParameter("entryId")
I am using liferay 7.2 GA1
<liferay-portlet:actionURL name="delete" var="delete">
<param name="entryId" value="<%= entry.getPostId() %>"/>
</liferay-portlet:actionURL>
How do i read these entryId parameter in my controller method
i have tried
ParamUtil.getLong(actionRequest, "entryId");
and
actionRequest.getParameter("entryId")
I am using liferay 7.2 GA1
Based on the snippet you provided, it should be in there and accessible using either method you've tried.
I would recommend stepping back and ensuring that the action is actually invoking the right method, the action url is bound to a form or a button or something so you know this action is the one being invoked and not some other, the value used for entryId in the JSP actually has a value (could it be null, for example?), etc. You're kind of assuming that just because the JSP snippet is right the whole thing is right, but clearly that doesn't seem to be the case.
I would recommend stepping back and ensuring that the action is actually invoking the right method, the action url is bound to a form or a button or something so you know this action is the one being invoked and not some other, the value used for entryId in the JSP actually has a value (could it be null, for example?), etc. You're kind of assuming that just because the JSP snippet is right the whole thing is right, but clearly that doesn't seem to be the case.
David H Nebinger:
Based on the snippet you provided, it should be in there and accessible using either method you've tried.
I would recommend stepping back and ensuring that the action is actually invoking the right method, the action url is bound to a form or a button or something so you know this action is the one being invoked and not some other, the value used for entryId in the JSP actually has a value (could it be null, for example?), etc. You're kind of assuming that just because the JSP snippet is right the whole thing is right, but clearly that doesn't seem to be the case.
Hi, It is a action item from dropdown menu
<liferay-ui:icon-menu direction="left-side" icon="<%=StringPool.BLANK%>"
markupView="lexicon" message="actions" showWhenSingleIcon="<%=true%>"><liferay-portlet:actionURL name="delete" var="delete">
<param name="entryId" value="<%= entry.getPostId() %>"/>
</liferay-portlet:actionURL>
<liferay-ui:icon message="delete" url="<%= delete %>" />
</liferay-ui:icon-menu>
And i verified that the data is passing to the entryId by printing the entry.getPostId() in jsp page and the method delete is also calling because i able to see the system.out.println method from there when i have called the method.
will the value pass if i use "${entry.getPostId()}" instead of <%= entry.getPostId() %> ?
Use liferay-portlet:param instead of param and also check in the chrome network if your value is getting passed properly.
Thanks that worked !!!!
Aravinth Kumar:
Use liferay-portlet:param instead of param and also check in the chrome network if your value is getting passed properly.
Great catch Aravinth, I totally missed that!
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™