This looks good... your example demonstrates both style of JSFTemplating
pages (xml and template formats).
If you want to start learning about handlers, you can try adding the
following to a button:
<rave:button text="click me">
<!command
println(value="You clicked the button!");
/>
</rave>
To see a complete list of built-in handlers (println above is a
handler), visit the "info.jsf" page. It is available in every
JSFTemplating application when the JVM option
"com.sun.jsftemplating.DEBUG=true" is set:
http://localhost:8080/context/info.jsf
You might try:
<rave:hyperlink text="whatever">
<!command
setAttribute(key="foo" value="bar");
println(value="I'm setting a request attribute named foo to
$attribute{foo}.");
/>
</rave>
<staticText value="The value of foo is: #{foo}" />
This will print a value to the log file (stdout) as the first example...
and it will set a request scoped variable "foo" to value "bar". The
text field is bound to this request scoped variable and will display it.
You can easily define your own handlers using @annotations and you gain
input validation/conversion automatically. You can pass multiple
outputs from a handler as well. Check out the
"com.sun.jsftemplating.handlers" for some examples. You can find more
examples and pages using them in the GlassFish source
(
https://glassfish.dev.java.net). You might be interested in how we're
using the Tree component. You can find it via google by searching for
"peTree.jsf".
Thanks for sending your example!
Ken
Todd Patrick wrote:
> Everything worked perfectly. Thank you!
>
> I've attached my WebContent to demonstrate what I did.
>
> Thanks,
>
> --Todd
>
> -----Original Message-----
> From: Ken.Paulsen_at_Sun.COM [mailto:Ken.Paulsen_at_Sun.COM]
> Sent: Thursday, September 28, 2006 12:11 PM
> To: dev_at_jsftemplating.dev.java.net
> Subject: Re: JSFTemplating: Wow! This could solve a lot of problems.
> However I can't find the TLD?
>
> The attachment would help... I just saw your other emails, I'll reply
> shortly.
>
> Ken
>
> Ken Paulsen wrote:
>
>> Hi Todd,
>>
>> The jsftemplating page I referred you to
>> (https://jsftemplating.dev.java.net/tutorials/page.html) describes
>> what is needed to extract the files needed to use components from
>> Creator. Once you have these files, you can use them in your JSF
>> environment w/ Facelets, etc. I "think" Facelets also requires the
>> TLD, which isn't mentioned in this document. I think the tld is in
>> webui.jar, I wouldn't think you'd need to extract it, though... but
>> perhaps this is a Facelets requirement? This page also described where
>>
>
>
>> to get some of the documentation for the components (webui-doc.zip).
>>
>> The JSFTemplating project is very similar to Facetlets in many ways,
>> but works much differently and has some different strengths. It
>> supports 2 formats for defining pages, 1 is an XML based approach, the
>>
>
>
>> other is an HTML-like approach that attempt to simplify things more.
>> One of the biggest (in my opinion) features of JSFTemplating is it's
>> use of "handlers" for processing events. These promote better
>> code-reuse and simplify development.
>>
>> In regard to TLD's, JSFTemplating doesn't require them. It does,
>> however, require a "Factory" class for instantiating a component. This
>>
>
>
>> provides a way of customizing components based on your needs. For
>> example, you can have a factory that takes in parameters (i.e.
>> database table names, fields, etc.) and configures a DataProvider for
>> your table so that you don't have to write any Java code for each
>> table that you want to use. Or... you can use the default factories
>> that are provided that include every feature that is published via the
>>
>
>
>> TLD's. The TLD's themselves aren't used b/c that is a JSP concept that
>>
>
>
>> describes what options are available... JSFTemplating makes all
>> options available automatically and doesn't need to know about them
>> ahead of time. This does leave it up to the developer, however, to
>> know what options they need (the component documentation is
>>
> important).
>
>> If you want to try the Tree out in a JSFTemplating based project,
>> follow the setup instructions on the site (basically create a simple
>> web app w/ the jsftemplating and creator jars in the WEB-INF/lib).
>> Then drop the attached file into your app.
>>
>> Let me know if you have more questions...
>>
>> Ken
>>
>> Todd Patrick wrote:
>>
>>> First of all, thanks Ken for pointing this out to me.
>>>
>>> I currently have a project that has the following:
>>>
>>> Server: Tomcat 5.0.28
>>> Database: Oracle 10g
>>> JSF 1.1
>>> Facelets 1.1.11
>>> JSTL
>>> Spring
>>> Acegi-Security
>>>
>>> Right now, I am running just fine with no problems. However, I need a
>>>
>
>
>>> Tree and Tab component due to project requirements. The Tree
>>> component in the webui.jar from SJSC2 would be perfect, however I was
>>>
>
>
>>> having a heck of a time adding it to my project.
>>>
>>> I'd add the necessary .jars, and added the following to my page:
>>>
>>> <!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:ui="http://java.sun.com/jsf/facelets"
>>> xmlns:h="http://java.sun.com/jsf/html"
>>> xmlns:f="http://java.sun.com/jsf/core"
>>> xmlns:rave="http://http://www.sun.com/web/ui>
>>> <ui:composition template="/common/template.xhtml">
>>>
>>> <ui:define name="title">Petro Admin: EAI/GFT</ui:define>
>>>
>>> <ui:define name="body">
>>> <rave:staticText id="statictext1" text="some text to display" />
>>> </ui:define> </ui:composition> </html>
>>>
>>>
>>> However, this didn't work at all, what would happen is nothing would
>>> be rendered in the browser, but viewing the source would display:
>>>
>>> <rave:staticText id="statictext1" text="some text to display" />
>>>
>>> Thus, the component wasn't rendered. I downloaded examples and
>>> wrapped the rave:staticText in it's own rave:form.
>>>
>>> Plus, I tried nesting the rave:staticText component in:
>>>
>>> <ui:page>
>>> <ui:html>
>>> <ui:head id="head" title="Test text page" /> <ui:body> <ui:form
>>> id="form1">
>>>
>>> That didn't work either...
>>>
>>> So, back to my original question, I downloaded jsftemplating.jar and
>>> ran jar -xvf to view the contents, I can't find any TLD information?
>>>
>>> How do I use the components offered?
>>>
>>> I looked at the layout.dtd, I *think* the only components offered
>>>
> are:
>
>>> Resources
>>> ComponentTypes
>>> HandlerDefinitions
>>> - InputDef
>>> - OutputDef
>>> event
>>> - handler
>>> - input
>>> - outputMapping
>>> layout
>>> - if
>>> - foreach
>>> - while
>>> - facet
>>> - staticText
>>> - component
>>> - option
>>> - list
>>> - event
>>> - markup
>>> - attribute
>>>
>>> Insight would be appreciated on how the components are supposes to be
>>>
>
>
>>> used.
>>>
>>> Thanks!
>>>
>>> --Todd
>>>
>>> Todd Patrick Web Developer DTN 9110 West Dodge Road, Suite 200 Omaha,
>>>
>
>
>>> NE 68114 todd.patrick_at_dtn.com Phone: 402-255-8155 Fax: 402-255-8825
>>> www.dtn.com DTN Smarter Decisions
>>>