You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Colin Chalmers <co...@xs4all.nl> on 2007/02/25 08:59:58 UTC

some functioanlity questions

Hi all,

We've been using MyFaces for some time now but are facing some problems 
which our client deems as must_have for any web_based_app.
These questions have been posed on the list before but I haven't seen 
any definitive answers, plz point me to them if I'm wrong.

1. The browser Back-button
    when the user clicks on the browser back-button he should be taken 
back a page without loss of data .
    I've seen comments about client/side state saving in connection with 
cache expiry settings
    I've also seen solutions based on seam & shale.
    Can someone comment on this as to what works for them?

2. Bookmarking pages
    I've seen workarounds with servlet-filters. Does MyFaces have a 
solution or should I be looking at Jsf_sping?

3. Google findable
    Is anyone able to tweak faces to allow Google to crawl and index?

4. Initializing data-sources
    We had an ugly workaround to init/destroy data in backing-beans. I 
see that Shale has methods for this (aptly called init/destroy)
    How do others do this with *basic* myfaces to ensure that data is 
retrieved once during the life-cycle?

thx in advance

Colin

Re: some functioanlity questions

Posted by Werner Punz <we...@gmail.com>.
Colin Chalmers schrieb:

> 1. The browser Back-button
>    when the user clicks on the browser back-button he should be taken
> back a page without loss of data .
>    I've seen comments about client/side state saving in connection with
> cache expiry settings
>    I've also seen solutions based on seam & shale.
>    Can someone comment on this as to what works for them?
> 

Myfaces has an integrated state history you can enable/disable
I do not have the exact infos on it, but it has been working
well for almost a year now.
The back button is indeed not a problem anymore not even in server side
state saving, in client side one the state is pushed into the html code
anyway.

> 2. Bookmarking pages
>    I've seen workarounds with servlet-filters. Does MyFaces have a
> solution or should I be looking at Jsf_sping?
> 
Bookmarking is not possible in post situations, restfulness can
be achieved via outputlink and dedicated params.
Commandlink enforces a form post which is not restful.

Http get is ommitted from jsf.
(but can be simulated via outputlink)

There might be other solutions but that is what you get out of the box.
(Some systems can provide dedicated nav handlers which push you to a
generic entry page if you bookmark inside of a form)

> 3. Google findable
>    Is anyone able to tweak faces to allow Google to crawl and index?
> 
see above, to my knowledge you have to plan ahead and make the
crawlabel data restful which means you need a
page hierarchy being able to be crawlable. Which means, make
commandlinks for the pages you need to be crawled.


> 4. Initializing data-sources
>    We had an ugly workaround to init/destroy data in backing-beans. I
> see that Shale has methods for this (aptly called init/destroy)
>    How do others do this with *basic* myfaces to ensure that data is
> retrieved once during the life-cycle?
> 
For now Shale is probably the best option you can get currently, besides
seam.

If you are in an orm context, there will be another option soon,
the new myfaces fusion project addresses this issue very similar to Seam
(Currently it is in development, but something usable will be there soon)

Which means you work in conversation contexts and you have an open
connection/entity manager per conversation, the objects are kept
in ram as long as the conversation is open, and you can synchronize them
back to the db via flush()

once the conversation is done, everything is dropped.

Seam does it that way, fusion also, but fusion is not quite there yet to
be easily usable (will be soon however)

The restfulness of those systems and the bookmarking ability is another
issue. If you bookmark a conversation system, under best circumstances
it should push you to a dedicated page outside or at the begin of the
conversation, which lets you start anew.




Re: some functioanlity questions

Posted by Mike Kienenberger <mk...@gmail.com>.
On 2/25/07, Colin Chalmers <co...@xs4all.nl> wrote:
> 1. The browser Back-button
>     when the user clicks on the browser back-button he should be taken
> back a page without loss of data .
>     I've seen comments about client/side state saving in connection with
> cache expiry settings
>     I've also seen solutions based on seam & shale.
>     Can someone comment on this as to what works for them?

What works for me is client-side state saving with no "important"
session-scoped data.  Ie, anything stored in session scope can be
trivially and automatically recreated if the session goes away.   The
application can be restarted (and sometimes even updated if the
serailization doesn't change) without the end-user noticing.


> 2. Bookmarking pages
> 3. Google findable

no experience.

> 4. Initializing data-sources
>     We had an ugly workaround to init/destroy data in backing-beans. I
> see that Shale has methods for this (aptly called init/destroy)
>     How do others do this with *basic* myfaces to ensure that data is
> retrieved once during the life-cycle?

initialization is simple -- make a setInitialize(Object value)
accessor on the managed bean, and put the following managed property
LAST.  Your setInitialize() method will be called right after all
other managed beans have been set.

		<managed-property>
			<property-name>initialize</property-name>
			<value>initialize</value>
		</managed-property>

I have also used spring-bean-based init/destroy methods in the past.