Dan*_*rch 2 jsf portlet liferay
我有下面的portlet view.xhtml
:
<?xml version="1.0"?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:body>
<h:form>
<h:commandButton value="TESTButton" action="#{navigationViewBean.submit}" />
<h:outputText value="TESTGetter: #{navigationViewBean.testField}" />
</h:form>
</h:body>
</f:view>
Run Code Online (Sandbox Code Playgroud)
而这个托管bean:
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean(name = "navigationViewBean")
@RequestScoped
public class NavigationViewBean {
private String testField;
public boolean lol = false;
public void submit() {
System.out.print("TEST BUTTON INVOKED");
}
public String getTestField() {
System.out.print("TEST GETTER INVOKEDx");
return testField;
}
public void setTestField(String testField) {
this.testField = testField;
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试做的唯一一件事就是调用一个方法来打印我的控制台.问题在于,无论我做什么,都不会调用action方法.正确调用getter方法.
我究竟做错了什么?
我不知道为什么,但在将此行添加到我的liferay-portlet.xml
修复后.
<requires-namespaced-parameters>false</requires-namespaced-parameters>
Run Code Online (Sandbox Code Playgroud)
整个街区:
<portlet>
<portlet-name>Test1</portlet-name>
<icon>/icon.png</icon>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
<header-portlet-css>/css/main.css</header-portlet-css>
</portlet>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
865 次 |
最近记录: |