> -----Original Message-----
> From: Matthias Wessendorf [mailto:[EMAIL PROTECTED] 
> Subject: Re: CommandLink problem - please help
> look:
> String foo ="Simon";
> foo == "Simon";
> is not the same like
> foo.equals("Simon");

Matthias, remember that this is EL, not plain Java. If the left side of the 
comparison is an object (or maybe if object are of the same type), I believe EL 
calls Object.equals() anyways, rather than checking if it's the same object. 
Though for clarity, it's better to write "#{test.name eq 'simon'}".

Kalle


> 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
> 
> 

Reply via email to