Showing posts with label Facelets. Show all posts
Showing posts with label Facelets. Show all posts

Tuesday, February 24, 2009

Comparing RIA Frameworks

If you are interested in RIA Frameworks you can have a look at that comparison http://sonymathew.blogspot.com/2009/02/comparing-ria-frameworks.html (Thanks to . ADF Oracle Faces RC you can find here, thanks to Juan Camilo Ruiz.
Unfortunately JavaFX as well as Microsoft Silverlight is not mentioned in that comparison. That's why you can find the "missing" JavaFX column here:


Platform/Technology: JavaFX/Java
User Experience: Modest Rich if you're familar with Java. Is exactly like a Desktop App. No Page refreshes, all data-access & rendering in the background. Includes also data-bindings from variables to GUI-widgets. JavaFX wraps some Swing components to use them in a JavaFX GUI. JavaFX 1.1 API
Browser Support: Support all browser. You can deploy JavaFX applications via an Java Applet, Java-WebStart (JNLP - Java Network Launching Protocol) or stand-alone applications on the desktop.
Throu Java Web Start a one-click installation is possible. Awesome feature: You drag an applet from the browser to your desktop.
UI Code: JavaFX Scripting and Java. Via JavaFX you can describe your GUI in a declarative way. JavaFX allows to bind variables to GUI-widgets (data-bindings) and provide a possibility to add triggers to variables.
You can develop the business logic in Java. There's a plugin for different Adobe Tools (e.g. Photoshop) for designing your GUI.
Access Remote Services & Data: You can invoke remote Java-Services via RMI.
Code Complexity Management: JavaFX files (JavaFX Script Programming Language), Java files, Organize into Class/Object hierarchies, Packages. It's statically typed and a compiled language.
Tool Support / Eclipse Integration: There's a JavaFX Plugin for Netbeans. The plugin in provides Code-Completion, Live-Preview of the GUI and so on. Download page
Refactoring & Code-Completion Support: All Java Refactoring & Code Completion with NebBeans.
JEE Integration: You can invoke EJBs like in any other stand-alone Java-Application.
Migration: You can use existing Backend-Services. Of course you can use existing any Java-Code inside a JavaFX-Application
Performance: Partial downloading of the JRE is one of the performances pros. So you can use JavaFX-Applications on clients which haven't got a full installed version of the JRE. Modest download-time to browser because of modularized JRE (Entire JRE: 14,5MB but you need in most cases only the Typical Applet version 4,6MB)
Static-Content (Externally Managed): You can style your widgehts with CSS
Requirements: You need JRE 1.6 Update 10
Search Engine Optimization: Not compatible.

Currently J4Fry is working on some Dojo-Tags for Facelets for RIA feelings in JSF applications.
The declarative Tag should ease the use of Dojo in JSF Applications.
There'll be news about J4Fry-DojoFaces-Project when there's a beta version for testing.

Wednesday, January 21, 2009

Pass action as Facelets-Parameter

There is a problem to pass an action as a Facelet-Parameter to a Fragment via ui:include an ui:param.
With the J4Fry-Action-Wrapper (http://www.j4fry.org/jsfErrorhandling.shtml) as a part of the J4Fry-JSF-Components (http://www.j4fry.org/jsfComponents.shtml) you've got the possibility to pass the action (e.g. for a h:commandButton) to a Facelets-Fragment.

Example
Main-Page

...
<ui:include src="Fragments/myFragment.xhtml">
<ui:param name="myAction" value="myBean.doSomething" />
</ui:include>
...

Fragment

<h:commandButton value="Execute doSomething" action="#{action[myAction].trigger}" />

To use that solution you have to download the J4Fry-JSF-Components (with dependencies described here: http://www.j4fry.org/jsfComponents.shtml) and place the JAR-File into your lib-directory from the webapplication. Thats it!

Monday, January 12, 2009

Fehlendes Bundle com.sun.el.Messages

Auf Grund von einem fehlenden Bundle kann es bei der Nutzung von Faclets zu folgender java.util.MissingResourceException kommen:

java.util.MissingResourceException: Can't find bundle for base name com.sun.el.Messages, locale de_DE
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:549)
at com.sun.el.util.MessageFactory.(Unknown Source)
at com.sun.el.parser.AstValue.getTarget(Unknown Source)
at com.sun.el.parser.AstValue.getType(Unknown Source)
at com.sun.el.ValueExpressionImpl.getType(Unknown Source)
at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:60)
at com.sun.facelets.el.LegacyValueBinding.getType(LegacyValueBinding.java:94)

Ein Grund für die Exception könnte ein NullPointer innerhalb einer EL-Expression sein die JSF bzw. Facelets versucht aufzulösen.

Um die ursprüngliche (etwas aussagekräftigere ;-)) Exception zu sehen könnt ihr einfach folgendes JAR-File in eure Webapplication einbinden: http://j4fry.org/resources/el-messages.jar.
Enthalten sind die englischen und deutschen Property-Files.

Saturday, January 10, 2009

Facelets Template-Parameter

Es gibt mehrere Möglichkeiten Facelets-Templates zu parameterisieren.
  1. Über ui:insert und ui:define
  2. Über EL und ui:param
Facelets Template:

<html>
<head>
<link rel="stylesheet" type="text/css" href="#{myStylesheet}" media="screen, projection" />
</head>
<body>
<ui:insert name="myContent">No content supplied.</ui:insert>
</body>
</html>

Facelets Template-Client:

<ui:composition template="MyTemplate.xhtml">
<ui:param name="myStylesheet" value="http://my.host.com/css/style.css" />
<ui:define name="content">
<h1>My Content</h1>
</ui:define>
</ui:composition>


Über ui:insert ist es möglich Blockplatzhalter zu definieren.
Mit ui:param können auch Inline-Passagen definiert werden.

Die Frage wurde in unserem XING JSF-Developers-Forum (https://www.xing.com/net/jsf) gestellt.