You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gr...@intellicare.com on 2005/11/22 23:55:03 UTC

Shale prerender() problem (sometimes!)

Hi all:

I have a situation where Page1 (/worklist.jsp) has a link which when 
clicked is forwarded to Page2 (/worklist/nextAssignments.jsp). Since I 
have to do some "prerender" work to display my Page2, I have code in my 
backing Bean1's prerender() method. However, my breakpoint in Bean1's 
prerender() is not being hit in this situation. (There are other cases 
where it is being called just fine, .. but I just can't seem to see what's 
wrong in this case..  and am wondering if I cannot maybe have the 
"worklist" bean point to one bean and the "worklist$nextAssignment" point 
to another..? Doesn't sound too logical but then I'm clutching at straws 
at this point..(:()

Here's what I have in my faces-config.xml:

<managed-bean>
                <managed-bean-name>worklist</managed-bean-name>
                <managed-bean-class>
 com.intellicare.webshark.action.workflow.WorkListManagerBean
                </managed-bean-class>
                <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>

<navigation-rule>
                <from-view-id>*</from-view-id>
                <navigation-case>
                        <from-outcome>nextAssignment</from-outcome>
                        <to-view-id>/worklist/nextAssignment.jsp</
to-view-id>
                </navigation-case>
etc.

Also,
<managed-bean>
                <managed-bean-name>worklist$nextAssignment</
managed-bean-name>
                <managed-bean-class>
 com.intellicare.webshark.action.workflow.WebworkManagerBean
                </managed-bean-class>
                <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>

The link on Page1 (/worklist.jsp) says:
<h:form id="worklistForm">
        <h:commandLink id="nextAssignment" action="
#{worklist.acceptNextAssignment}">
                <h:outputText value="Accept Next Assignment" />
        </h:commandLink>
</h:form>

When i click on the link above, my worklist bean's acceptNextAssignment() 
method gets called fine and it finally returns the String "nextAssignment" 
and thence forwards to /worklist/nextAssignment.jsp. 

Can anyone spot what I am missing?

Many thanks in advance for your time,
Geeta

Re: Shale prerender() problem (sometimes!)

Posted by gr...@intellicare.com.
craigmcc@gmail.com wrote on 11/22/2005 06:13:01 PM:

> On 11/22/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
> >
> > Hi all:
> >
> > I have a situation where Page1 (/worklist.jsp) has a link which when
> > clicked is forwarded to Page2 (/worklist/nextAssignments.jsp). Since I
> > have to do some "prerender" work to display my Page2, I have code in 
my
> > backing Bean1's prerender() method.
> 
> 
> If you are doing exactly what you describe above, you're doing it wrong. 
The
> only prerender() method that is called is for the view that will 
actually be
> rendered ... in other words, you should put the code in the prerender()
> method of Page2, not Page1.

Yes. Actually that's how I had it and then later decided to do some code 
"cleanup" and managed to foul it up instead! The horrid part is that I had 
been staring at it for the past hour - and I realised what i was doing 
wrong about three seconds after i hit the "Send"..(:(

> 
> The whole idea is that all the code associated with a particular view 
should
> be in one class (the backing bean for that JSP page). Otherwise, if you 
had
> three different pages that all navigated to Page2, then you'd have to
> duplicate the setup logic in three different places.
> 
> Craig
> 

Thank you and sorry again!
Geeta

Re: Shale prerender() problem (sometimes!)

Posted by Craig McClanahan <cr...@apache.org>.
On 11/22/05, gramani@intellicare.com <gr...@intellicare.com> wrote:
>
> Hi all:
>
> I have a situation where Page1 (/worklist.jsp) has a link which when
> clicked is forwarded to Page2 (/worklist/nextAssignments.jsp). Since I
> have to do some "prerender" work to display my Page2, I have code in my
> backing Bean1's prerender() method.


If you are doing exactly what you describe above, you're doing it wrong. The
only prerender() method that is called is for the view that will actually be
rendered ... in other words, you should put the code in the prerender()
method of Page2, not Page1.

The whole idea is that all the code associated with a particular view should
be in one class (the backing bean for that JSP page). Otherwise, if you had
three different pages that all navigated to Page2, then you'd have to
duplicate the setup logic in three different places.

Craig

Re: Shale prerender() problem (sometimes!)

Posted by gr...@intellicare.com.
..never mind about my question. Just realised I was being really stupid. 
Sorry to waste your time,
Geeta