As I 'll show up a table on a page , there are certain elements that have no value . But the elements that have a value to form a link to another page . Right now it shows nothing , neither it has value or not.
I'm new to Java and do not understand what I have written wrong in my code .
Here is my code:
<h:link outcome="schoolclass-detail" value="#{la.participant.schoolclass.classname}" rendered="{!la.participant.schoolclass.classname==null}">
<f:param name="schoolclassId" value="#{la.participant.schoolclass.id}" />
</h:link>
Thanks for all help in advance!
Assuming that you use JSF, 'la' is your backing bean, and you want to render your link if the variable of 'classname' is not null, I would suggest to use EL expressions rather than raw java expressions.
You can read more about EL here
The expression of your Example
could look in EL like
or
or maybe better
The
notobviously inverts the following expressionThe
eqstands for equals and therefor is equal to javaobject1.equals(object2);, or in case of primitive types like booleanobj1 == obj2;The
nestands for not equals. You might guess what it does...The
emptyevaluates the following expression to be in a defined state of empty covering stuff like null, empty String ("") or array or list with no contentsAlso important is the
#in front of the statement, that you seem to have forgotten in your example. If you forget this, the value of yourrenderedattribute is treated as a String, and not some expression that should be evaluated by JSF. I think that is the main cause for your example not to work, since your expression is basically correctBest Regards
J.Adam