jsf,liferay,portlet , commandButton action method not invoked in Liferay

commandButton action method not invoked in Liferay


Tag: jsf,liferay,portlet

I've the below portlet view.xhtml:

 <?xml version="1.0"?>
    <f:view xmlns="http://www.w3.org/1999/xhtml"


                    <h:commandButton value="TESTButton" action="#{navigationViewBean.submit}" />
                    <h:outputText value="TESTGetter: #{navigationViewBean.testField}" />

And this managed bean:

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name = "navigationViewBean")
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 only thing I try to do, is to call a method which prints something to my console. The problem is that no matter what I do, the action method is never invoked. The getter method is properly called.

What am I doing wrong?


Im not sure why, but after adding this line to my liferay-portlet.xml it fixed it.


And here the whole block:



Submit form without attached file

I want to create JSF form with attached file. But also to give a option form the users to submit the for without attach file. I don't want this to be mandatory. <h:form id="form" enctype="multipart/form-data"> <div class="string"> <label class="name"> <h:inputText id="name" value="#{contacts.name}" pt:placeholder="Name*:"/> </label> </div> <label class="message"> <h:inputTextarea value="#{contacts.comment}" pt:placeholder="Comment*:"/>...

Is there a JSF toggle component or a way to theme an h:selectBooleanCheckbox with images?

I tried using a toggle like below. Although it works, it breaks when used inside of a composite component - changing the singleSelect value outside of the component never updates inside the component: <h:commandButton disabled="#{cc.attrs.singleSelect}" image="/resources/img/collapse-single.gif"> <f:ajax listener="#{cc.toggleSingleSelect}" render="#{cc.clientId}"/> </h:commandButton> <h:commandButton disabled="#{! cc.attrs.singleSelect}" image="/resources/img/expand-single.gif"> <f:ajax...

af:convertNumber element removes zero in the end of the value

My code: <af:inputText id="it1" label="Test"> <af:convertNumber groupingUsed="true" type="number" messageDetailConvertNumber="#,###,##" maxFractionDigits="2"/> </af:inputText> When I type 100,51 -- everything is fine, but if I would type 100,50, then '0' will be removed and entered value will be 100,5. How can I leave this '0' in the end? I need <af:convertNumber> element for...

set focus to next input element after jsf's change value listener

in one of our front-end screens we have the following layout as follows <h:outputLabel for="firstName" value="first name" /> <h:inputText styleClass="required" id="firstName" size="30" maxlength="30" value="#{ownershipStoreInfoController.form.ownerFirstName}" onchange="submit()" valueChangeListener="#{ownershipStoreInfoController.useOwnerInfo}"> <e:validateRegExpr pattern="([A-Z,a-z,0-9,%@()#&amp;,.;:_\$\/\-\{\}\[\]\'\\s*]{1,30})?" /> </h:inputText> <h:outputLabel for="lastName" value="last name"...

a4j:support - Value retrieved from h:selectOneMenu is always NULL

There's a datatable with a h:selectOneMenu in each row. I want to be able to retrieve the value selected in the selectOneMenu in the bean. I'm using richfaces a4j:support tag to make AJAX calls to the backing bean. You can see the code below: DataTable header: <t:dataTable id="datatable" var="row" value="#{myBean.dataTableRows}">...

Form submit portlet with Spring MVC

I'm trying to achieve a Liferay portlet of submit form using spring MVC. The model: package com.model; public class Person { String firstName; String middleName; public String getFirstName() { return this.firstName; } public String getMiddleName() { return this.middleName; } public void setFirstName(String firstName) { this.firstName=firstName; } public void setMiddleName(String middleName)...

How to display PDF in JSF, with content from ServletResponse

In my application, I use jsf & richfaces, I want to display a generated pdf in web browser , I have generated this PDF in serverside and it is available in ServletResponse, but I am unable to display it in my web page. I have tried this question but, it...

File upload via h:inputfile (prettyfaces) does not work

I'm trying to upload a file to the glassfish application server (v4.1) via h:inputfile. xhtml-file and bean are prepared as almost every example in the web shows. I tried with and without Pretty Filter in web.xml, allowCasualMultipartParsing in context.xml, and a handful of other possible workarounds. None of them seemed...

Cons of a liferay cms while website development using Community Edition

I am new to LIFERAY CMS. i need cons of a liferay cms i.e., difficulties faced while developing and using liferay cms. can you please list cons of liferay cms.

Incorrect liferay-plugins dependency

In https://github.com/liferay/liferay-plugins/blob/6.2.x/build-plugins.gradle#L9 following dependency is defined: dependencies { classpath group: "com.liferay.portal", name: "portal-service", version: "7.0.0-SNAPSHOT" } How can a 6.2.x version have a dependency on 7.0.0 version? Is it a bug? When I peek to the history of the file, the dependency has always been there. I am not able...

