dev@jsftemplating.java.net

Re: JSFTemplating: Re: Dynafaces example

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Sat, 03 Mar 2007 06:47:48 -0800

Hi Karam,

This was added recently to JSFTemplating so you'll need a more recent
copy of jsftemplating.jar. You will have to build this from cvs to get
it (which I believe you are already doing). Just do an update (cvs up
-d), rebuild jsftemplating.jar (ant clean build), and place this in the
WEB-INF/lib directory of the app.

Thanks!

Ken

Karam Singh wrote:
> Ken,
> I tried using f:verbatim in my jsf page but it fails:
>
> javax.servlet.ServletException: ComponentType 'f:verbatim' not defined!
>
>
> Where do I define it? I don't see the definition on your page.
>
> thanks
> Karam
>
> Ken Paulsen wrote:
>>
>> Hi Priti,
>>
>> The following blog has a "download" link to the example in the blog:
>>
>>
>> http://blogs.sun.com/paulsen/entry/jsftemplating_dynamicfaces_easy_ajax
>>
>> Attached is the page I made right before the meeting that "counts".
>>
>> Ken
>>
>> Priti Tiwary wrote:
>>> Hi Ken,
>>> In your blog can you include the Ajax Dynafaces examples you demoed
>>> today?
>>> Priti
>> ------------------------------------------------------------------------
>>
>> <sun:html>
>> <sun:head title="Ajax Zone">
>> <!-- <jsfExt:scripts /> -->
>> <f:verbatim>
>> <script type="text/javascript">
>> function refreshTime() {
>> window.setTimeout(
>>
>> 'DynaFaces.fireAjaxTransaction(document.getElementById(\\'form:count\\'),
>> '
>> + '{'
>> + ' execute: \\'form:count\\','
>> + ' immediate: false,'
>> + ' inputs: \\'form:count\\','
>> + ' render: \\'form:count\\''
>> + '});'
>> + 'refreshTime();',
>> 1000);
>> }
>> </script>
>> </f:verbatim>
>> </sun:head>
>>
>> <sun:body onLoad="refreshTime('form:count')">
>> <sun:form id="form">
>> "<center><p>&nbsp;</p>
>> <staticText id="count" value='<div
>> id="form:count">#{pageSession.count}</div>'>
>> <!beforeCreate
>> setPageSessionAttribute(key="count" value="1");
>> />
>> <!beforeEncode
>> inc("#{pageSession.count}" value=>$pageSession{count});
>> println("here");
>> />
>> </staticText>
>>
>> <sun:markup tag="div" id="result">
>> <staticText value="#{pageSession.msg}">
>> <!beforeCreate
>> setPageSessionAttribute(key="msg" value="Guess my number
>> [1-100]!");
>> />
>> </staticText>
>> </sun:markup>
>>
>> "<p>&nbsp;</p>
>>
>>
>> // The data input / processing...
>> <sun:textField id="guess" label="Your guess: "
>> value="#{requestScope.guess}" />
>> <sun:button text="Submit AJAX Request" onClick="
>> DynaFaces.fireAjaxTransaction(this, {execute: this.id +
>> ',form:guess', immediate: false, inputs: this.id +
>> ',form:guess_field', render: 'form:result' });
>> return false;
>> ">
>> <!command
>> if ("#{requestScope.guess}>64") {
>> setPageSessionAttribute(key="msg"
>> value="#{requestScope.guess} is too high!");
>> }
>> if ("#{requestScope.guess}=64") {
>> setPageSessionAttribute(key="msg" value="You WIN!!! It
>> was #{requestScope.guess}.");
>> }
>> if ("#{requestScope.guess}<64") {
>> setPageSessionAttribute(key="msg"
>> value="#{requestScope.guess} is too low!");
>> }
>> />
>> </sun:button>
>>
>> "<p>&nbsp;</p>
>>
>> // This fields below exist to show required fields are NOT
>> effected
>> <sun:textField label="This is required: " required="#{true}" />
>> <sun:button text="Submit (non-AJAX)" />
>>
>> "</center>
>> </sun:form>
>> </sun:body>
>> </sun:html>
>>