Menu
  • HOME
  • TAGS

Remove link outline from p:tabView

css,jsf,primefaces

The outline is added to the li element because it picks up the .ui-tabs-outline class after being clicked on. You can override the outline property in the class instead: li.ui-tabs-outline { outline: none; } ...

PrimeFaces p:dataList issues error “Property 'ime' not found on type java.lang.String”

jsf,primefaces,datalist

When using a selection component (such as p:selectCheckboxMenu or p:pickList), you need a converter to handle complex (= not a simple String) Java objects as values of f:selectItems. A converter will serialize and deserialize your entity Demonstrator. Therefore you need to add the converter attribute for your p:selectCheckboxMenu and reference...

Show String JSF [duplicate]

list,jsf,selectonemenu

Use private SelectItem[] edificios = null; instead of private Edificio[] edificios = null; and inside SelectItem you can put whatever you want like this: new SelectItem ("id","nombre"); first param is item value, and second is item label....

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

javascript,jsp,jsf

finally i found the solution. in my Value Change Listener. i added this statement at the end. if(event.getComponent().getId().equalsIgnoreCase("COMPONENT ID FIRST")){ String jsStatement = "document.getElementById(\'" + ("COMPONENT ID SECOND")+ "\').focus();"; SESSIONCLASS.setBodyOnload(jsStatement); } in the above code "COMPONENT ID FIRST" is the current component where your value change listener is triggered and...

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

java,jsf,jasper-reports

JasperSoft and support libraries cannot be copied into source as class files (unlike what is commonly done with other support libraries in desktop applications for JWS), they must be referenced as true libraries.

FacesContext#getViewRoot() returns null while setting for first time

jsf,locale,jsf-2.2,mojarra

I reproduced your problem. This is the consequence of issue 3021 which was applied since Mojarra 2.2.5. The locale is now determined during view build time. Previously, at time of writing the answer you found, the locale was determined during view render time which allowed the code to find view's...

Primefaces: Dialog with inputTextarea not updating controller's variable

jsf,jsf-2,primefaces

You've set immediate=true on a UICommandComponent, so the "Update model values" phase is skipped. Remove the attribute and it should work. BalusC offers this advice, "If set in UICommand only, the apply request values phase until with update model values phases will be skipped for any of the UIInput component(s)....

XPages: How to acces an application scope bean from a session scope bean

jsf,xpages

The VariableResolver goes through all implicit variables (e.g. session, database) as well as scoped variables (e.g. applicationScope.myVar). Your bean is also accessed from SSJS via the VariableResolver. So you can use: ExtLibUtil.resolveVariable(FacesContext.getCurrentInstance(), "myAppScopeBean"); ...

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

jsf,jsf-2,selectmanylistbox

Just add it as another <f:selectItem> and ask assistance of a bit of JavaScript to disable it when any value is selected during the change event. <h:selectManyListbox ... onchange="options[0].disabled=!!value"> <f:selectItem itemLabel="--choose--" itemValue="#{null}" /> <f:selectItems ... /> </h:selectManyListbox> The options[0] refers to the first option of the selection element. The !!value...

ajax validation error message [duplicate]

ajax,jsf,jsf-2,primefaces

<div class="ui-grid-col-2"> <p:inputText id="fnm" value="#{userData.fnm}" validatorMessage="First Name cannot be left blank and must be greater than 3 characters" > <f:validateLength minimum="4" /> <p:ajax execute="currentInput" update="firstname" event="blur" process="@this" /> </p:inputText> </div> <div class="ui-grid-col-7"><p:message for="fnm" id="firstname" display="icon,text"/></div> With the help of "validatorMessage" attribute, I am able to show customized messages when...

Navigating to another page JSF

jsf,jsf-2

