Slider: NullPointerException when using in dynamic TabView
See original GitHub issue1) Environment
- PrimeFaces version: 7.0.1
- Does it work on the newest released PrimeFaces version? Version? no
- Does it work on the newest sources in GitHub? (Build by source -> https://github.com/primefaces/primefaces/wiki/Building-From-Source) no
- Application server + version: Wildfly 16
- Affected browsers: IE, Chrome, Firefox
2) Expected behavior
When submitted the given form I do not expect a NullPointerException to be thrown.
3) Actual behavior
A NullPointerException is thrown
4) Steps to reproduce
Use the given example (extended example from PrimeFaces Demo of Slider), when clicking the “ok” button then following error is thrown:
Caused by: java.lang.NullPointerException
at deployment.infoChantier-wildfly16-PROD.war//org.primefaces.component.slider.Slider.validate(Slider.java:106)
The error seems to be coming from the “getSubmittedValue” funtion in the Slider.java.
The line:
return input.getSubmittedValue() == null && input.isLocalValueSet() ? input.getValue() : input.getSubmittedValue();
returns “NULL” because the “isLocalValueSet” return “false” and so the “getSubmittedValue” is returned which is “NULL” whereas the “getValue” would return the right number.
I do not know if this helps but this is as far as I came.
5) Sample XHTML
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<f:view>
<h:head>
<title>InfoChantier</title>
</h:head>
<h:body>
<h:form>
<p:tabView dynamic="true" rows="20" value="#{sliderView.tabs}" var="tab">
<p:tab title="#{tab}">
<h:panelGrid columns="1" style="margin-bottom: 10px">
<h:outputText id="displayRange" value="Between #{sliderView.number8} and #{sliderView.number9}" />
<p:slider for="txt6,txt7" display="displayRange" style="width: 400px" range="true" displayTemplate="Between {min} and {max}" />
</h:panelGrid>
<h:inputHidden id="txt6" value="#{sliderView.number8}" />
<h:inputHidden id="txt7" value="#{sliderView.number9}" />
</p:tab>
</p:tabView>
<p:commandButton value="Ok" />
</h:form>
</h:body>
</f:view>
</ui:composition>
6) Sample bean
package lu.etat.pch.infoChantier.ejb.controllers;
import javax.inject.Named;
@Named
public class SliderView {
private int number8 = 30;
private int number9 = 80;
public int getNumber8() {
return number8;
}
public void setNumber8(int number8) {
this.number8 = number8;
}
public int getNumber9() {
return number9;
}
public void setNumber9(int number9) {
this.number9 = number9;
}
public String[] getTabs() {
String[] result = new String[2];
result[0] = "Tab 1";
result[1] = "Tab 2";
return result;
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Why is Tablayout and Viewpager crashing with ...
Why is Tablayout and Viewpager crashing with NullpointerException when I start a fragment with LoaderManager from TabFragment?
Read more >TabView dynamic="true" error - Prime Community Forum
I have a problem with TabView and the attribute dynamic="true". ... I'm using PrimeFaces 3.5 with GlassFish 3.1.1 ... NullPointerException at java.io.
Read more >Getting NullPointerException, the getCurrentInstance() in the ...
I am trying to implement dynamic tabs using ADF Dynamic UI Shell. After clicking on a link, a dynamic tab opens up which...
Read more >Primefaces Tree, TreeNode, TreeTable Example Tutorial
Specifies caching on dynamically loaded nodes.When set to true expanded nodes will be kept in memory. onNodeClick, null, String, Javascript ...
Read more >Fix list for IBM Business Automation Workflow
JR64286, CACHED ENTRIES CANNOT BE SAVED TO DISK WHILE USING DYNAMIC CACHE ... JR64511, A NULLPOINTEREXCEPTION IS THROWN AND CASE EVENT EMITTER STOPS ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mertsincan can be ported to elite
I am going to close this as a Mojarra issue. We can re-open if we determine its anything other than that.