I gave up.  I'm just going to hard code the 12 cases in the jsp file with
c:choose and c:when.

Shawn

-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 17, 2006 1:31 PM
To: MyFaces Discussion
Subject: Re: Problem hardcoding commandLink action outcome

Right, but it'll render the original request value as the parameter
value, it will then assign the old value ("college") to a new request
value (the parameter key) on the next page.

On 1/17/06, Garner, Shawn <[EMAIL PROTECTED]> wrote:
> That f:param thing just prints out the value at the end of the link so I
> don't think it works with that.
>
> I'm not sure what t:saveState does exactly so I'll take a look.
>
> Shawn
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 17, 2006 1:21 PM
> To: MyFaces Discussion
> Subject: Re: Problem hardcoding commandLink action outcome
>
> In that case, either try the f:param approach or t:saveState the
> entire list of values, and reference the link by list index....
>
> I'd still try the t:saveState first.
>
> I'm surprised someone else hasn't jumped in an recommended better
> solutions, though :)
>
> On 1/17/06, Garner, Shawn <[EMAIL PROTECTED]> wrote:
> > Yeah, sounds good but this code is in a loop and each few iterations has
> > different values for linkPage.
> >
> > Shawn
> >
> > -----Original Message-----
> > From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, January 17, 2006 12:09 PM
> > To: MyFaces Discussion
> > Subject: Re: Problem hardcoding commandLink action outcome
> >
> > Hmm.   Since you put it that way, maybe not.
> > I'm not entirely certain.  Try it and see, but I think you might be
right.
> >
> > In that case, I'd recommend using t:saveState on a copy of your
> > request variable.
> >
> > Create a YourBean instance variable to hold a copy of
> > "#{param.linkPage}", and add getter/setters for it.
> >
> > Then use <t:saveState> on #{YourBean.variable}
> >
> > You can modify the getter to directly read "#{param.linkPage}"
> > Add an alternate getter to read the actual value and use this one for
your
> > link.
> > There's probably other (better) ways to do this, but none come to mind
> > at present.
> >
> > You could pass the value as an f:param if you're using a link and not a
> > button.
> >
> > On 1/17/06, Garner, Shawn <[EMAIL PROTECTED]> wrote:
> > > So the bean's action method is evaluated during render time and not
> after
> > > they click on the link?
> > >
> > > Shawn
> > >
> > > -----Original Message-----
> > > From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, January 17, 2006 11:51 AM
> > > To: MyFaces Discussion
> > > Subject: Re: Problem hardcoding commandLink action outcome
> > >
> > > It doesn't need to.   The value is resolved during render time.
> > >
> > > On 1/17/06, Garner, Shawn <[EMAIL PROTECTED]> wrote:
> > > > Can you explain what this is actually doing?
> > > > How does it know how to resolve ("#{param.linkPage}") after the page
> is
> > > > rendered?
> > > >
> > > > Shawn
> > > >
> > > > -----Original Message-----
> > > > From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, January 17, 2006 10:57 AM
> > > > To: MyFaces Discussion
> > > > Subject: Re: Problem hardcoding commandLink action outcome
> > > >
> > > > Yes, you're trying to fight the technology.
> > > >
> > > > Just do this.
> > > >
> > > > public class YourBean
> > > > {
> > > >      public String getActionForLinkPage()
> > > >      {
> > > >          FacesContext facesContext =
> FacesContext.getCurrentInstance();
> > > >          String action =
> > > >
> > >
> >
>
(String)facesContext.getApplication().createValueBinding("#{param.linkPage}"
> > > > ).getValue(facesContext);
> > > >           return action;
> > > >      }
> > > > }
> > > >
> > > > <h:commandLink action="#{YourBean.actionForLinkPage}"
> > > value="#{linkText}"/>
> > > >
> > > >
> > > > On 1/17/06, Garner, Shawn <[EMAIL PROTECTED]> wrote:
> > > > > Damn, get an exception with f:attribute.  I thought that should
> work.
> > > > >
> > > > > To do <h:commandLink action="college"/> I would have to do a
> > choose/when
> > > > > condition checking the value of #{linkPage} which can have like 12
> > > > different
> > > > > values.  Seems like a messy solution to me.
> > > > >
> > > > > Shawn
> > > > >
> > > > > -----Original Message-----
> > > > > From: Garner, Shawn
> > > > > Sent: Tuesday, January 17, 2006 10:29 AM
> > > > > To: 'MyFaces Discussion'
> > > > > Subject: RE: Problem hardcoding commandLink action outcome
> > > > >
> > > > > How about using the f:attribute tag for name="action"?
> > > > >
> > > > > Shawn
> > > > >
> > > > > -----Original Message-----
> > > > > From: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> > > > > Sent: Tuesday, January 17, 2006 10:21 AM
> > > > > To: MyFaces Discussion
> > > > > Subject: Re: Problem hardcoding commandLink action outcome
> > > > >
> > > > > You are correct.   It's trying to resolve it as a method binding.
> > > > >
> > > > > You need to either use
> > > > >
> > > > > <h:commandLink
> > > action="#{yourBean.yourMethodReturningCollegeAsAString}"/>
> > > > >
> > > > > or
> > > > >
> > > > > <h:commandLink action="college"/>
> > > > >
> > > > > The attribute "action" takes only a string literal or a method
> binding
> > > > > that returns a String.  It does not take a value binding that
> > > > > evaluates to a String.  So if you need the action target to be
> > > > > variable, you need to write java code to perform this logic.
> > > > > Possibly you could use some kind of JSP EL expression instead of a
> JSF
> > > > > EL expression, but I wouldn't recommend this approach.
> > > > >
> > > > > On 1/17/06, Garner, Shawn <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > I'm trying to hardcode the action to "college" which is in the
> > > linkPage
> > > > > > request scope variable.
> > > > > >
> > > > > > I think it's trying to resolve it as a bean action or something
> > > instead
> > > > of
> > > > > > an outcome.
> > > > > >
> > > > > > Can somebody help me with how to do this.
> > > > > >
> > > > > >
> > > > > >
> > > > > > linkPage: <h:outputText value="#{linkPage}"/><br>
> > > > > >
> > > > > > <h:commandLink action="#{linkPage}" value="#{linkText}"/>
> > > > > >
> > > > > >
> > > > > >
> > > > > > This prints out:
> > > > > >
> > > > > >
> > > > > >
> > > > > > linkPage: college
> > > > > >  Modify Your Answer
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > I want it to resolve as if I put in <h:commandLink
> action="college"
> > > > > > value="Modify Your Answer"/>
> > > > > >
> > > > > >
> > > > > >
> > > > > > However when I click on the link I get:
> javax.faces.FacesException:
> > > > Error
> > > > > > calling action method of component with id _id1:_id15
> > > > > >         at
> > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListen
> > > > > erImpl.java:74)
> > > > > >         at
> > > > > > javax.faces.component.UICommand.broadcast(UICommand.java:106)
> > > > > >         at
> > > > > >
> > >
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
> > > > > >         at
> > > > > >
> > >
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
> > > > > >         at
> > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.j
> > > > > ava:316)
> > > > > >         at
> > > > > >
> > > >
> >
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
> > > > > >         at
> > > > > > javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
> > > > > >         at
> > > > > > jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
> > > > > >         at
> > > > > >
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
> > > > > >         at
> > > > > >
> > > >
> >
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:259)
> > > > > >         at
> > > > > >
> > > >
> >
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
> > > > > >         at
> > > > > > jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
> > > > > >         at
> > > > > >
> > > > >
> > > >
> > >
> >
>
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428
> > > > > )
> > > > > >         at
> > > > > > jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
> > > > > > Caused by: javax.faces.el.ReferenceSyntaxException:
> > > > > > Expression not a valid method binding: #{linkPage}
> > > > > >         at
> > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindi
> > > > > ngImpl.java:186)
> > > > > >         at
> > > > > >
> > > >
> >
org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:114)
> > > > > >         at
> > > > > >
> > > > >
> > > >
> > >
> >
>
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListen
> > > > > erImpl.java:63)
> > > > > >         ... 13 more
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Shawn D. Garner
> > > > > >
> > > > > > Software Developer
> > > > > >
> > > > > > CASD EAI I
> > > > > >
> > > > > > Internet Development
> > > > > >
> > > > > >
> > > > > >
> > > > > > Email:  [EMAIL PROTECTED]
> > > > > >
> > > > > > Work:  (319) 665-7796
> > > > > >
> > > > > > Cell:  (319) 480-4409
> > > > > >
> > > > > >
> > > > > >
> > > > > > Pearson Government Solutions
> > > > > >
> > > > > > 2450 Oakdale Blvd
> > > > > >
> > > > > > Coralville, IA 52241
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
****************************************************************************
> > > > > >
> > > > > > This email may contain confidential
> > > > > > material. If you were not an intended recipient,
> > > > > > Please notify the sender and delete all copies.
> > > > > > We may monitor email to and from our network.
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
***************************************************************************
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
****************************************************************************
> > > > >
> > > > > This email may contain confidential material.
> > > > > If you were not an intended recipient,
> > > > > Please notify the sender and delete all copies.
> > > > > We may monitor email to and from our network.
> > > > >
> > > >
> > >
> >
>
****************************************************************************
> > > > >
> > > > >
> > > >
> > >
> >
>
****************************************************************************
> > > > > This email may contain confidential material.
> > > > > If you were not an intended recipient,
> > > > > Please notify the sender and delete all copies.
> > > > > We may monitor email to and from our network.
> > > > >
> > > >
> > >
> >
>
****************************************************************************
> > > > >
> > > >
> > > >
> > >
> >
>
****************************************************************************
> > > > This email may contain confidential material.
> > > > If you were not an intended recipient,
> > > > Please notify the sender and delete all copies.
> > > > We may monitor email to and from our network.
> > > >
> > >
> >
>
****************************************************************************
> > > >
> > >
> > >
> >
>
****************************************************************************
> > > This email may contain confidential material.
> > > If you were not an intended recipient,
> > > Please notify the sender and delete all copies.
> > > We may monitor email to and from our network.
> > >
> >
>
****************************************************************************
> > >
> >
> >
>
****************************************************************************
> > This email may contain confidential material.
> > If you were not an intended recipient,
> > Please notify the sender and delete all copies.
> > We may monitor email to and from our network.
> >
>
****************************************************************************
> >
>
>
****************************************************************************
> This email may contain confidential material.
> If you were not an intended recipient,
> Please notify the sender and delete all copies.
> We may monitor email to and from our network.
>
****************************************************************************
>

**************************************************************************** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
****************************************************************************

Reply via email to