Stop reading JSF 1.x resources and get rid of all that JSF 1.x-style <managed-bean> and <navigation-rule> entries in faces-config.xml. The proper JSF 2.x approach for your action="#{userData.add}" is as below: @ManagedBean @ViewScoped public class UserData { public String add() { // ... return "/badge.xhtml?faces-redirect=true"; } } No additional XML mess...

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

jsf,url,jsf-2,hyperlink

First of all, JSF is a HTML code generator. So it's not different in JSF than in "plain" HTML. You should just not look at file system structure in webapp project when creating links in HTML. You should look at public URL structure of those resources. It's namely the webbrowser...

Validator regex pattern input accept only a number with 2-5 digits

regex,validation,jsf

But when I insert some letters instead of numbers like "eee3", the validator shows the following message: "num1: 'eee3' must be a number between -2147483648 and 2147483647. Example: 9346" That's the default conversion error message of JSF builtin IntegerConverter. It will transparently kick in when you bind an input...

javax.el.PropertyNotWritableException when using EL conditional operator in value of UIInput

jsf,input,el,placeholder,conditional-operator

Conditional statements in EL are indeed not writable. They are read-only. End of story. The same applies to method references in EL as in #{bean.property()}. It must really be a true value expression as in #{bean.property}. Your approach of using a (HTML5) "placeholder" is actually wrong. For that you should...

Refresh selection model of p:datatable on row deselection

jsf,primefaces,datatable,selection

I finally found the solution. They had extended PrimeFaces implemenation and incompletely implemented some methods. The following thread helped me in solving the problem: p:dataTable selections are lost after paginating a LazyDataModel

@FacesComponent on shared library

jsf,java-ee,websphere,jsf-2.2

Web fragment JARs belong in WAR/WEB-INF/lib and absolutely not in EAR/lib nor Server/lib. See also a.o. chapter 8.1 of Servlet 3.0 specification (emphasis mine): 8.1 Annotations and pluggability In a web application, classes using annotations will have their annotations processed only if they are located in the WEB-INF/classes directory, or...

Facelets error page works during ajax request with FullAjaxExceptionHandler, but does not evaluate EL during synchronous request

jsf,error-handling,web.xml,omnifaces

The <error-page><location> must match the FacesServlet mapping in order to get FacesServlet to run on the error page too during an exception on a synchronous request (which doesn't use ViewHandler#renderView(), but RequestDispatcher#forward()). Alter the mapping accordingly: <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> Using /faces/* (and *.faces) is soo JSF 1.0/1.1. If...

How to open an arbitrary URL in new window using a PrimeFaces button

jsf,primefaces

The <p:commandButton> basically submits a POST request to the URL as specified by its parent <h:form>, which defaults indeed to the current request URL (you know, "postback"). The action attribute basically invokes a bean method and uses the returned value as navigation case outcome. An URL does not necessarily represent...

f:convertNumber unexpectedly increments/decrements float value

jsf,jsf-2,floating-point,converter

In a nutshell: floating-point-gui.de If you value precision, you should be using java.math.BigDecimal instead of float/double/java.lang.Float/java.lang.Double....

Change value of checkbox using ajax in JSF

ajax,jsf,facelets

You can do something like this: <h:form id="form"> <ui:repeat value="#{uiCheckboxList.list}" var="boxElement" varStatus="i"> <h:selectBooleanCheckbox id="a"> <f:attribute name="value" value="#{boxElement.enabled}" /> <f:ajax render="form" listener="#{uiCheckboxList.listen(boxElement)}" /> </h:selectBooleanCheckbox> <h:outputLabel value="#{boxElement.val}" for="a" /> </ui:repeat> </h:form> (get rid of the varStatus if you don't use it) public void listen(BoxTuple tuple) { if...

Get to specific book using hyperlink in JSF [duplicate]

jsf,jsf-2

Try to change the column title in listGames.xhtml to : <h:column> <f:facet name="header"> <h:outputText value="Title"/> </f:facet> <h:commandLink value="#{item.title}" action="#{gameController.searchGames(item.title)}" /> </h:column> Then, adapt the action method in the backing bean to : public String searchGames(String tit) { sgameList = gameEJB.findGamesByTitle(tit); return "resultsGames.xhtml"; } ...

Path to a file up in the hierarchy

jsf,jsf-2,navigation

The navigation outcome represents a view ID. If it does not start with /, then it is interpreted relative to the current path. If it starts with /, then it is interpreted relative to the web root. So, just use /index. return "/index"; Unrelated to the concrete problem, you should...

Distinguish view from normal view in ViewHandler#createView()

jsf,custom-error-pages,viewhandler

When the servlet container dispatches to an error page, it will set a bunch of special error page related attributes in the current HTTP servlet request. The keys are identified by those ERROR_XXX constant field values in RequestDispatcher class. Among others, the original request URI for which the error page...

Output data from database in JSF page

database,jsf,jsf-2

JSF is just an MVC framework to develop web applications in Java. JSF doesn't associate with any data source at all. The only data JSF will use is retrieved from: The data already stored in the proper object as attribute: HttpServletRequest, HttpSession or ServletContext. The request/view/session/application context in form of...

CommandButton execution while rendering

jsf,primefaces

The action attribute is intented to execute a backing bean action method on click, not to print some JavaScript code (which of course get executed immediately You perhaps meant to use onclick or oncomplete instead. Like as in basic HTML, those on* attributes are intented to execute some JavaScript code...

Portlet IPC after recieved Event

jsf,events,event-handling,ipc,portlet

You need to programmatically get your ManagedBean via the ELContext. Here's how you should do it: String elExpression = "#{studentsModelBean}"; ELContext elContext = facesContext.getELContext(); ValueExpression valueExpression = facesContext.getApplication().getExpressionFactory().createValueExpression(elContext, elExpression, StudentsModelBean.class); StudentsModelBean studentsModelBean = (StudentsModelBean) valueExpression.getValue(elContext); String hskaId = (String) event.getValue(); studentsModelBean.setStudent(hskaId); String...

Setting f:setPropertyActionListener value with a f:param value

jsf,jsf-2,param,setpropertyactionlistener

The <f:param> (and <ui:param>) doesn't work that way. The <f:param> is intented to add HTTP request parameters to outcome of <h:xxxLink> and <h:xxxButton> components, and to parameterize the message format in <h:outputFormat>. The <ui:param> is intented to pass Facelet context parameters to <ui:include>, <ui:decorate> and <ui:define>. Mojarra had the bug...

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

jsf,message

The client ID in addMessage() must be valid in order to get the message to show up at the desired place. You already took into account that the <h:form> is a NamingContainer and thus prepends its component ID to the client ID of the children. However, you overlooked that <p:accordionPanel>...

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

jsf,servlets,jsf-2

Not until the first HTTP request is fired. The domain/host/base is namely configured completely independently from the web application (on the appserver and/or proxy server, if any). If it's not an option to lazily set it as an application wide variable during the 1st HTTP request in e.g. a servlet...

Show image as byte[] from database as graphic image in JSF page

image,jsf,bytearray

This is not directly possible with <h:graphicImage>. It can only point to an URL, not to a byte[] nor InputStream. Basically, you need to make sure that those bytes are directly available as a HTTP response on the given URL, which you can then use in <h:graphicImage> (or even plain...

Submit form without attached file

jsf,jsf-2.2

You have your inputFile as required. That is why you have to upload first always. Also, if you are not seeing any message it's because you are not rendering again your h:message. Try using this in your managed bean: FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds() .add("idMessage"); ...

Wildfly 8.2 + JSF + SessionScoped : sometimes wrong data returned

jsf,session,cdi,wildfly,jboss-weld

It seems we did encounter a Wildfly 8.2 bug, located in Weld. See this jira for more information : https://issues.jboss.org/browse/WFLY-4753 The fix has been to patch Wildfly with this patch : http://sourceforge.net/projects/jboss/files/Weld/2.2.12.Final Thank you all...

p:orderList converter getAsObject() doesn't call Object.toString()

jsf,primefaces,converter

Converters basically serve to transform values in 2 directions: Server to client, when the value is rendered. Client to server, when the value is submitted. In your getAsString you established, that the string representation, the one which client uses, is exampleEntity's number. So that's what gets rendered to client as...

h:outputStylesheet inside ui:repeat

jsf,facelets,jsf-2.2,uirepeat,outputstylesheet

The <h:outputStylesheet> (and <h:outputScript>) needs to be present during view build time in order to let the JSF resource management to properly pickup them. The <ui:repeat>, however, runs during view render time only, it would be too late for JSF to perform relocation actions (moving to bottom of head or...

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

maven,jsf,tomee

Simply get rid of the in the exception mentioned <listener> entry in webapp's web.xml. TomEE ships with MyFaces, not Mojarra. That Mojarra-specific <listener> entry in web.xml is usually auto-included by some IDEs trying to be smarter than they are and/or left behind in poor quality open source projects. Be careful...

DynaForm Primefaces extensions gather submitted data

jsf,primefaces,primefaces-extensions

As stated by the Primefaces Extensions Showcase, something like this will do the trick: List<FilledMessageField> fields = new ArrayList<FilledMessageField>(); for (DynaFormControl dynaFormControl : model.getControls()) if (dynaFormControl.getData() instanceof FilledMessageField) fields.add((FilledMessageField) dynaFormControl.getData()); But just out of curiosity, why do you iterate over FilledMessageField f:allfieldMessageList, if you don't use f? You may aswell...

dataTable doesn't show list [duplicate]

postgresql,jsf,datatable

I've found the solution guys! Hope this helps for someone that had my same problem. I added this @PostConstruct public void init() { prodotti = pFacade.getCatalogoProdotti(); } in the prodottoController bean, and now it shows all the products on the database!! That PostConstruct must be used everytime we use a...

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

ajax,jsf,richfaces,ajax4jsf

The problem was identified: Each "option" generated by the t:selectItems tag was with the item id instead of an index, while the comboConverter was using an index to select the item. So, the list had 12 items (indexes should range from 0 to 11), but the id of the selected...

Render outcome of “action” attribute?

jsf,attributes,action,renderer

As always, BalusC was right. There is no generated Javascript. But there was another thing i forgot about. One needs to add the following code: button.queueEvent(new ActionEvent(button)); in the decode method of the according component renderer, where "button" is the UIComponent parameter of the "decode" method. Thanks a lot BalusC...

selectonemenu, when editable=false, cannot submit the form

jsf,primefaces

The reason why method is not called is, that conversion of values fails. Country field CountriesConverter method getAsObject should have return type Object, I expect it's not called at all now. Country class must implement the equals and hashCode methods. Timezone field The timezoneOffset property of the User class must...

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

jsf,jsf-2,primefaces,omnifaces

This is how I got it worked for me. In the implementation of the Omnifaces ListConverter, the getAsObject method is using the list to find the value and update the target and source of dualList. NOTE: you will get either a new value added in target (List=".getSource") or a new...

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

ajax,jsf,jsf-2,jsf-2.2,wildfly

This is a bug in Mojarra. I've just reported it as issue 3968. For now, one work around is to pass them as EL method arguments instead. <h:form enctype="multipart/form-data"> <h:commandButton value="Submit" action="#{bean.action(true)}"> <f:ajax execute="@this" render="@this"/> </h:commandButton> </h:form> public void action(boolean myparam) { // ... } ...

JSF: Is there a way to bind method to h:outputLink?

jsf

An output link is just a normal HTML link, so a conventional way to do this is with a query parameter, e.g. /contentarea.xhtml?myparam=value. I don't think you should bind a method to the output link. That would involve a Javascript onclick handler (commandLink), and I don't think that's necessary here....

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

jsf,composite-component,resourcebundle,properties-file

Composites have implicit support for resource bundles via #{cc.resourceBundleMap}. This only prerequires: Bundle file is placed in same (sub)folder as composite XHTML itself. Bundle file has exactly the same filename (prefix) as composite XHTML itself. So, if you restructure a bit, WebContent |-- resources | `-- mylib | |-- mycomponent.css...

How can I selectall visible rows in an icefaces ace:datatable?

jsf,datatable,icefaces

So I created a function "doSelectAllRows" which is a copy of "doMultiRowSelectionEvent" but has the following changes: ice.ace.DataTable.prototype.doSelectAllRows = function () { var self = this, tbody = ice.ace.jq(this.jqId).find('.ui-datatable-data'), elemRange = tbody.children(), deselectedId, firstRowSelected; // Sync State // self.readSelections(); ...

Ajax Rerender working for selectOneMenu, but not input text

jsf,richfaces

<a4j:support> works with JSF components. Replace your <input type="text"> by <h:inputText>.

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

ajax,jsf,file-upload,jsf-2.2,mojarra

I reproduced it. It is a bug in Mojarra, introduced in 2.2.9 as side effect of the fix for issue 3129. Your problem is already reported as issue 3765. Basically: uploading files with ajax is broken since Mojarra 2.2.9 and there are no workarounds (at least not without hacking in...

JSF Composite Component with conditional popup panel

jsf,richfaces,el,composite-component

The oncomplete attribute of the <a4j:commandLink> component must evaluate to a String. Here, your EL tries to invoke either a showMessage() or a submitToServer() java method depending on a boolean value, which are not found. what you want is a String with the JS function name, so just put function...

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

jsf,jpa

There is no way to retrieve the ID before persisting - simply because it has no ID until you persist your entity. This has nothing to do with your strategy. It has something to do with concurrence. But you can add your own temporary key for your use case: @Entity...

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

jsf,file-upload,glassfish,jsf-2.2,prettyfaces

Found a sufficient solution, was posted here on stackoverflow.com before: Fileupload and PrettyFaces and JSF 2.2 Not pretty, but it works....

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

jsf,tomcat,jpa,cdi,jta

Yes. Except of JAAS. ​​​​​​​​...

Render hidden elements using JSF and AJAX

ajax,jsf,jsf-2.2

You can't ajax-update a plain HTML element. You can only ajax-update a JSF component. Simple reason is that the target must be resolveable by UIViewRoot#findComponent(), so that JSF can find it in the component tree and render the updated HTML into the Ajax response. Replace <div id="addedBooksTable"> by <h:panelGroup layout="block"...

Override rendering with a custom renderer

ajax,jsf,custom-renderer

You can override the <f:ajax> renderer by creating a custom ClientBehaviorRenderer implementation and register it as <client-behavior-renderer> in faces-config.xml on renderer type javax.faces.behavior.Ajax. public class YourAjaxBehaviorRenderer extends ClientBehaviorRenderer { @Override public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior) { return "alert('Put your JS code here.')"; } } <render-kit> <client-behavior-renderer>...

commandButton action method not invoked in Liferay

jsf,liferay,portlet

Im not sure why, but after adding this line to my liferay-portlet.xml it fixed it. <requires-namespaced-parameters>false</requires-namespaced-parameters> And here the 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> ...

Primefaces validation not working

jsf,jsf-2,primefaces

You need to move the <p:message> tags outside of the <p:inputText> tags like this: <p:inputText id="name" value="#{userData.name}" label="name" > <f:validateLength minimum="7" /> <p:ajax execute="currentInput" update="msgLastname" event="blur" process="@this"/> </p:inputText> <p:message for="name" id="msgLastname" display="icon" style="color:red" /> <p:inputText id="lastname" value="#{userData.lastname}"> <f:validateLength minimum="5"/> <p:ajax execute="currentInput" update="msg"...

JSF Property not found exception. porperty not readable

jsf,cdi,el

fixed it: Must be public class FeedbackController implements Serializable { thanks to BalusC for helping me out!...

primefaces treetable expand not working if jsf page location is changed

spring,jsf,spring-mvc,jsf-2,primefaces

I also had this issue. I did resolve with steps below: Step 1: move your XHTML files into webcontent folder. Step 2: Since all the files in webcontent are allowed for public access, you need to add the below entry in web.xml for security reason. Please follow the link for...

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

jsf,jsf-2,subclass,managed-bean

The BaseBean is wrongly designed. Bean management annotations are not inherited. It does technically not make any sense to have multiple instances of different subclasses registered on the very same managed bean name/identifier. The BaseBean class must be abstract and not have any bean management annotations (so that neither you...

Double dispatching in jsf

jsf,jsf-2

The <f:event listener> does not support navigation case outcomes. Only the JSF 2.2 <f:viewAction action> does. Perhaps you're confusing with it. You need to make it a void method and navigate/redirect manually. public void doDoubleDispatch() { // ... FacesContext context = FacesContext.getCurrentInstance(); NavigationHandler navigationHandler = context.getApplication().getNavigationHandler(); navigationHandler.handleNavigation(context, null, "finalView"); }...

Omnifaces - ListIndexConverter, principle of operation

jsf,converter,omnifaces

When and by whom is the list member variable filled? By <o:converter list> attribute, exactly as shown in Usage section at showcase. <p:pickList value="#{bean.dualListModel}" var="entity" itemValue="#{entity}" itemLabel="#{entity.someProperty}"> <o:converter converterId="omnifaces.ListIndexConverter" list="#{bean.dualListModel.source}" /> <!-- ===================================================^^^^ --> </p:pickList> The <o:converter> is a special taghandler which allows setting arbitrary properties on the...

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

javascript,jsf,callback,commandbutton

Probably, jsf creates a new id for the button so document.getElementById('editButton') does not work. In order to solve this you may add an arbitrary style class to button like; styleClass="button myButtonToClick" and javascript should be like this; var x =document.getElementsByClassName("myButtonToClick"); x[0].click(); ...

Every include should refer to other instance

jsf,jsf-2,reference,uiinclude

You'll have to hold as many instances of editorVisibility.evb as you have editors. You could for example create a List<TypeOfEvb> evbList in your EditorVisibility bean, and pass only one element to the <ui:include> as a <ui:param>: Main page <ui:include src="include/includeAbleEditor.xhtml"> <ui:param name="includeParam" value="MyClass" /> <ui:param name="evb" value="#{editorVisibility.evbList[0]}" /> </ui:include> includAbleEditor.xhtml...

Output and Command Link in one in JSF

jsf,hyperlink,action

You could use <f:setPropertyActionListener>. <h:commandLink value="Edit" action="edit?faces-redirect=true"> <f:setPropertyActionListener target="#{bean.id}" value="#{id}" /> </h:commandLink> Or you could abuse actionListener. <h:commandLink value="Edit" action="edit?faces-redirect=true" actionListener="#{bean.setId(id)}" /> Both ways, however, would require a session scoped bean to remember the chosen id, which is plain awkward. When you open such link multiple times in different browser...

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

eclipse,jsf,jsf-2.2,wildfly-8

Don't wan't to disagree with BlagusC (the one and only here ;-) ) but for normal changes "hotdeployment" should work fine. Only if you change backing beans structure (e.g.: add methods, add classes) restart is needed. Important thing is that you start the server in debug mode - here are...

How to get a Http Session while a servlet is being initialised? [duplicate]

jsf,servlets,lifecycle,httpsession

You can't. The init() method is invoked when the application is deployed and the servlet is initialized. No one has connected yet to the application at this time, and the code is thus not executing as part of any request handling. So there's no session. That's like wanting to get...

Conditionally render components with ajax conditionally only if validation passes

validation,jsf,jsf-2.2,conditional-rendering

You can make use of FacesContext#isValidationFailed(). It will return true if validation has failed in the current JSF lifecycle. The current instance of FacesContext is available also in EL as #{facesContext}. Just check it in the rendered attribute and update its parent placeholder component. Do note that you can't conditionally...

Creating command links dynamically from a managed bean

jsf

This is not the right way to "dynamically" create markup. For that you should be using XHTML, and absolutely not Java and for sure not massage some plain HTML in the model and present it with escape="false". That's plain nonsense. You're basically mingling the view into the model. You need...

How to define a style for ul which appears automatically [duplicate]

css,jsf

form#stackForm table#stackForm\:stack ul{ background-color:red; } This should work....

JSF facets not available in Eclipse

java,eclipse,jsf,facets

That can happen if you started with plain "Eclipse IDE for Java Developers" instead of with "Eclipse IDE for Java EE Developers" and then manually added some plugins on it. Throw away your current Eclipse install and restart clean with "Eclipse IDE for Java EE Developers".

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

jsf,jsf-2,disabled-control

You can use OmniFaces <o:massAttribute> for this. <o:massAttribute target="javax.faces.component.UIInput" name="disabled" value="#{bean.disabled}"> <ui:include ... /> </o:massAttribute> An alternative is a SystemEventListener as answered in this question: How to disable elements from within a ViewHandler after jsf has embedded the composite component? But that would apply on the entire web application and...

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

jsf,post,single-sign-on,commandlink

A redirect instructs the client to create a new GET request on the specified URL. That's why you see it being reflected in browser's address bar. As to performing a POST to an external site, you don't necessarily need JSF here. You're not interested in updating JSF model nor invoking...

JSF render dir=“rtl” when language is arabic

jsf,localization,dir,conditional-rendering

The client's Accept-Language is indirectly available via UIViewRoot#getLocale(). The UIViewRoot is in turn in EL available as #{view}. So, this should do: <h:inputText ... dir="#{view.locale.language eq 'ar' ? 'rtl' : 'ltr'}" /> Note that the dir is also supported on all other components and HTML elements, such as <h:form> and...

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

css,jsf,primefaces

If you look at the documentation for this tag (here), you'll see that: url => Url to be navigated when menuitem is clicked. That's why your page reloads when you click an item. Probably removing this attribute will stop the reload action from happening. Then you'll probably want to use...

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

jsf,jsf-2,primefaces,datatable

I didn't find any solution to above problem.So, I manually overrided the css of second table generated by the above p:datatable. My css is: <style> .ui-datatable-frozenlayout-right .ui-datatable-empty-message td { display: none; //or visibility:hidden; } </style> ...

RichFaces 4 ExtendedDataTable - Selecting rows programmatically

javascript,jsf,richfaces

You can just go with #{rich:component('tableId')}, the function calls clientId internally anyway. #{rich:component('rich:clientId('tableId')')} This should be getting you a parse error. Single quotes mark a string, not a method argument....

Change Label during AJAX call

jsf

If you want the label to be changed only during the Ajax call: function handleDisableButton(data) { data.source.text = 'processing...'; } The initial label will be restored on form update. If you want it to be permanently changed, bind its value to a backing bean parameter and change it in the...

How to prevent JSF from initializing automatically?

jsf,tomcat,mojarra

It's loaded via a Servlet 3.0 ServletContainerInitializer implementation in the JSF implementation JAR file (in case of Mojarra, it's the com.sun.faces.config.FacesInitializer). It will auto-register the FacesServlet on the URL patterns *.jsf, *.faces and /faces/* (JSF 2.3 will add *.xhtml to the list of URL patterns). Latest JSF 2.1 implementations and...

Ajax update of datatable from a modal after filtering

ajax,jsf,primefaces,datatable

It was my mistake to mention the id in place of the widgetVar. This: oncomplete="PF('myTableWidget').filter()" would work fine if the dataTable in question looks like: <p:dataTable id="myTable" widgetVar="myTableWidget"... I was wrongly trying it this way: oncomplete="PF('myTable').filter()" ...

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

jsf,button,checkbox,toggle

I've decided to go with an ICEfaces solution and use their ace:checkboxButton: <ace:checkboxButton value="#{cc.attrs.singleSelect}" styleClass="toggle"> <ace:ajax render="#{cc.clientId}"/> </ace:checkboxButton> You are able to style it to use images: http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=checkboxButtonCustom...

Using ui:repeat to iterate over columns

jsf,jsf-2

Using c:foreach instead of ui:repeat as suggested by @Kukeltje will probably work, but the proper way to create dynamic columns by iterating over a Collection would rather be using the <rich:columns> component. From https://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_columns.html: The <rich:columns> component gets a list from data model and outputs a corresponding set of columns...

JSF Validators do not work if Random or SecureRandom used to generate component ID

jsf,jsf-2.2,mojarra,programmatically-created

Component IDs are not stored in JSF view state. They are like components themselves thus basically request scoped. Only stuff which is stored in JSF view state is basically view scoped. I.e. the stuff which components put/get via getStateHelper() method. The getId()/setId() methods doesn't do that. When JSF needs to...

How to use line chart extender attribute in primefaces 5.2

javascript,jsf,primefaces,xhtml,jqplot

You should now set your extender from your model in your chartViewLine bean. LineChartModel model = new LineChartModel(); model.setExtender("chartExtender"); Attribute extender has been removed in PrimeFaces 5.0 (see also list of p:chart attributes from PrimeFaces 5.0 Documentation)...

h:commandButton action method is not invoked [duplicate]

jsf,jsf-2.2

this work for me My file in folder path WEB-INF\pages\forms cod in xhtml file <h:commandLink value="Download" action="#{formBean.downloadFile('FileName.doc')}" styleClass="link"/> beans public String downloadFile(String fileName) { try { FacesContext facesContext = FacesContext.getCurrentInstance(); HttpServletResponse response = ((HttpServletResponse) facesContext.getExternalContext().getResponse()); String reportPath = facesContext.getExternalContext().getRealPath("\\pages\\forms") + File.separator + fileName;...

JSF Controller, Service and DAO

jsf,java-ee,jpa,ejb,dao

Is this the correct way of doing things? Apart from performing business logic the inefficient way in a managed bean getter method, and using a too broad managed bean scope, it looks okay. If you move the service call from the getter method to a @PostConstruct method and use...

Why won't my JSF app deploy to GlassFish?

jsf,netbeans,glassfish

The problem was caused by a compile error in my code, which didn't show up until I did a complete "Clean and Build" ...and this couldn't be done until I shut-down the GlassFish server. Conclusion: If the problem occurs try shutting down the GlassFish server and doing a complete "Clean...

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

jsf,numbers,converter,oracle-adf

You are using the property maxFractionDigits="2", use minFractionDigits="2" for this: <af:convertNumber groupingUsed="true" type="number" messageDetailConvertNumber="#,###,##" maxFractionDigits="2" minFractionDigits="2"/> Take a look at the JSF Converters Documentation for further information about it....

message always shown in the same language instead of configuring the browser not to

jsf,localization,faces-config

I finally managed to find the error. I changed the messages.properties file name to messages_en.properties and it works well.

How to declare the backing bean's name only once in a JSF facelet?

java,jsf

both <c:set var="foo" value="#{lengthyBeanName}" /> and <ui:param name="ctrl" value="#{ctrlBeanName}" /> did the trick. But it does of course not really solve the core problem (namely that some primefaces components as e.g. dataTable do not complain when a non-existing bean is uses to load the data/collection)...

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

java,jsf,jboss-arquillian,omnifaces

After trying to run a built war and running it on Wildfly standalone, I managed to narrow the problem to Arquillian, after testing Arquillian+Glassfish embedded and running without problems, I figured the issue was Arquillian+Wildfly, some more googling around and I found similar issues that were related to using Wildfly...

Re-create session scoped JSF managed bean programmatically

jsf,jsf-2,managed-bean,session-scope,recreate

Invalidate the session, to destroy a session scoped bean: FacesContext.getCurrentInstance().getExternalContext().invalidateSession(); Another option to log out from Spring Security is to clear the context: SecurityContextHolder.clearContext(); ...

Refresh parent node from backing bean with primefaces tree

jsf,primefaces,tree

Actually I found a way to achieve this functionality. <h:form id="frmHierachiManage" styleClass="treeForm"> -- tree inside this form </h:form> then in the backing bean, RequestContext.getCurrentInstance().update("frmHierachiManage"); this updated the tree view....

Execute onevent with values changed by listener

javascript,ajax,jsf

I cannot seem to find a link/post of adding callback parameters in an ajax call without using PrimeFaces or OmniFaces Ajax But you can always do something like updating a part of the page that contains a javascript function which you update in the ajax call and contains/returns the EL...

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

jsf,jsf-2,primefaces,datatable

But MOST of all, Take a look at the first selection example in the PrimeFaces showcase http://www.primefaces.org/showcase/ui/data/datatable/selection.xhtml

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

jsf,jsf-2,primefaces

Try: <welcome-file-list> <welcome-file>faces/index.xhtml</welcome-file> </welcome-file-list> The index.xhtml page should use the Faces-Servlet....