jsf-2,portlet,websphere-portal,jsr286 , Portlet aware of other portlets on the same page

Portlet aware of other portlets on the same page


Tag: jsf-2,portlet,websphere-portal,jsr286

i am tasked to develop an "action portlet" that contains the actions (e.g. h:commandLink) for all other portlets on the same page. Now these actions should only be available if the corresponding portlet is actually present on the same page.

Is it possible for a portlet to "know" which other portlets are on the same page without having to process an ActionRequest first?



My gut reaction to your question is that a portlet should be self contained enough that it doesn't need other portlets on the page to function. So without any other knowledge of why this needs to be done, it sounds like this design choice has some inherent flaws. Portlet A should never need to process ActionRequests for Portlet B. It seems like you're just trying to bend, break and abuse the portlet spec but I'll admit I've broken design rules when the use case warrants it.

As an alternative, I might suggest instead that your portlet allow other portlets to tell your portlet what they need done rather than your portlet having to ask. You could do this client-side where each other portlet runs a little JavaScript on page load to inform your portlet what it needs to do.

Back to your actual question. I haven't dug too deep into the documentation but, there is an API provided by WebSphere Portal that may help determine what you need. Below is the link to IBM's documentation on the subject.


The Model SPI is how a portlet can access everything about the page structure of the portal, the navigation state and a number of other related things. I would expect the Model SPI to be able to tell you what other portlets are on the same page as your current portlet. Once you get a list of other portlets on the page, it would be up to you how to determine what other links you need to render.


primefaces treetable expand not working if jsf page location is changed

Primefaces treetable expands if my xhtml webpage is in WebContent Folder but it doesn't expand if I move the same webpage to WEB-INF/views/jsf folder. I'm very new to JSF and I don't know where and what to change. If my webpage is in WEB-INF/views/jsf folder only the root node is...

Primefaces push

I would like to use 'primefaces push' in my web application to receive notifications. I would like that a user could receive notifications depending on the groups he belongs to. Every user can belong to several groups, for example: User X belongs to Group A and B. User Y begong...

jsf: redirecting from bean on primefaces ajax event

I have this selectable PrimeFaces Tree with an Ajax listener on selection in my index.xhtml: <p:tree value="#{seccionesArbolView.root}" var="node" selectionMode="single" > <p:treeNode> <h:outputText value="#{node.nombre}" /> </p:treeNode> <p:ajax event="select" listener="#{seccionesArbolView.onNodeSelect}"></p:ajax> </p:tree> The listener method is on a session scoped named bean, and should redirect to another page (grupal.xhtml) with some GET parameters....

OmniFaces UnmappedResourceHandler seems to leak resources when composite components are used

It seems UnmappedResourceHandler is loading composite components xhtml files within the resources folder. The result seems a gradually increasing memory leak. The leak can be found within FaceletViewHandlingStrategy.metadataCache. It relies on a hashmap and when above handler is used UnmappedResources are used as the key for CompositeComponentBeanInfo instances. If the...

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.

ajax validation error message [duplicate]

This question already has an answer here: Custom JSF validator message for a single input field 1 answer how to add my own message for the client side validation in JSF. <div class="ui-grid-row"> <div class="ui-grid-col-3" align="left"> <h:outputLabel for="cmpny" value="Company Name:" style="font-weight:bold" /> </div> <div class="ui-grid-col-2"> <p:inputText id="cmpny" value="#{userData.cmpny}"> <f:validateLength...

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...

/ UI Layout Initialization Error The center-pane element does not exist. The center-pane is a required element

I am new to stackoverflow and also this my very first question to this forum so if i am doing something wrong when i am posting here please let me know. my question related to primefaces i tried with lot of solution but nothing work for me. i am using......

JQuery , On Enter key code 13 (a button is triggered ), this works only the first time but not afterwards

I have a modal which has a text box and a commandButton. Once I enter the value into the text and press Enter commandButton is triggerd. This functionality works the first time i.e. when i enter text and press enter, button is triggered and modal stays Now when i enter...

Every include should refer to other instance

I include a part of the XHTML page to my Web Application. This part can be included multiple times. And that's the problem! Because every include refers to the same java object. That means that every element has the same value. But I want for each include a new Java...

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....

binding on p:dataTable which is included multiple times causes ID unqiueness exceptions

I'm attempting to use a special PrimeFaces data exporter implementation as being used in this answer: http://stackoverflow.com/a/14413932/396732 Our use case however is a little more complex, e.g. using Facelets to show the respective datatable for export, which has row expansions with sub tables in them. insiderListManagerDialogs.xhtml: <ui:include src="insiderListManagerListDialog.xhtml"> <ui:param name="idPrefix"...

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> ...