Lifefay freemarker ADT: methods unavailable?

I'm trying to work on some ADT for asset publisher (Documents and Media type), but I often have a message telling me that : Expression assetRenderer.getDataRepositoryId is undefined or Expression assetRenderer.getFileEntryId is undefined I found some threads where people said that we must add velocity.engine.restricted.classes= velocity.engine.restricted.variables= freemarker.engine.restricted.classes= freemarker.engine.restricted.variables= in portal-ext.properties...

CommandButton execution while rendering

Question: How can I prevent the execution of a while the website is rendering? Thats where my Button sits: <p:dialog widgetVar="newComment" height="200" width="500"> <h:form> <h:panelGrid> <h:outputText value="#{commentDialog.username}" /> <h:inputTextarea id="in_text" value="#{commentDialog.text}" /> <p:message for="in_text" /> </h:panelGrid> <p:commandButton validateClient="true" value="Abschicken" ajax="true" actionListener="#{popupRequestView.update}"...

Parameters from f:param not submitted with AJAX request when form enctype is multipart/form-data

I'm running Wildfly 8.2 and I'm using the JSF version bundled with it, 2.2.8-jbossorg-1. I have the following facelet: <h:form enctype="multipart/form-data"> <h:commandButton value="Submit"> <f:param name="myparam" value="true"/> <f:ajax execute="@this" render="@this"/> </h:commandButton> </h:form> When I press the submit button, several parameters are submitted, but not myparam. If I remove enctype="multipart/form-data" from the...

Setting f:setPropertyActionListener value with a f:param value

I'm trying to use the setPropertyActionListener tag to set a value in my backing bean. However, it doesn't work as I expected. Context: userService is an instance of my backing bean, which contains an int member, reqID. This, in turn, is the key to a map of objects that belong...

Portlet IPC after recieved Event

I have a Navigation portlet which schows all Students, when a Student gets clicked im sending a event with the id of the clicked student to other portlets. Sending and receiving the event is not the problem, that works fine. What i don't get, is how to proceed with the...

java.util.ServiceConfigurationError when running tests using arquillian+omnifaces

I am getting the following error "java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.omnifaces.ApplicationInitializer not found" when running Arquillian tests. I have put the most basic test case I could here: https://www.dropbox.com/s/kou5v8kqs5g4g4m/test.zip?dl=0...

How to pass data from page to Portlet class through AJAX call?

I'm trying to pass a value in an AJAX 'GET' request to my Portlet class, but I can't quite figure out a way to access such variable's value in the class. My AJAX code is: function loadXMLDoc() { var nocache = new Date().getTime(); var xmlhttp=new XMLHttpRequest(); var url = "${mURL}";...

How to create service builder for liferay plugin project with maven

I have Already create Liferay Plugin project. and maven install also over. it gives ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] --------------------------------------------------------------------- [INFO] Total time: 1:29.773s [INFO] Finished at: Wed Jun 17 15:46:10 IST 2015 [INFO] Final Memory: 34M/151M [INFO] -----------------------------. But unable to add service builder. When i try to add...

Use JSF, JPA, JTA, JAAS, CDI, Bean Validation with Tomcat? [closed]

Is it possible to use the following APIs with tomcat (as a lightweight server): JSF, JPA, JTA, JAAS, CDI, Bean Validation. ...

Can @ManagedBean and @XxxScope be placed in a base class?

I have two @ManagedBean (javax.faces.bean.ManagedBean), parent and child. The parent managed bean is not abstract because we have to give liberty to the developer to use the parent if enough or inherit it with a child that holds specifically funcionality. I have problems with the injections bean and the @PostConstruct...

Distinguish view from normal view in ViewHandler#createView()

I have defined error page in my web.xml for error 404 in this way: <error-page> <error-code>404</error-code> <location>/common/messages/pageNotFoundError.jsf</location> </error-page> Handling invalid page url works as intended - user is redirected to pageNotFoundError page. I have also defined custom view handler in faces-config.xml. The view handler overrides method createView(FacesContext context, String viewId)....

Double dispatching in jsf

