JSF Custom Compoment development tips
- JSP taglib
In JSF, the scriplet like “#{RequestBean1.name}” is treated as a ValueExpression field in tab class. The corresponding tab lib definition file should nests the attribute type with deferred-value.
And also in tld file, jsp-version 2.1 element should be included. If this scriplet is missed, some container like Tomcat 6.0.16 will take this tag as generial tag and if we invoke isLiteralText() on the ValueExpression object, true will return. It was not excepted. But the GlassFish V2 ignored this and took 2.1 as default.
-
Why setProperties() in tag handler java is not invoked?
You should define all property of jsf component java in faces-config.xml. Sometimes it looks like that a attribute is defined twice: one in tld, one in faces-config.xml. JSF Template can make these things easy by generating all configuration file. In order to archive this, it introduces some anonations. -
Why did some data shown on page disappear after re-loading the page?
implement the saveState/restoreState method.