jsf - commandButton action method not invoked in Liferay -
i've below 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> and managed 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; } } the thing try do, call method prints console. problem no matter do, action method never invoked. getter method called.
what doing wrong?
im not sure why, after adding line liferay-portlet.xml fixed it.
<requires-namespaced-parameters>false</requires-namespaced-parameters> and here whole block:
<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>
Comments
Post a Comment