hi steven,

that would make sense if it's a generic engine. if it isn't that generic,
you could directly inject "bean a" into "bean b" and access it.
if you really access e.g. #toString of the "callerBean" it should work.

the alternative depends on further details of your application and
use-cases.

if you aren't allowed to provide details about your application, we could
talk about the concrete constellation in our irc channel (afterwards we post
the basic solution).

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


2011/8/29 Steven Rudolf <[email protected]>

> Oh, I am deeply sorry for the bad format!
> I hope you can read it better now:
>
> Hello Gerhard, thanks for the fast answer!
>
> I have an a.view with a commandlink like this:
>   <h:commandlink action="#{useCaseLinkBean.accessUseCase('foreignUseCase',
> aBean")}" />
>
> Then I have the useCaseLinkBean which handles the "routing" between the
> usecases with the method:
>   public String accessUseCase(final String accessLink, final UseCaseCaller
> callerBean) {
>        this.callerBean = callerBean;
>        return accessLink + "?faces-redirect=true";
>   }
>
> Now on the b.view I access the aBean in two ways.
> The first is an outputText:
>   <h:outputText value="I came from #{useCaseLinkBean.callerBean}" />
>
> And the second is the back-link via a commandButton:
>   <h:commandButton
> action="#{useCaseLinkBean.callerBean.returnWithResult(bBean.returnObject)}"
> />
>
> Do I have to access the aBean in some other way to not break the
> assignement of aView to aBean instance?
> The using of a "routing" bean is not so clever as well. Maybe there is a
> more elegant way?
>
> Greetings from Stuttgart,
> Steven
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: "Steven Rudolf" <[email protected]>
> Gesendet: Aug 29, 2011 4:21:36 PM
> An: "MyFaces Discussion" <[email protected]>
> Betreff: Re: CODI ViewAccessScope use-case in use-case approach
>
> >Hello Gerhard, thanks for the fast answer! I have an a.view with a
> commandlink like this: Then I have the useCaseLinkBean which handles the
> "routing" between the usecases the method: public String accessUseCase(final
> String accessLink, final UseCaseCaller callerBean) { this.callerBean =
> callerBean; return accessLink + "?faces-redirect=true"; } Now on the b.view
> I access the aBean in two ways. The first is an outputText: And the second
> is the back-link via a commandButton: Do I have to access the aBean in some
> other way to not break the assignement of aView to aBean instance? The using
> of a "routing" bean is not so clever as well. Maybe there is a more elegant
> way? Greetings from Stuttgart, Steven
> >
> >
> >-----Ursprüngliche Nachricht-----
> >Von: "Gerhard Petracek" <[email protected]>
> >Gesendet: Aug 29, 2011 3:20:09 PM
> >An: "MyFaces Discussion" <[email protected]>
> >Betreff: Re: CODI ViewAccessScope use-case in use-case approach
> >
> >>hi steven,
> >>
> >>first of all: welcome @ myfaces!
> >>
> >>please provide more information on how you touch the bean of your first
> >>use-case (A).
> >>
> >>regards,
> >>gerhard
> >>
> >>http://www.irian.at
> >>
> >>Your JSF powerhouse -
> >>JSF Consulting, Development and
> >>Courses in English and German
> >>
> >>Professional Support for Apache MyFaces
> >>
> >>
> >>2011/8/29 Steven Rudolf <[email protected]>
> >>
> >>> Hello,
> >>>
> >>> I'm using CODI (v 1.0.1) and I'm loving the ViewAccessScope becaue it
> is
> >>> really easy to program my use cases if I know, that the beans will
> clean up
> >>> if I don't access them anymore after redirecting to the next view. So
> mainly
> >>> all my beans are ViewAccessScope and the transfer of values between
> screens
> >>> works with viewParams.
> >>>
> >>> Now I have an "use case in use case" approach, where I have to link
> from
> >>> one use case (A) to another screen (B) only for searching an entity and
> then
> >>> link back to the calling use case (A). I realized it with a simple
> redirect
> >>> and I access the A-Bean from the B-view with a ping-method so that the
> >>> A-Bean will not be destroyed. But if I link back to the A-view then a
> new
> >>> A-Bean will be created because the A-view doesn't know the old A-Bean
> >>> anymore.
> >>>
> >>> I think that the assignement of bean to view is destroyed after
> redirecting
> >>> to B-view so that the render of A-view will create a new A-Bean. After
> >>> looking to the CODI sources I think that will be done in
> >>>
> org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.ViewAccessConversationExpirationEvaluator.
> >>>
> >>> How can I program my use-case? Is there a
> >>> ViewAccess-ExceptOneSpecialLink-Scope poossible? Maybe I can write a
> >>> PhaseListener where I can plant the old A-Bean to the new rendered
> A-view?
> >>>
> >>> Respectfully,
> >>> Steven Rudolf
> >>>
> >>> ___________________________________________________________
> >>> Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
> >>> Toolbar eingebaut! http://produkte.web.de/go/toolbar
> >>>
> >
>
>
> ___________________________________________________________
> Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
> Toolbar eingebaut! http://produkte.web.de/go/toolbar
>

Reply via email to