webtier@glassfish.java.net

Re: [webtier] JSF 2.0 PR Ajax Question

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Wed, 07 Jan 2009 13:34:11 -0800

Lincoln -

I owe you an apology - I feel *very* certain that I checked the behavior
of the editable text example before I emailed you on the 5th, but
apparently, if I did, I did it incorrectly. When I tried it just a
couple hours ago on GlassFish, it wasn't working.

It turns out that there was a bug in both the editable text demo, and
the edit demo of basic ajax.

The error was that the demo was using a comma-delimited list of ids for
the render option of the ajax call. That was changed to a space
delimited list of ids within the last month, and apparently the demos
were not updated.

So, I'm going to go through and update all the blog entries now that the
spec is more baked, to avoid anyone else having this kind of problem.
I'll try to get to that by tomorrow. Thanks for bringing it to our
attention.

Jim

P.S. I'm not seeing the hang on shutdown of Tomcat that you're seeing,
but I've got a couple more things to try to see if I can reproduce that
problem.

Lincoln Baxter, III wrote:
>
> Ok, so I checked out and tried all of the Ajax demos in the
> jsf-demo/basic-ajax/ project.
> It looks like there were 4 demos to try. 2 counters, 1 show/hide, and 1
> echo.
>
> Three worked, the echo did not. Also, as I encounter with my other
> JSF2.0 projects, the server is unable to shutdown when running
> Mojarra2.0 PR or SNAPSHOT. It just hangs on "Stopping Coyote"
>
> Jan 6, 2009 7:33:49 PM org.apache.coyote.http11.Http11Protocol pause
> INFO: Pausing Coyote HTTP/1.1 on http-8081
> Jan 6, 2009 7:33:50 PM org.apache.catalina.core.StandardService stop
> INFO: Stopping service Catalina
> Jan 6, 2009 7:33:51 PM org.apache.coyote.http11.Http11Protocol destroy
> INFO: Stopping Coyote HTTP/1.1 on http-8081 *<--- hangs here*
>
>
> Would you like me to send you any info? I'll include what I can think of:
>
> quadshark ~ # uname -a
> Linux quadshark 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008
> i686 GNU/Linux
>
> My server startup log:
>
> Jan 6, 2009 7:32:11 PM org.apache.catalina.core.AprLifecycleListener
> init
> INFO: The APR based Apache Tomcat Native library which allows
> optimal performance in production environments was not found on the
> java.library.path:
> /usr/lib/jvm/java-6-sun-1.6.0.10/jre/lib/i386/server:/usr/lib/jvm/java-6-sun-1.6.0.10/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.10/jre/../lib/i386:/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/xulrunner-addons:/usr/lib/xulrunner-addons:/usr/java/packages/lib/i386:/lib:/usr/lib
> Jan 6, 2009 7:32:11 PM org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on http-8081
> Jan 6, 2009 7:32:11 PM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 861 ms
> Jan 6, 2009 7:32:11 PM org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> Jan 6, 2009 7:32:11 PM org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
> Jan 6, 2009 7:32:12 PM com.sun.faces.config.ConfigureListener
> contextInitialized
> INFO: Initializing Mojarra 2.0.0 (PR b08) for context '/basic-ajax-web'
> Jan 6, 2009 7:32:13 PM org.apache.coyote.http11.Http11Protocol start
> INFO: Starting Coyote HTTP/1.1 on http-8081
> Jan 6, 2009 7:32:13 PM org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> Jan 6, 2009 7:32:13 PM org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/61 config=null
> Jan 6, 2009 7:32:13 PM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 2242 ms
>
>
>
> On Tue, 2009-01-06 at 12:28 -0800, Jim Driscoll wrote:
>> Interesting, and worrying.
>>
>> As I said, that code (the ajax edit code) works fine - but it's only
>> been tested under Glassfish, not Tomcat. And no, what you're seeing is
>> not the expected behavior, as I'm sure you guessed.
>>
>> There should also be additional update entities that have the ids of the
>> fields being updated, as listed in the request's "render" option.
>>
>> For simplicity's sake, if you could try one of the basic-ajax examples,
>> also in the jsf-demo directory, they have far less going on than the
>> edit example. "count.xhtml" is probably the simplest example. If that
>> doesn't work, then we've narrowed the problem considerably, and I'll
>> have to install all this on Tomcat and give it a spin to see what's
>> going on.
>>
>> I beleive that I covered the "count" example in my blog as well, though
>> the API has changed a bit since then.
>>
>> Jim
>>
>> Lincoln Baxter, III wrote:
>> > Hey Jim,
>> >
>> > Thanks for your reply, I'm already loving JSF2.0. Great work!
>> >
>> > I checked out your sources and built with the Mojarra 2008/01/04
>> > Snapshot. Is this normal behavior?
>> > This is all I get back from my ajax request:
>> >
>> > <partial-response>
>> > <changes>
>> > <update id="javax.faces.ViewState">j_id47:j_id48</update>
>> > </changes>
>> > </partial-response>
>> >
>> >
>> > If I click 'reload', I see that the value has indeed updated, but no
>> > ajax DOM update occurs. Is that normal? Would I have to do something
>> > extra to re-render a region? It seems like the jsf.ajax.request() call
>> > should be taking care of that.
>> >
>> > I am running on Tomcat 6.0.18, Ubuntu Linux 8.10.
>> >
>> > Thanks again,
>> > Lincoln
>> >
>> > On Mon, 2009-01-05 at 09:56 -0800, Jim Driscoll wrote:
>> >> Hello -
>> >>
>> >> Good to see someone looking at this.
>> >>
>> >> A number of changes happened to the Ajax API besides the change in the
>> >> library name - and most of those changes happened right at the end of
>> >> the development process. While I haven't updated the blog entries, I
>> >> have kept their associated code up to date and running in the Mojarra
>> >> source base.
>> >>
>> >> Future versions of the JSF builds will distribute these demos, but for
>> >> now, you can find the full, working source code for this example at:
>> >>
>> >> https://mojarra.dev.java.net/source/browse/mojarra/trunk/jsf-demo/basic-ajax-edit/
>> >>
>> >> This is the same link that you can find in the blog entry itself.
>> >>
>> >> If you can't get that working, let me know, but I just did a test build,
>> >> and it works fine.
>> >>
>> >> Jim Driscoll
>> >>
>> >> Lincoln Baxter, III wrote:
>> >> > Hi All,
>> >> >
>> >> > First, I noticed that the library ajax.js does not exist in the PR
>> >> > release. It seems to have been incorporated with jsf.js in the
>> >> > "javax.faces" namespace/library.
>> >> >
>> >> > Second. I'm trying to put together the editable text ajax example from
>> >> > Jim Driscoll's blog here:
>> >> > http://weblogs.java.net/blog/driscoll/archive/2008/11/another_jsf_20_1.html
>> >> > but I'm running in to an issue where the AJAX request fires just fine,
>> >> > but the only element returned by the "render: list of ids" parameter is
>> >> > the javax.faces.ViewState element, all other elements are ignored.
>> >> >
>> >> > Also, the value of the inputText field is not populated in the managed
>> >> > bean. (it is however, passed as a POST parameter)
>> >> >
>> >> > Any thoughts?
>> >> > I can post source if required, but it's pretty much straight from Jim's
>> >> > example. (Plus the action method on submit just to verify that anything
>> >> > happens at all)
>> >> >
>> >> > Thanks,
>> >> > Lincoln
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net <mailto:webtier-unsubscribe_at_glassfish.dev.java.net> <mailto:webtier-unsubscribe_at_glassfish.dev.java.net>
>> >> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net <mailto:webtier-help_at_glassfish.dev.java.net> <mailto:webtier-help_at_glassfish.dev.java.net>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net <mailto:webtier-unsubscribe_at_glassfish.dev.java.net>
>> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net <mailto:webtier-help_at_glassfish.dev.java.net>
>>