Hmmm, that's an interesting idea. The only problem is that the links
include an <f:param> who's value is based on a property of the request
bean. I'm guessing this would stop it working?


On Fri, 11 Mar 2005 10:10:00 -0600, Heath Borders
<[EMAIL PROTECTED]> wrote:
> Well, the easiest thing would be to have your request bean initialize
> to a value that would cause all of the commandLinks to be rendered,
> and then unrender then depending on the param you received.
> 
> 
> On Fri, 11 Mar 2005 15:53:47 +0000, Simon Watson <[EMAIL PROTECTED]> wrote:
> > Aha, that sounds like a plausible explanation! Thanks for giving it
> > thought. I must confess that my understanding of the complete JSF
> > lifecycle is fairly limited.
> >
> > I guess my next question is what's the best way to avoid this problem?
> >
> > In essence, I want to take an external HTTP request (it's actually
> > from PayPal), perform some logic (querying a DB etc) based on a param
> > in the request, and then display HTML based on the result of the
> > logic.
> >
> > Simon.
> >
> > On Fri, 11 Mar 2005 09:46:28 -0600, Heath Borders
> > <[EMAIL PROTECTED]> wrote:
> > > I know what it is.
> > >
> > > Since its a request bean, when it renders it the first time, the bean
> > > is there and its property is properly initialized by the parameter.
> > > No problems.
> > >
> > > However, when you do the submit for the commandLink, your request bean
> > > doesn't have the parameter anymore so the property isn't being
> > > initialized properly.
> > >
> > > The result is that your rendered parameter is probably returning false
> > > during decode which means that the ActionEvent isn't queued, which
> > > means that nothing fires.
> > >
> > >
> > > On Fri, 11 Mar 2005 14:41:53 +0000, Simon Watson <[EMAIL PROTECTED]> 
> > > wrote:
> > > > I could, although the example I gave produces the same problem for me.
> > > >
> > > > The links render correctly but clicking a link just refreshes the
> > > > current page rather than correctly executing the action. It seems to
> > > > be a combination of the rendered tag and a request scope bean. I've
> > > > seen similar reports on Sun's JSF forum.
> > > >
> > > > If I remove the rendered attribute, the links work fine so I'm sure
> > > > it's not a problem with the action itself.
> > > >
> > > > On Fri, 11 Mar 2005 08:36:34 -0600, Heath Borders
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > Could you show us the actualy JSP code that has the commandLink 
> > > > > problem?
> > > > >
> > > > > I'm still not sure I understand the issue.  You're saying that your
> > > > > commandLinks render properly, but they never take you to the correct
> > > > > page?
> > > > >
> > > > >
> > > > > On Fri, 11 Mar 2005 13:15:49 +0000, Simon Watson <[EMAIL PROTECTED]> 
> > > > > wrote:
> > > > > > I take your point (a stupid error on my part) but I think this is a 
> > > > > > red herring.
> > > > > >
> > > > > > My real world code uses returns a boolean that is used in the render
> > > > > > attribute, but the commandLink problem remains the same.
> > > > > >
> > > > > > The actual example I gave works for me so I guess the string
> > > > > > references must be the same?
> > > > > >
> > > > > > On Fri, 11 Mar 2005 14:03:53 +0100, Matthias Wessendorf
> > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > Simon,
> > > > > > >
> > > > > > > look:
> > > > > > >
> > > > > > > String foo ="Simon";
> > > > > > > foo == "Simon";
> > > > > > >
> > > > > > > is not the same like
> > > > > > >
> > > > > > > foo.equals("Simon");
> > > > > > >
> > > > > > > So I don't know yet if it is posible what you are doing there.
> > > > > > >
> > > > > > > But <h:outputText value="Name: #{test.name}"/>
> > > > > > > renders "Name: Simon" ?
> > > > > > >
> > > > > > > .Matthias
> > > > > > >
> > > > > > > Simon Watson wrote:
> > > > > > > > Thanks for the quick response Matthias.
> > > > > > > >
> > > > > > > > Here's some example code that illustrates the problem (for me at
> > > > > > > > least). It's so simple that I'm starting to think it must be 
> > > > > > > > something
> > > > > > > > I'm doing wrong!
> > > > > > > >
> > > > > > > > A simple bean:
> > > > > > > >
> > > > > > > > public class TestBean
> > > > > > > > {
> > > > > > > >     private String name;
> > > > > > > >
> > > > > > > >     public void setName(String newValue)
> > > > > > > >     {
> > > > > > > >       name = newValue;
> > > > > > > >     }
> > > > > > > >
> > > > > > > >     public String getName()
> > > > > > > >     {
> > > > > > > >       return name;
> > > > > > > >     }
> > > > > > > > }
> > > > > > > >
> > > > > > > > managed by JSF:
> > > > > > > >
> > > > > > > > <managed-bean>
> > > > > > > >     <managed-bean-name>test</managed-bean-name>
> > > > > > > >     <managed-bean-class>TestBean</managed-bean-class>
> > > > > > > >     <managed-bean-scope>request</managed-bean-scope>
> > > > > > > >     <managed-property>
> > > > > > > >         <property-name>name</property-name>
> > > > > > > >         <value>#{param.name}</value>
> > > > > > > >     </managed-property>
> > > > > > > > </managed-bean>
> > > > > > > >
> > > > > > > > A simple JSP (page1.jsp):
> > > > > > > >
> > > > > > > > <f:view>
> > > > > > > > <h:outputText value="Name: #{test.name}"/>
> > > > > > > > <h:commandLink value="test" action="home" 
> > > > > > > > rendered="#{test.name== 'simon'}" />
> > > > > > > > </f:view>
> > > > > > > >
> > > > > > > > (change the action for something that works on your system)
> > > > > > > >
> > > > > > > > Basically, the URL "/page1.jsf?name=simon" causes the command 
> > > > > > > > link to
> > > > > > > > be rendered but clicking it doesn't work. Removing the rendered
> > > > > > > > attribute makes it work for me.
> > > > > > > >
> > > > > > > > If you can shed any light on this behaviour I'd be v.grateful.
> > > > > > > >
> > > > > > > > Simon.
> > > > > > > >
> > > > > > > >
> > > > > > > > On Fri, 11 Mar 2005 13:16:40 +0100, Matthias Wessendorf
> > > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > >>sorry I missed the request param stuff
> > > > > > > >>:)
> > > > > > > >>
> > > > > > > >>public MyBackingBeanThatNeedsAParameter(){
> > > > > > > >>  String param = (String) FacesContext.getCurrentInstance()
> > > > > > > >>        
> > > > > > > >> .getExternalContext().getRequestParameterMap().get("id");
> > > > > > > >>
> > > > > > > >>  //access a database or else
> > > > > > > >>  data = 
> > > > > > > >> myDataBaseAccessObject.getMyNeededDataAsListObject(param);
> > > > > > > >>
> > > > > > > >>...
> > > > > > > >>
> > > > > > > >>}
> > > > > > > >>
> > > > > > > >>-Matthias
> > > > > > > >>
> > > > > > > >>
> > > > > > > >>Matthias Wessendorf wrote:
> > > > > > > >>
> > > > > > > >>>Simon,
> > > > > > > >>>
> > > > > > > >>>can you provide some code regarding commandLink ?
> > > > > > > >>>
> > > > > > > >>>
> > > > > > > >>>and to you parameter issue.
> > > > > > > >>>
> > > > > > > >>>you have on a external site a link like that:
> > > > > > > >>>
> > > > > > > >>>http://hostOfSimon/webpageWithJsf.jsf?id=345678
> > > > > > > >>>
> > > > > > > >>>then back a backing bean to the page and inside of its
> > > > > > > >>>constructor try:
> > > > > > > >>>
> > > > > > > >>>private List data; //+get/set
> > > > > > > >>>
> > > > > > > >>>public MyBackingBeanThatNeedsAParameter(){
> > > > > > > >>>
> > > > > > > >>>//access a database or else
> > > > > > > >>>     data = 
> > > > > > > >>> myDataBaseAccessObject.getMyNeededDataAsListObject();
> > > > > > > >>>
> > > > > > > >>>}
> > > > > > > >>>
> > > > > > > >>>and now inside of webpageWithJsf.jsp
> > > > > > > >>>
> > > > > > > >>>you could use <h:dataTable value="#{bean.data}" ...>
> > > > > > > >>>
> > > > > > > >>>...
> > > > > > > >>>
> > > > > > > >>>I hope I understood you right :)
> > > > > > > >>>
> > > > > > > >>>HTH,
> > > > > > > >>>Matthias
> > > > > > > >>>
> > > > > > > >>>Simon Watson wrote:
> > > > > > > >>>
> > > > > > > >>>
> > > > > > > >>>>Hi, I'm currently developing a JSF web-based application 
> > > > > > > >>>>using MyFaces
> > > > > > > >>>>1.0.8. It's at quite an advanced stage but I'm encountering a 
> > > > > > > >>>>very
> > > > > > > >>>>strange problem with commandLinks.
> > > > > > > >>>>
> > > > > > > >>>>I have a fairly simple JSF page which handles 3 possible 
> > > > > > > >>>>outcomes of
> > > > > > > >>>>an operation. I have three commandLinks which are 
> > > > > > > >>>>conditionally
> > > > > > > >>>>rendered based on a request scope managed bean.
> > > > > > > >>>>
> > > > > > > >>>>The logic all appears to work fine with the correct link being
> > > > > > > >>>>displayed but, no matter what the action in the link is, 
> > > > > > > >>>>clicking it
> > > > > > > >>>>always redisplays the current page. Removing the 'rendered' 
> > > > > > > >>>>attribute
> > > > > > > >>>>solves the problem but obviously doesn't really help me.
> > > > > > > >>>>
> > > > > > > >>>>I've tried putting the links in conditionally rendered 
> > > > > > > >>>>subviews (with
> > > > > > > >>>>IDs) and tables, but the same problem occurs. Similarly,
> > > > > > > >>>>commandButtons suffer the same problem.
> > > > > > > >>>>
> > > > > > > >>>>I've seen something similar when referencing a request scope 
> > > > > > > >>>>bean in a
> > > > > > > >>>>dataTable or dataList and solved the problem by making it 
> > > > > > > >>>>session
> > > > > > > >>>>scope. In this particular case, however, I need the bean to 
> > > > > > > >>>>be request
> > > > > > > >>>>scope as it's initialised with a URL parameter (passed from an
> > > > > > > >>>>external non-JSF system).
> > > > > > > >>>>
> > > > > > > >>>>Has anyone else encountered this problem? Is it a bug?
> > > > > > > >>>>
> > > > > > > >>>>I'm tearing my hair out so any help would be much appreciated,
> > > > > > > >>>>
> > > > > > > >>>>Simon.
> > > > > > > >>>>
> > > > > > > >>>
> > > > > > > >>--
> > > > > > > >>Matthias We�endorf
> > > > > > > >>Aechterhoek 18
> > > > > > > >>DE-48282 Emsdetten
> > > > > > > >>Germany
> > > > > > > >>phone: +49-2572-9170275
> > > > > > > >>cell phone: +49-179-1118979
> > > > > > > >>email: matzew AT apache DOT org
> > > > > > > >>url: http://www.wessendorf.net
> > > > > > > >>callto://mwessendorf (Skype)
> > > > > > > >>icq: 47016183
> > > > > > > >>
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Matthias We�endorf
> > > > > > > Aechterhoek 18
> > > > > > > DE-48282 Emsdetten
> > > > > > > Germany
> > > > > > > phone: +49-2572-9170275
> > > > > > > cell phone: +49-179-1118979
> > > > > > > email: matzew AT apache DOT org
> > > > > > > url: http://www.wessendorf.net
> > > > > > > callto://mwessendorf (Skype)
> > > > > > > icq: 47016183
> > > > > > >
> > > > > >
> > > > >
> > > > > --
> > > > > -Heath Borders-Wing
> > > > > [EMAIL PROTECTED]
> > > > >
> > > >
> > >
> > > --
> > > -Heath Borders-Wing
> > > [EMAIL PROTECTED]
> > >
> >
> 
> --
> -Heath Borders-Wing
> [EMAIL PROTECTED]
>

Reply via email to