Execute a script on f:ajax “success” event only when validation has not failed

I have created a composite component that extends the command button and add some ajax functions (onBegin, onComplete and onSuccess), but I have some problems that I couldnt solve: When I click on the button and a validation error occur, in success event function is passed #{facesContext.validationFailed} = false instead...

Primefaces datatable duplicate “No records found” while doing column freeze for empty records

I am using primefaces <p:datatable> to freeze some of my columns.Everything is fine but when there are no records in then it gives two "No records found" message.This is weird situation.Do anyone have come across this problem? Suggestions are welcome.I want only one "No records found " message. <p:dataTable var="car"...

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...

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...

Get to specific book using hyperlink in JSF [duplicate]

This question already has an answer here: Creating master-detail pages for entities, how to link them and which bean scope to choose 1 answer I have a very strange situation here. I have made my application in JSF and it looks just great, however I am not quite sure...

Get p:dataTable row data via p:selectOneMenu

I have a dataTable which one of the columns contains a selectOneMenu (a.k.a dropDownList). Basically each row has a selectOneMenu which has a list of values. Is there a posibility to pass the row data or key whenever the selectOneMenu value has been selected? This way I can loop through...

Dynamic rendering - unable to find component with clientId

I am rendering a xhtml to a dialog whose components are added dynamically from server side using Dynamic example. Using PrimeFaces 5.1, JSF 2.1 Mojarra and tomcat 7. When i click the close button of the pop up a large number to of unable to find the component is being...

Path to a file up in the hierarchy

Here is file structure of my JSF application. User directory is secured & one needs to authenticate to see user/success.xhtml. user/success.xhtml has a button which is used to logout. That button submits form to following method. public String logout(){ HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); session.invalidate(); return "index"; } Last line of...

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 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...

liferay portlet non-liferay JNDI data source null

For a Liferay 6.2 custom portlet accessing a non liferay Oracle database we are running into an issue where the data source returned is null. We have configured the tomcat/conf/context.xml <!-- Adding custom New non liferay datasource --> <Resource name="jdbc/NewPool" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST...

How to disable all components for the same type in a JSF page

I have let's said 4 pages who are dynamically included by a for like this: <c:forEach items="#{tareaController.mfuncionesAsociadas}" var="mFuncion" varStatus="loop1"> <p:tab id="t_funcion_#{loop1.index}" title="#{mFuncion.nombre}" > <f:subview id="tab_#{loop1.index}"> <p:panelGrid id="pg_funcion_#{loop1.index}"> <ui:include src="#{mFuncion.paginaFuncion}"></ui:include> </p:panelGrid> </f:subview> </p:tab> </c:forEach> I want to do the following: on every page I generate could be...

Navigating to another page JSF

I wrote a jsf application, this app inserts the data into mysql database and shows some of the inserted details in another page. I am successful in inserting the values into database, but unable to redirect to the other page even after writing the navigation rule. My action code <div...

In Primefaces picklist, how to find that an item is moved from TARGET to SOURCE, Using Omnifaces Converter

I have looked around and could not find a solution. I am using Omnifaces listConverter in the PickList component of Primefaces. When I move an item from SOURCE to TARGET. In the backing bean i get the new item ONLY on dualList.getTarget(). However when I move an item from TARGET...

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...

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...

JSF 2: Stop rendering if validation fails [duplicate]

This question already has an answer here: Can I update a JSF component from a JSF backing bean method? 1 answer JSF validate on submit form 1 answer I'm using primefaces. I have a form and a dataTable with a lazyModel, in the dataTable I show the results found...

Using ui:repeat to iterate over columns

I'm in Mojarra 2.1.29. I tried to iterate over the collection to produce amount of rows equals to the size of the collection. Here what I've tried: <rich:dataTable id="table" var="partner" rows="10" value="#{testBean.k}"> <ui:repeat var="name" value="#{testBean.cols}"> <rich:column> <f:facet name="header"> <h:outputText value="#{name}"/> </f:facet> <h:outputText value="#{m.get(partner)}"/> <f:facet name="footer"> <h:outputText value="#{name}}"/> </f:facet> </rich:column>...

How to generate a component multiple times in JSF?

I need to highlight the boundary of a country, for which I am using GMaps4JSF aimed at integrating Google maps with JSF. To draw polygon and polylines, the library provides polygonComponent polylineComponent components. I have loaded the data points from the fusion tables into our own DB. <m:map width="1000px" height="500px">...

Progress bar image without ajax

