Sunday, October 31, 2004

Encode HTML Entities - Showing code in blogs

Encode HTML Entities

I couldnt get code to display in my weblogs. Then I found this handy little tool that encodes HTML, converting the tags so the code can be displayed. Great!

How to use Tiles with JSF Applications

Found some instructions on using tiles with JSF without struts, so I should be ok

http://forum.exadel.com/viewtopic.php?t=968

URL: http://www.exadel.com/downloads/jsf/examples/jsf-tiles.war (2.14M)
This short example shows how use JSF together with Tiles. All you have to do is add struts.jar from the Struts1.1 distributive to your classpath. Including struts.jar does not mean that Struts itself is required to use with Tiles. Tiles packages are distributed inside the struts.jar. No other funclionality of the Struts Framework will be involved.

Useful Tips:

1. This is a snippet from web.xml that makes Tiles enabled:
Code:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>TilesServet</servlet-name>
<servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
<init-param>
<param-name>definitions-config</param-name>
<param-value>/WEB-INF/tiles-defs.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
Pay attention to the load-on-startup tag. Tiles Servlet should be loaded after the Faces Servlet. It is important.

2. tiles-defs.xml file is a standard Tiles definitions file. You can use several of them. Use comma separated string to define such files for the definitions-config.

3. Use flush="false" for the tiles:insert tag is you use it inside the f:view

4. Use f:subview if you use tiles inside the f:facet. For example:
Code:
<f:facet name="header">
<f:subview id="header">
<tiles:insert definition="page.header" flush="false"/>
</f:subview>
</f:facet>

5. Never include f:view inside another f:view

6. You cannot forward directly to the tiles, like in the Struts. So, anyway, the faces-config file should contain a pages as a view.

JSF-Spring instead of Struts - Spring

JSF-Spring 2.6 - powered by mindmatters

Just completed the tutorial on using JSF with WSAD 5.1.2. Did it with as400s WDSC 5.1.2 (WSSD plus Iseries tooling), and it worked a treat. I like it!

What I would like to do is take the current Struts/Tiles/Hibernate CRUD app that I have been working on at work, and rework that using Spring/JSF instead of Struts, giving me a good reason to try both.

I read an article on Struts/JSF/Tiles integration Integrating Struts, Tiles, and JavaServer Faces, but that seemed overly complex, so ill give spring and jsf combo a go

one question is what do I do about Tiles? Does spring have something similar?

Saturday, October 30, 2004

A tutorial on JSF

Tonight im doing a tutorial on JSF. This is a first for me using JSF.

Im not being creative and going it alone. I already have as400 WDSC 5.1.2 installed and im working through Creating Web-based user interfaces: Using WebSphere Studio V5.1.2 to develop JavaServer Faces applications

So far so good, we'll see what happens when we start to run the application!