jsf-2.2

JSF 2.2 - File upload return java.lang.NullPointerException

蓝咒 提交于 2021-02-11 18:26:37
问题 <h:inputFile/> return a NullPointerException error. I know there is already a lot of stuff about this exception and uploading files with JSF but I've read it all without any success to diagnose this problem. I am using JSF 2.2 with GlassFish 4.1.1, without PrimeFaces or Tomahawk since you can handle the file upload with JSF 2.2. as I read. The goal is just to upload a picture on the remote filesystem, and copy the path to the DB to retrieve it later through a datatable. I've already checked :

JSF 2.2 - File upload return java.lang.NullPointerException

核能气质少年 提交于 2021-02-11 18:25:59
问题 <h:inputFile/> return a NullPointerException error. I know there is already a lot of stuff about this exception and uploading files with JSF but I've read it all without any success to diagnose this problem. I am using JSF 2.2 with GlassFish 4.1.1, without PrimeFaces or Tomahawk since you can handle the file upload with JSF 2.2. as I read. The goal is just to upload a picture on the remote filesystem, and copy the path to the DB to retrieve it later through a datatable. I've already checked :

Inject Omnifaces PushContext in a bean managed by Spring

柔情痞子 提交于 2021-02-10 15:06:12
问题 I have an JSF app running on WildFly 10 and Primefaces 6.2 and Omnifaces 2.6.2. My Beans are managed by Spring like this: @Controller @Scope("session") public class CompanySelectionController implements Serializable { I'm trying to implement Omnifaces WebSockets However when I try to inject PushContext like below: @Inject @Push private PushContext someChannel; it says "No qualifying bean of type [org.omnifaces.cdi.PushContext]" What should I do in this case? 来源: https://stackoverflow.com

Passing redirect-param in faces-config in jsf-2.2

倾然丶 夕夏残阳落幕 提交于 2021-02-07 17:10:04
问题 In old jsf the following code was working <navigation-rule> <from-view-id>/page1.xhtml</from-view-id> <navigation-case> <from-outcome>true</from-outcome> <to-view-id>/page2.xhtml</to-view-id> <redirect> <view-param> <name>id</name> <value>#{myBean.id}</value> </view-param> </redirect> </navigation-case> </navigation-rule> page1.xhtml code : <f:metadata> <f:viewParam id="id" name="id" value="#{myBean.id}" /> <f:viewAction action="#{myBean.init()}"/> </f:metadata> Java code : public class

Passing redirect-param in faces-config in jsf-2.2

烈酒焚心 提交于 2021-02-07 17:09:00
问题 In old jsf the following code was working <navigation-rule> <from-view-id>/page1.xhtml</from-view-id> <navigation-case> <from-outcome>true</from-outcome> <to-view-id>/page2.xhtml</to-view-id> <redirect> <view-param> <name>id</name> <value>#{myBean.id}</value> </view-param> </redirect> </navigation-case> </navigation-rule> page1.xhtml code : <f:metadata> <f:viewParam id="id" name="id" value="#{myBean.id}" /> <f:viewAction action="#{myBean.init()}"/> </f:metadata> Java code : public class

PrimeFaces 7.0 <p:textEditor HTML-sanitizer discards text formatting, such as centering

久未见 提交于 2021-01-28 13:52:56
问题 In PrimeFaces 8, it seems to be possible to enable / disable HMTML -sanitizer when using the <p:textEditor component by just specifying secure='false' for disabling it and secure='true' for enabling it. I tried to disable it in PrimeFaces 7.0 like this: <p:textEditor id="quillToolbarId" secure='false' widgetVar="editor2" height="300" value="#{editTemplatesBean.kaufAnbotTemplate}" placeholder="Enter your content"> but the sanitizer still seems to be working. My problem is that whenever I

How to enter a JSF 2.2 flow with faces-redirect

笑着哭i 提交于 2020-07-04 12:55:07
问题 I've got a basic flow example working: src/main/webapp | |- index.xhtml |- flow1 |- flow1-flow.xml |- flow1.xhtml index.xhtml has a simple form that enters the flow with a parameter: <h:form> Click to enter flow1 <h:commandButton action="flow1" value="Flow 1"> <f:param name="testInput" value="hi there"/> </h:commandButton> </h:form> flow1.xhtml displays the param and lets you enter a value into flow scope: <h:form> Hi this is page 1. <h:inputText label="Enter something:" value="#{flowScope

View declared in <protected-views> still accessible after manipulating CSRF token

前提是你 提交于 2020-06-25 13:38:28
问题 I'm exploring the new features in JSF 2.2 (pretty cool so far) but I still don't understand how Protected Views works, I created a facelet1 with a link to facelet2, like this: <h:link styleClass="link" value="Go to protected page" id="link1" outcome="/protected/facelet2.xhtml"></h:link> and in my faces-config.xml I added this: <protected-views> <url-pattern>/protected/facelet2.xhtml</url-pattern> </protected-views> Now when I run the page a token is added in the url: http://localhost:8080/

Mixing static and dynamic menu entries in PrimeFaces menu components

大兔子大兔子 提交于 2020-06-17 03:17:23
问题 I'd like to keep a part of my menu static in markup, and have another part dynamically generated in Java. <p:menubar> <p:menuitem value="static stuff"/> <p:submenu label="dynamic stuff" model="#{bean.dynamicMenu}"/> <!-- more static stuff --> </p:menubar> This shows only the static items and never calls my getDynamicMenu method cause p:submenu does not take a model attribute. I tried using ui:include within the menu structure to move the markup in an extra file and include that in different

Mixing static and dynamic menu entries in PrimeFaces menu components

≯℡__Kan透↙ 提交于 2020-06-17 03:16:28
问题 I'd like to keep a part of my menu static in markup, and have another part dynamically generated in Java. <p:menubar> <p:menuitem value="static stuff"/> <p:submenu label="dynamic stuff" model="#{bean.dynamicMenu}"/> <!-- more static stuff --> </p:menubar> This shows only the static items and never calls my getDynamicMenu method cause p:submenu does not take a model attribute. I tried using ui:include within the menu structure to move the markup in an extra file and include that in different