Biswajit das
Biswajit das

Reputation: 99

Liferay Portlets are not working on upgrading from 6.1 to 6.2

I am using struts 2 and liferay 6.1.0 for developing a website. Now I want to update liferay version to 6.2. When I am starting the liferay tomcat server it is showing that all the portlets are available for use. But When I fill up a form the values are not passing to the Action class. I sysout to check it and found that the s:textfield values are not coming to action class but sysout string is printing in the console. The exact same is code is working in liferay 6.1.

Any help is highly appreciable.

jsp file:

<s:form name="searchCallLogCategoryWise" id="searchCallLogCategoryWise" action="searchCallLogCategoryWise" method="post">
<table>
<tr>
    <td width="30%">Status</td>
    <td width="70%"><select name="caseCriteria" id="caseCriteria">
        <option value="Select">Select</option>
        <option value="Open">Open</option>
        <option value="Closed">Closed</option>
        <s:textfield name="callLogId" id="callLogId" value="1234"></s:textfield>
        </select> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <s:submit
        action="searchCallLogCategoryWise" value="Search"></s:submit>
    </td>
</tr>
</table>
</s:form>

struts.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <constant name="struts.ui.theme" value="simple" />
    <package name="view" extends="struts-portlet-default"
        namespace="/view">
        <action name="searchCallLogCategoryWise" class="com.stp.portal.view.callLogModulePortlet" method="searchCallLogCategoryWise" >
            <result name="success">/WEB-INF/view/CallLogReportStartPage.jsp</result>    
        </action>
    </package>
</struts>

callLogModulePortlet.java

    public class callLogModulePortlet extends DefaultActionSupport {

    private String callLogId = "";
    private String caseCriteria = "";

    public String getCallLogId() {
        return callLogId;
    }

    public void setCallLogId(String callLogId) {
        this.callLogId = callLogId;
    }

    public String getCaseCriteria() {
        return caseCriteria;
    }

    public void setCaseCriteria(String caseCriteria) {
        this.caseCriteria = caseCriteria;
    }


    public String searchCallLogCategoryWise() throws Exception
    {
        System.out.println("i am in searchCallLogCategoryWise...");
        System.out.println("Call Log Id:: " + getCallLogId());
        System.out.println("case Criteria: " + getCaseCriteria());

        return "success";
    }

}

When I run it in the console:

i am in searchCallLogCategoryWise...
Call Log Id::
case Criteria:

I am using the below jars:

struts2-core-2.2.3.jar

struts2-portlet-plugin-2.2.3.jar

xwork-core-2.2.3.jar

Upvotes: 1

Views: 251

Answers (2)

Biswajit das
Biswajit das

Reputation: 99

By adding <requires-namespaced-parameters>false</requires-namespaced-parameters> in liferay-portlet.xml solved the issue.

Upvotes: 0

Olaf Kock
Olaf Kock

Reputation: 48057

Try adding <portlet:namespace/> to the name of your parameters and close your <select> input properly:

<select name="<portlet:namespace/>caseCriteria" id="caseCriteria">
  <option value="Select">Select</option>
  ....
</select>
<s:textfield name="<portlet:namespace/>callLogId" id="callLogId" value="1234"/>

I'm not sure if the s taglib adds it automatically - but portlets need it to know that the parameters are actually directed to your portlet. The plain <select> definitely doesn't include it automatically.

Upvotes: 1

Related Questions