myfaces

Convert empty number as null

馋奶兔 提交于 2019-12-22 18:16:13
问题 is there a possibility to tell my JSF-implementation to convert empty numbers as null. So far I always get 0 (of the corresponging complex-type). For empty strings there is javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL , but I couldn't find anything for numbers. By the way: No, I can't use the vm-argument: -Dorg.apache.el.parser.COERCE_TO_ZERO=false Is a custom-numberconverter my only possibility? 回答1: No, I can't use the vm-argument: -Dorg.apache.el.parser.COERCE_TO_ZERO=false

f:param doesn't work with h:commandButton

主宰稳场 提交于 2019-12-22 13:01:22
问题 i'm using eclipse 3.6.2 (Helios) , Tomcat 7 , MyFaces 1.2.9 i have no problem when i use f:param into the h:commandLink but when i put f:param into h:commandButton it doesn't work . what's the problem ? this sample work fine : <h:commandLink value="Click here" action="#{myBean.action}"> <f:param name="parameterName1" value="parameterValue1" /> <f:param name="parameterName2" value="parameterValue2" /> </h:commandLink> but it doesn't <h:commandButton value="Click here" action="#{myBean.action}"

JSF 2.0 javascript onload/oncomplete

笑着哭i 提交于 2019-12-21 22:46:44
问题 I'm working with Myfaces 2.0 after a long project using MyFaces 1.1 + Tomahawk + Ajax4JSF. 2.0 is definitely a huge improvement. Although I can't seem to get an onload javascript to work. I stuck this in my head: <script type="text/javascript"> window.onload = function () { var fileDownload = document.getElementById('userManagementForm:fileDownload'); if (fileDownload.value == 'true') { fileDownload.value = false; window.open('Download'); } } </script> But it doesn't execute. I looked a bit

JSF 2.1 ViewScopedBean @PreDestroy method is not called

不想你离开。 提交于 2019-12-20 10:57:16
问题 I have a method in a view Scoped Bean with the @PreDestroy annotation and another one with the @PostConstruct annotation. The @PostConstruct method is properly called every time I navigate to the page that uses this view scoped bean. However, when I navigate to a new page (which doesn't use this view scope bean) by <h:link/> , the @PreDestroy method is never called. I am not talking about changing manually the url or the end of the session, just of a navigation case. What I am missing? Thanks

ViewExpiredException

一笑奈何 提交于 2019-12-20 05:27:12
问题 I am using JSF 2 ,primefaces 2.2.RC2 ,google-appengine I recently moved from myfaces-2.0.0.beta3 to myfaces-bundle-2.0.3. With this new version, I am getting the below exception very frequently,much before the actual session timeout. /login.jsfNo saved view state could be found for the view identifier: /login.jsf Caused by: javax.faces.application.ViewExpiredException - /login.jsfNo saved view state could be found for the view identifier: /login.jsf I have set my session timeout to 10 mins.

PrimeFaces 4.0 FileUpload works with Mojarra 2.2 but not MyFaces 2.2

白昼怎懂夜的黑 提交于 2019-12-20 05:19:25
问题 I am having an interesting problem with the PrimeFaces 4.0 final FileUpload element. I am trying to run: PrimeFaces 4.0 final Apache MyFaces 2.2.0-beta Tomcat 7.0.27 I have a very simple setup right now, XHTML page: <?xml version="1.0" encoding="UTF-8"?> <!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" xmlns:f="http://java.sun.com/jsf/core"

NullPointerException in MyFaces facelet inclusion

回眸只為那壹抹淺笑 提交于 2019-12-20 04:27:10
问题 I'm trying to migrate simple JSF2.2 prototype from Mojarra 2.2.5 (... where works fine ...) to MyFaces 2.2.3 but a NullPointerException occurs. What I normally do using Mojarra is to include (inject) programmatically a JSF page within a container. The sample inclusion page ( inclusion.xhtml ) is: <h:panelGroup id="container"> </h:panelGroup> <h:form> <h:commandButton value="Include page" action="#{inclusion.include('included.xhtml')}" /> </h:form> The included page ( included.xhtml ) contains

Custom JSF component: Using “startElement” with “script” results in a comment

≡放荡痞女 提交于 2019-12-19 10:48:20
问题 I'm rendering a custom JSF component. In the method encodeBegin I want to include some java script. public void encodeBegin(FacesContext context) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("script", this); writer.writeAttribute("type", "text/javascript", null); writer.writeText("var width=400",null); writer.endElement("script"); } When rendering the component the content of the script tag is commented out. <script type="text/javascript"><!--

How to force WebSphere AS 8 to use a specific JSF implementation?

青春壹個敷衍的年華 提交于 2019-12-19 09:05:52
问题 I have an old enterprise application that was developed using WAS 6.1, now my company is trying to perform the implementation of that application in WAS 8. But I am having troubles rendering the JSF content, there are some links that when clicked the JS debugger says Uncaught ReferenceError: myfaces is not defined being the rendered HTML: onclick="return myfaces.oam.submitForm('top_nav:frmTopNav','top_nav:frmTopNav:lnkCP',null,[['default_sort','name']]);" So I think it's not rendering it well

What is viewstate in JSF, and how is it used?

元气小坏坏 提交于 2019-12-17 15:38:53
问题 In JSF, there is a viewstate associated with each page, which is passed back and forth with submits etc. I know that viewstate is calculated using the states of the various controls on the page, and that you can store it either client side or server side. The question is: how is this value used? Is it used to validate the values sent at submit, to ensure that the same request is not sent twice? Also, how is it calculated - I realise that richfaces may be calculated differently from myfaces,