掲示板
Portlet Action Request Parameter is null
7年前 に Sourabh Lonikar によって更新されました。
Portlet Action Request Parameter is null
Junior Member 投稿: 42 参加年月日: 16/11/14 最新の投稿
Hi everyone,
Newbie here. I am trying very simple portlet which collects string from front end and displays in java console. I am not getting this value from request object. Help will be much appreciated.
public class Tagger extends MVCPortlet {
@ProcessAction(name="addName")
public void addName(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortalException, SystemException{
String userName = ParamUtil.getString(actionRequest, "userName", "default"); // actionRequest object is not null.
logger.info("addName | userName : " + userName); // This show userName:default
}
}
// Front End JSP
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects/>
User Name is : <b> ${userName}</b>
<br/>
<portlet:actionURL name="addName" var="addNameUrl" />
<form action="${addNameUrl}" method="post">
<input id="userName" name="userName"/>
<input type="submit" />
</form>
Thanks,
Sourabh
Newbie here. I am trying very simple portlet which collects string from front end and displays in java console. I am not getting this value from request object. Help will be much appreciated.
public class Tagger extends MVCPortlet {
@ProcessAction(name="addName")
public void addName(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortalException, SystemException{
String userName = ParamUtil.getString(actionRequest, "userName", "default"); // actionRequest object is not null.
logger.info("addName | userName : " + userName); // This show userName:default
}
}
// Front End JSP
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects/>
User Name is : <b> ${userName}</b>
<br/>
<portlet:actionURL name="addName" var="addNameUrl" />
<form action="${addNameUrl}" method="post">
<input id="userName" name="userName"/>
<input type="submit" />
</form>
Thanks,
Sourabh
7年前 に Abhishek Jain によって更新されました。
RE: Portlet Action Request Parameter is null
Regular Member 投稿: 226 参加年月日: 16/08/20 最新の投稿
You should use <%=addNameUrl%> instead of ${addNameUrl}. Tell me if the issue is resolved or not.
7年前 に Sourabh Lonikar によって更新されました。
RE: Portlet Action Request Parameter is null
Junior Member 投稿: 42 参加年月日: 16/11/14 最新の投稿
Hi Abhishek,
Thanks for replying.
I tried your suggestion of using <%=addNameUrl%> but it did not work.
Furthermore I had read before that this expression is generally replaced by its JSTL eqivalent of ${addNameUrl}.
View.jsp:
<form action="<%=addNameUrl%>" method="post">
LOGS:
addName | actionRequest : com.liferay.portlet.ActionRequestImpl@31602f6f
addName | userName : default
Infra Details:
Liferay 6.2 CE GA6 (Local Deployment)
Tomcat 7.0.62
JDK 1.7
Eclipse Mars.2
Thanks for replying.
I tried your suggestion of using <%=addNameUrl%> but it did not work.
Furthermore I had read before that this expression is generally replaced by its JSTL eqivalent of ${addNameUrl}.
View.jsp:
<form action="<%=addNameUrl%>" method="post">
LOGS:
addName | actionRequest : com.liferay.portlet.ActionRequestImpl@31602f6f
addName | userName : default
Infra Details:
Liferay 6.2 CE GA6 (Local Deployment)
Tomcat 7.0.62
JDK 1.7
Eclipse Mars.2
7年前 に Abhishek Jain によって更新されました。
RE: Portlet Action Request Parameter is null (回答)
Regular Member 投稿: 226 参加年月日: 16/08/20 最新の投稿
You can also try using alloy UI .
7年前 に Shiva goud によって更新されました。
RE: Portlet Action Request Parameter is null
Regular Member 投稿: 110 参加年月日: 15/01/02 最新の投稿
Hi ,
Please check whether below tag is available or not ,if not available then place below tag
The following configuration we need to do in liferay-portlet.xml file
<requires-namespaced-parameters>false</requires-namespaced-parameters>
Please check whether below tag is available or not ,if not available then place below tag
The following configuration we need to do in liferay-portlet.xml file
<requires-namespaced-parameters>false</requires-namespaced-parameters>
7年前 に Sourabh Lonikar によって更新されました。
RE: Portlet Action Request Parameter is null
Junior Member 投稿: 42 参加年月日: 16/11/14 最新の投稿
Hi Shiva,
Thanks for the tip. I tried it but is not working for me. Checked out doc related to namedspace-parameters, yet still not working.
Description:
It mentions 3 ways to avoid null/ empty values in request object :
1. Using <portlet:namespace/> Tag & required namespace = false.
2. Using renderResponse Object & required namespace = false
3. Using <aiu:/> tags and skipping required namespace tag
I am using method (3) for now. Nothing else working for me.
Also required parameters must be used before <icon/> tag for proper usage as per this.
Finally Alloy UI form thread was useful.
Final Working JSP:
<aui:form action='<%=addNameURL%>' name='<portlet:namespace />fm'
id='<portlet:namespace />fm' method="post">
<aui:button-row>
<aui:input id="userName" name="userName" value="sourabh"/>
<aui:button type="submit" value="save" />
</aui:button-row>
</aui:form>
Thanks for the tip. I tried it but is not working for me. Checked out doc related to namedspace-parameters, yet still not working.
Description:
It mentions 3 ways to avoid null/ empty values in request object :
1. Using <portlet:namespace/> Tag & required namespace = false.
2. Using renderResponse Object & required namespace = false
3. Using <aiu:/> tags and skipping required namespace tag
I am using method (3) for now. Nothing else working for me.
Also required parameters must be used before <icon/> tag for proper usage as per this.
Finally Alloy UI form thread was useful.
Final Working JSP:
<aui:form action='<%=addNameURL%>' name='<portlet:namespace />fm'
id='<portlet:namespace />fm' method="post">
<aui:button-row>
<aui:input id="userName" name="userName" value="sourabh"/>
<aui:button type="submit" value="save" />
</aui:button-row>
</aui:form>