I want to show a progress bar when a button is clicked, and remove it when the page is refreshed. So I have a h:pannelGroup: <h:panelGroup id="progbarb"> some progress bar image </h:panelGroup> My h:commandButton is inside a h:form: <h:commandButton id="nextButton" value="Next" action="#{searchResults.searchForProducts()}" render="progbarb" /> My searchForProducts method simply updates a...

f:convertNumber unexpectedly increments/decrements float value

I have a float property bound to <h:inputText>. For long values, it was automatically converting the values to exponential notation. I tried to use <f:convertNumber> to avoid the exponential value presentation. The value can be of two given below. Format 1: <18 digits> Format 2: <14 optional digits>.<3 option decimals>...

WildFly 8.2 does not start project while Jboss 7.1 do

My project originally developed under Jboss but if start it on WildFly there is only message in browser: "Not Found" and any errors. Is there something what I missed? web.xml mapping <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> index.jsp <jsp:forward page="./faces/index.xhtml" /> So it works on Jboss but does't on WildFly....

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)...

Why are fields reset after ajax update with Primefaces

On a form I have some personal information (name, address etc.) and a changeListener which updates the salutation and letter salutation according to the gender and last name. If the underlying entity was already stored in the database it works fine. If I'm entering data for a new (not saved)...

Primefaces validation not working

I am working on a form, where i am using primefaces. When i validate an inputtext, then ajax message is working for only for field and not for the others, please, check my code below. <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"...

Output data from database in JSF page

I am making a project using JSF, and I know how to get data from my view. I also know how to get data with the JDBC connector. And also how to put data in the view, from some objects, but my question is: How to put data directly from...

What URL to use to link other JSF pages in a JSF project

I am confused about how to link between files in a Java Server Faces project, when some of the files are in sub-folders. (I was going to attach screenshots so you can see the Nebeans project view, and files view of the example I am trying.... but I'm not allowed...

Component rendering problems with primefaces in eclipse for JSF [duplicate]

This question already has an answer here: JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output 1 answer I'm trying to work on primefaces. when i am trying to run a xhtml page individually in my eclipse IDE, All the primeface elements included in my...

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/>...

Putting inside a causes “weird” display

I want to create dynamic forms with ajax update on event. Therefore dynamic-id is important. However, binding the id attribute to a bean value causes Empty Id exception. I saw one of the stackoverflow questions that suggests use html. So I used span. The xhtml code is as follows: <?xml...

Change default color of a popupPanel?

I have a popupPanel: <rich:popupPanel id="popup" modal="false" autosized="true" resizeable="false"> <f:facet name="header"> <h:outputText value="Simple popup panel" /> </f:facet> <f:facet name="controls"> <h:outputLink value="#" onclick="#{rich:component('popup')}.hide(); return false;"> X </h:outputLink> </f:facet> <p>Any content might be inside this panel.</p> <p> The popup panel is open and closed from the javascript function of component client side...

Re-create session scoped JSF managed bean programmatically

I'm using Mojarra 2.1.29 and have a session scoped JSF managed bean @ManagedBean @SessionScoped public class UserContext{ //staff } and a spring bean: public class UserReproducer{ private User user; public void reporoduce(){ if(user == null){ //Here I need to recreate the userContext managed bean //do some other staff } }...

How to avoid displaying of FacesMessage multiple times?

I need to display a FacesMessage for this component as shown below, The issue is that it is displayed on the UI multiple times as shown below, Secondly, the date entered was 40.06.2015 which is invalid, hence the FacesMessage, but it got converted into 10.07.2015. I have no idea how...

commandButton action method not invoked in Liferay

I've the 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>...

Access particular row of p:datatable in Backing Bean on click of h:CommandLink without binding attribute

Please find my code below for p:datatable having h:commandlink as one of its column: <p:dataTable id="listTable" value="#{listBean.lazyDatalist}" var="list" paginator="true" paginatorPosition="top" rows="10" rowIndexVar="rowIndex" rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'rowStyleOdd' : 'rowStyleEven'}" lazy="true"> <p:ajax event="page" listener="#{listBean.searchLazyData}"/> <p:column style="width:3%;" headerText="#{msg['userlist.dt.srNo']}"> <h:outputText value="#{list.orderCount}"></h:outputText>...

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...

h:inputText allow only numbers during input [duplicate]

This question already has an answer here: HTML Text Input allow only Numeric input 43 answers I have a field in JSF2, I tried execute a validation in this way: <h:inputText value="#{manutencaoContratoBean.contrato.nuContrato}" style="text-align: left; width: 90%; "> <f:convertNumber pattern="#######" maxFractionDigits="0" maxIntegerDigits="16"/> And thus: <h:inputText value="#{manutencaoContratoBean.contrato.nuContrato}" style="text-align: left; width: 90%;...