Is it possible in Mojarra-2.1. If I do dispatching to another view from the action method by clicking action buttons: <h:commandButton value="dispatch" action="#{myBean.action()}" /> The bean: @ManagedBean @RequestScoped public class MyBean{ public String action(){ //do some return "view"; } } my browser then recieve the content of the view view....

Why can't I reference net.sf.jasperreports.engine.DefaultJasperReportsContext from JSF?

I grabbed an old JSF (in Netbeans) project that I needed to update. I noticed that the libraries were missing, so I went and snagged the current version of JasperReports (.jar) and all the commons/other support .jars necessary. Ultimately, when I try to run the project it fails at the...

Refresh parent node from backing bean with primefaces tree

Currently I am working on a project that use primefaces 3.4.1 version which does not support drag and drop in tree component. So I am using a contextMenu instead of drag and drop. <p:tree id="treeHierarchy" value="#{hierarchyManagementBackingBean.root}" var="node" dynamic="true" selectionMode="single" cache="false" style="width:99%;" selection="#{hierarchyManagementBackingBean.selectedNode}"> <p:treeNode id="idtreenode"> <h:outputText value="#{node.name} (#{node.entityType})" /> </p:treeNode> </p:tree>...

Get list of users in liferay

I want to display users list on liferay. and I am having problem with it. Here is my action class. public void userList(ActionRequest actionRequest, ActionResponse actionResponse) throws SystemException { // Todo Logic for user code try { int countUser = UserLocalServiceUtil.getUsersCount(); log.info("User Present In DB" + countUser); List < User...

how stick out a menu when clicking on a menu [on hold]

I have a type of menu created in JSF. <p:menubar styleClass="menuPrincipal" id="menuBar" > <p:menuitem value="Inicio" url="/Inicio.xhtml" style="text-decoration:none" icon="ui-icon-home" id="inicio" /> <p:menuitem value="Agregar Excepciones" id="agregarExcepcion" url="/ExcepcionNuevo.xhtml" style="text-decoration:none" rendered='#{excepcionPendienteView.usuarioActual.tipoSolicitante eq "Administrador"}' /> </p:menubar> I want that when you click on a menu, highlight the option me where I am working. if I...

Creating command links dynamically from a managed bean

I have a need to create command links dynamically based on content coming from elsewhere. When a user clicks on a link it should call a method in a managed bean, and the method needs to know which link was clicked. I can create the command links using the following...

Render hidden elements using JSF and AJAX

I've been facing some problems using JSF with AJAX to render a table without reloading the whole page every time I submit a form. When I first run the server, my database is empty, so the page is supposed to show only a form to add books. When user submits...

Is there a way to get the Base URL from an Application-scoped bean in JSF?

In my JSF Facelets pages I know I can just use #{request.requestURL} To get the full URL to build exportable links and the like. However I have an @ApplicationScoped bean where I need the base URL (i.e. "http://dnsname/app") for the purposes of reports and other data. Is there a standard...

Output and Command Link in one in JSF

Is there a possibility to use both outcome and action in the same command link? I tried <h:commandLink outcome="page?faces-redirect=true" value="Got to Page" action="#{Bean.setValue("...")}" /> but it ignores the outcome. I have a table with data like this: ID Name Other Things Link to Next Page So I want to give...

In liferay market place, I am unable to submit the project

In Liferay market place i am stuck at the place "Upload Liferay Plugin Packages " When ever i am trying to upload a war file Please help me to short it out :)...

Unable to load servlet listener class: com.sun.faces.config.ConfigureListener

I'm using apache-tomee-jaxrs-1.7.1 and I'm trying to deploy with maven 3 getting this error: Unable to load servlet listener class: com.sun.faces.config.ConfigureListener: These are my dependencies in pom.xml: ... <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp.jstl</groupId>...

Retrieve the id of an Entity object as soon as the entity was instantiated?

Is there a way in JPA to retrieve the id of an Entity object as soon as the entity was instantiated? e.g Person person = new Person(); Currently i am using in my entity class the following strategy: @GeneratedValue(strategy = GenerationType.IDENTITY) If not is there a "Dummy Id" strategy for...

javax.servlet.ServletException the request doesn't contain a multipart/form-data or multipart/mixed stream

I've the below form which uploads a file via <h:inputFile> and <f:ajax>. <h:form enctype="multipart/form-data"> <h:inputFile id="file" value="#{bean.file}" /> <h:commandButton value="Upload" action="#{bean.upload}"> <f:ajax execute="file" render="file" /> </h:commandButton> </h:form> When I submit it, I get a JavaScript alert with the below error information: serverError: class javax.servlet.ServletException the request doesn't contain a multipart/form-data...

JSF facets not available in Eclipse

So I am watching a tutorial about how to configure JSF in eclipse. I understand that you click file -> new -> Dynamic Web Project. And then it gives you a few options. The Target Runtime will be (for me) Apache Tomcat version 8, and dynamic web module version will...

How to click on a p:commandButton using javascript [duplicate]

This question already has an answer here: How to select JSF components using jQuery? 2 answers There are many tag in my JSF page.I want to click a p:commandButton using javascript in one of the forms. But it doesn't work. When I debug it use chrome ,it prompt The...

selectonemenu, when editable=false, cannot submit the form

My form is working if editable is set to true but not when it's false. When false the submit action method is not even called. I need it to be false (not editable so I can store the correct value in db). This is the menu I added. <tr><td> <h:outputLabel...

Primefaces: Dialog with inputTextarea not updating controller's variable

I have this Dialog: <p:dialog header="Ingrese Comentario" widgetVar="dlg1" appendTo="@(body)" modal="true" position="top" hideEffect="fold" showEffect="fold" closable="true" draggable="true" > <h:form id="d_ingresarComentario"> <h:panelGrid columns="2"> <p:inputTextarea value="#{tareaController.comentarioNuevo.comentario}" rows="7" cols="60" placeholder="Ingrese su comentario aquí" counter="display1" maxlength="200" counterTemplate="{0} Caracteres faltantes." > </p:inputTextarea> <br/>...

Refresh selection model of p:datatable on row deselection

I have a problem with the selection model of a Primefaces 5.0 datatable. This selection model does not process deselection properly: Selection of rows adds these roles as expected to the list of selected rows. But a deselection has no influence on this list; deselected rows remains in it. Only...

h:selectmanyListbox make “choose” option unselectable when at least one option is selected

Is it possible to have in <h:selectManyListbox> a default option like "--choose--" which can be selected when no option is selected. When the some value is chosen, then it must be unselectable. <h:selectManyListbox value="#{bean.value}" class="form-control"> <f:selectItems value="#{bean.dropdownValues}" var="value" itemLabel="#{value}" itemValue="#{value}"/> </h:selectManyListbox> ...

JSF Composite Component with conditional popup panel

I'm trying to render a composite component that shows a popup panel based on the outcome of a backing bean method. So far no success. Would appreciate some help. GlassFish 4.1 Mojarra 2.2 RichFaces 4.5.4 Composite Component (conditionalActionLink.xhtml): <ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:ui="http://java.sun.com/jsf/facelets"...

How can I load a resource bundle properties file within a composite component?

My component library directory tree is setup as the following: resources mylib css mycomponent.css properties mycomponent.properties mycomponent.xhtml I'd like to load the properties file within mycomponent.xhtml to use for messages. What is the proper way of doing this? Is there an f:loadbundle type of solution?...

Eclipse + Wildfly + Maven EAR project, is it possible to have files update without redeploy?

I'm working on my first JavaEE/JSF project. It's currently set up with maven so that several jars and a war are deployed inside an EAR container. I spent a lot of time trying to get some kind of hot/autoredeploy type setup going a few weeks ago but gave up and...

How to pass HTTP request to Web-Service

From my portlet JSP, I am trying to make a Ajax call to web-service. My aim is to pass HTTP request object as a parameter to web-service method. Please suggest.

JSF link to external site without showing username and password in the URL

I was able to do a SSO(Single sign on) on click of external link from the code below. SSO works but username/password is seen on url. https://example.org/index.php?userLogin=user1&userPassword=pass123 <h:outputLink styleClass="ui-menuitem-link ui-corner-all" value="https://example.org/index.php"> <h:outputText value="Ext Tool" /> <h:outputText styleClass="ui-icon ui-icon-suitcase" style="float:left" rendered="#{userBean.in}" /> <f:param name="userLogin" value="#{userBean.user.eUser}" /> <f:param...

How can I change the zIndex attribute of aui-datepicker in Liferay Portlet 6.2

I have discoveder one problem with date field in portlet in LF 6.2. The problem is that after clicking on the input field, the datepicker is displaying, but with zIndex=0, that means it is under the portlet. If I change on firebug that parameter to 1, everything is OK. I...

Render outcome of “action” attribute?

i want to completely rewrite a <h:commandButton> renderer. Now i'm stuck at rendering the "action" attribute of the button. Is there a possibility to render this attribute the same way it gets rendered by the standard renderer ? Is there a possibility to retrieve the generated script from somewhere ?...

Manually added faces message doesn't appear in tab of accordion panel

I'm adding a faces message in an action method as below: FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Mail invalide", "Vérifier le mail"); FacesContext.getCurrentInstance().addMessage("connection:mail", message); I'm expecting it to show up at the below position in the tree: <h:body> <p:layout fullPage="true"> <p:layoutUnit position="center" > <p:accordionPanel multiple="true" activeIndex="0"> <p:tab title="Se connecter" > <h:form...

How manage styles in Vaadin portlet in Liferay

I have a Portlet, where is used Valo theme. Most graphical components are displayed properly, but TextField not. It should have rounded border radius and height should be about 35px. It has normally about 15px and the field is angular. When I narrow width of browser window to about 200px...

Include ftl file in ext plugin

I have ext-plugin and I would like to override this file: portal-impl\src\com\liferay\portlet\dynamicdatamapping\dependencies\ddm\documentlibrary.ftl. After maven build, this file isn't include in my porta-impl-ext.jar. In my portal-impl-ext's pom.xml I have this code: <build> <plugins> <plugin> <groupId>com.liferay.maven.plugins</groupId> <artifactId>liferay-maven-plugin</artifactId> <version>${liferay.maven.plugin.version}</version> <configuration>...