我正在使用struts 2和liferay 6.1.0開發一個網站。現在我想將liferay版本更新到6.2。當我啓動liferay tomcat服務器時,它顯示所有portlet都可以使用。但是當填寫表單時,這些值不會傳遞給Action類。我sysout檢查它,發現s:textfield值不是來到動作類,但sysout字符串是在控制檯打印。代碼在liferay 6.1中工作完全相同。Liferay Portlets無法從6.1升級到6.2
任何幫助是非常可觀的。
JSP文件:
<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> <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";
}
}
當我在控制檯中運行它:
i am in searchCallLogCategoryWise...
Call Log Id::
case Criteria:
我使用下面的罐子:
Struts2的核心 - 2.2.3.jar
的struts2的portlet-插件-2.2.3.jar
XWork的核心 - 2.2.3.jar
選擇內的文本字段是不允許的。 https://www.w3.org/TR/html5/forms.html#the-select-element。 –