jsf-2

Exception thrown in @PostConstruct causes IllegalStateException in JSF 2.1

半腔热情 提交于 2020-01-15 11:26:11
问题 I have an init method on my @ViewScoped mananged bean. In the post construct i load data from the db. I have a custom ExceptionHandlerWrapper to catch all excptions and send to an error pages. However when @PostConstuct throws an exception i recieve an IllegalStateException and am not redirected to the error page. I have tried many combinations..... Ive tried this inside my ExcpetionHandler externalContext.getRequestMap().put(ERROR_BEAN_ID, ERROR_TEXT); externalContext.dispatch(ERROR_PAGE);

h:commandLink open in new browser window

落爺英雄遲暮 提交于 2020-01-15 10:45:21
问题 I want to open a new window, configured with height and width, all while using < h:commandLink > <h:commandLink id="zyzid" value="click me" action="#{test.testDo}" target="_blank" /> this renders into: <a onclick="mojarra.jsfcljs(document.getElementById('myForm'),{'myForm:xyzid':'myForm:xyzid'},'_blank');return false" href="#" id="myForm:xyzid">click me</a> I looked at jsfcljs() function. It submits the form with target="_blank", but i don't see window.open() anywhere. So, how would I be able

Center component on jsf page

自古美人都是妖i 提交于 2020-01-15 10:23:27
问题 I was trying to center the component in jsf page, it looks sth like this: <p:panel header="Enter your credentials:" style="vertical-align:middle;"> <h:panelGrid columns="2" styleClass="panelGridCenter"> <h:outputText value="Login: " /> <p:inplace id="Login"> <p:inputText value="Enter login" /> </p:inplace> </h:panelGrid> </p:panel> I've tried to enter sth like this: style="vertical-align:middle;" I've tried to use a css class (I've had almost no experience with css): .panelGridCenter { margin

Center component on jsf page

删除回忆录丶 提交于 2020-01-15 10:23:20
问题 I was trying to center the component in jsf page, it looks sth like this: <p:panel header="Enter your credentials:" style="vertical-align:middle;"> <h:panelGrid columns="2" styleClass="panelGridCenter"> <h:outputText value="Login: " /> <p:inplace id="Login"> <p:inputText value="Enter login" /> </p:inplace> </h:panelGrid> </p:panel> I've tried to enter sth like this: style="vertical-align:middle;" I've tried to use a css class (I've had almost no experience with css): .panelGridCenter { margin

Primefaces - custom component for live filtering in dataTable

被刻印的时光 ゝ 提交于 2020-01-15 09:13:35
问题 PrimeFaces has very well done filter for p:dataTable. It is great from UX site, because the filter field is in column header, so there's no doubt what you are filtering, and it's working live - the data changes as you type (well, only if you make a short pause, but it's in my opinion exactly what user expects). Now I'd like to place something custom in the header that would act as filter. So, my idea was to place a component in header facet: <p:column ...> <f:facet name="header"> <some

Primefaces - custom component for live filtering in dataTable

孤街浪徒 提交于 2020-01-15 09:13:10
问题 PrimeFaces has very well done filter for p:dataTable. It is great from UX site, because the filter field is in column header, so there's no doubt what you are filtering, and it's working live - the data changes as you type (well, only if you make a short pause, but it's in my opinion exactly what user expects). Now I'd like to place something custom in the header that would act as filter. So, my idea was to place a component in header facet: <p:column ...> <f:facet name="header"> <some

What JSF data can I store in a client browser

十年热恋 提交于 2020-01-15 06:02:04
问题 I'm interested can I store into client side for example large hashmap or a List? I need something like a temporary cache to store user session data. 回答1: In theory, you could use HTML5 client side storage in JavaScript. So far now, no JSF components exists which could do the job transparently. You'd need to write all the necessary JS code yourself or grab jQuery. All JSF as being a HTML code generator can do for you is to print Java objects in JSON format as a JavaScript variable assignment

After post is setting a value in JSF2 flash scope, it is visible again on second GET request to a page (Flash scope considered harmful)

陌路散爱 提交于 2020-01-14 14:43:07
问题 I tested new Flash scope in JSF2 but I found a major issue with it or I am lacking some knowledge. Having a page: <h:body> Value in flash: #{flash.text} <h:form> <h:inputText value="#{flash.text}" /> <h:commandButton value="Test" /> <!-- Same behavior with faces redirect --> </h:form> </h:body> I have a scenario: Put a value 'foo' and click Test I get 'Value in flash: foo' I open new page with the same adress I get 'Value in flash:' I open another new page with the same adress I get 'Value in

How import a HTML code to JSF page?

不问归期 提交于 2020-01-14 14:13:01
问题 I'm trying to import this page to my JSF page which is gonna have database to get the data, to be more interactive. So I did this: <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <h:outputScript> var chart; $(document).ready(function

target=“_blank” in h:commandlink not opening page in new tab of browser

余生长醉 提交于 2020-01-14 12:32:18
问题 My h:commandLink is opening/previewing the pdf document on same page/window when h:commandlink used with target="_blank". I want it to be opened in new tab of the browser where can be the error? Preview.xhtml code: <h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_blank" > </h:commandLink> In previewuploadedFile() action encription/decryption and some other process with pdf is required that is why necessary to use and that is why