You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Thomas Fischer <fi...@seitenbau.net> on 2008/03/18 18:24:43 UTC

creating "global service" pages

In an JSF 1.2 application I'd like to have some "global service" pages,
which which can be accessed from different parts of the application and
deliever their result back to that part where it came from.

This is a bit abstract, so here is an example: In different places of the
application, there is a need to search a user in a user database. The
process of selecting the user is the same each time, e.g. entering the
user's name and department in a search form. So on each of these pages,
there should be a "select user" button, which opens a new page where the
search data is read and the search is performed. Of course, the result of
the search needs to be returned to the calling page (i.e. its controller)
somehow. There might be different "select user" buttons on one single page
(for different roles, e.g. "select administrator", "select technical
writer" etc.)

This is problematic because the "select user" page does not know what to do
with the result, and how to return control to the calling page so that the
calling page can fetch the result and take appropriate action.

I have a solution which I consider quite a hack: The original page stores
an ELExpression in the session, which is to be evaluated by the "search
user page" controller after it has stored the selected users in the
session. The outcome of the ELExpression selects a navigation rule which
directs back to the original point. The ELExpression in the session stores
the user from the session in the appropriate place of the calling page's
controller.
What I do not like about this solution:
- Defining and calling an EL programatically is complicated and not easily
understandable. I'd be happy if I would not have to do this.
What I like about the solution:
-  The "search user" page does not need to know where to store the result.
It provides a "service" and does not care from where it is called.

So my question is: Can anyone think of an alternative approach to this,
which preserves the "service" idea ?

  Thanks in advance,

       Thomas


Re: creating "global service" pages

Posted by Thomas Fischer <fi...@seitenbau.net>.
Thanks, Simon. That's exactly what I was looking for. Now the difficult
task ist to decide whether to use trinidad, shale, or spring webflows....

simon <si...@chello.at> schrieb am 18.03.2008 21:37:14:

>
> On Tue, 2008-03-18 at 18:24 +0100, Thomas Fischer wrote:
> > In an JSF 1.2 application I'd like to have some "global service" pages,
> > which which can be accessed from different parts of the application and
> > deliever their result back to that part where it came from.
> >
> > This is a bit abstract, so here is an example: In different places of
the
> > application, there is a need to search a user in a user database. The
> > process of selecting the user is the same each time, e.g. entering the
> > user's name and department in a search form. So on each of these pages,
> > there should be a "select user" button, which opens a new page where
the
> > search data is read and the search is performed. Of course, the result
of
> > the search needs to be returned to the calling page (i.e. its
controller)
> > somehow. There might be different "select user" buttons on one single
page
> > (for different roles, e.g. "select administrator", "select technical
> > writer" etc.)
> >
> > This is problematic because the "select user" page does not know what
to do
> > with the result, and how to return control to the calling page so that
the
> > calling page can fetch the result and take appropriate action.
> >
> > I have a solution which I consider quite a hack: The original page
stores
> > an ELExpression in the session, which is to be evaluated by the "search
> > user page" controller after it has stored the selected users in the
> > session. The outcome of the ELExpression selects a navigation rule
which
> > directs back to the original point. The ELExpression in the session
stores
> > the user from the session in the appropriate place of the calling
page's
> > controller.
> > What I do not like about this solution:
> > - Defining and calling an EL programatically is complicated and not
easily
> > understandable. I'd be happy if I would not have to do this.
> > What I like about the solution:
> > -  The "search user" page does not need to know where to store the
result.
> > It provides a "service" and does not care from where it is called.
> >
> > So my question is: Can anyone think of an alternative approach to this,
> > which preserves the "service" idea ?
>
> I haven't done this myself, but believe that there are a few solutions
> to this issue.
>
> Try searching for "trinidad page flow", "shale dialog", "spring
> webflow". I suspect that Seam has something for this too.
>


Re: creating "global service" pages

Posted by simon <si...@chello.at>.
On Tue, 2008-03-18 at 18:24 +0100, Thomas Fischer wrote:
> In an JSF 1.2 application I'd like to have some "global service" pages,
> which which can be accessed from different parts of the application and
> deliever their result back to that part where it came from.
> 
> This is a bit abstract, so here is an example: In different places of the
> application, there is a need to search a user in a user database. The
> process of selecting the user is the same each time, e.g. entering the
> user's name and department in a search form. So on each of these pages,
> there should be a "select user" button, which opens a new page where the
> search data is read and the search is performed. Of course, the result of
> the search needs to be returned to the calling page (i.e. its controller)
> somehow. There might be different "select user" buttons on one single page
> (for different roles, e.g. "select administrator", "select technical
> writer" etc.)
> 
> This is problematic because the "select user" page does not know what to do
> with the result, and how to return control to the calling page so that the
> calling page can fetch the result and take appropriate action.
> 
> I have a solution which I consider quite a hack: The original page stores
> an ELExpression in the session, which is to be evaluated by the "search
> user page" controller after it has stored the selected users in the
> session. The outcome of the ELExpression selects a navigation rule which
> directs back to the original point. The ELExpression in the session stores
> the user from the session in the appropriate place of the calling page's
> controller.
> What I do not like about this solution:
> - Defining and calling an EL programatically is complicated and not easily
> understandable. I'd be happy if I would not have to do this.
> What I like about the solution:
> -  The "search user" page does not need to know where to store the result.
> It provides a "service" and does not care from where it is called.
> 
> So my question is: Can anyone think of an alternative approach to this,
> which preserves the "service" idea ?

I haven't done this myself, but believe that there are a few solutions
to this issue.

Try searching for "trinidad page flow", "shale dialog", "spring
webflow". I suspect that Seam has something for this too.

Regards,
Simon