JSF and JSTL

B

beatdown

Hi all, I'm new in JSF and I'm making my first test applications.
As you can see below, I have a bean named personBean who has an
attribute (edad). The attribute is an int at the backend bean. My
question is:
How could I compare this int with another int value and then show a
message refered to the result of that comparision? I've thought about
usgin JSTL (<c:if ...>) but I don't know how to access that bean in a
JSTL tag... Has JSF any tag for do this? What can I do?
Thank you very much.

page.jsp
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:loadBundle basename="bundle.messages" var="msg"/>
....
<h:eek:utputText value="#{personBean.edad}" />
....

faces-config.xml
....
<managed-bean>
<managed-bean-name>personBean</managed-bean-name>
<managed-bean-class>jsfHello.PersonBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
....
 
M

Moiristo

beatdown said:
Hi all, I'm new in JSF and I'm making my first test applications.
As you can see below, I have a bean named personBean who has an
attribute (edad). The attribute is an int at the backend bean. My
question is:
How could I compare this int with another int value and then show a
message refered to the result of that comparision? I've thought about
usgin JSTL (<c:if ...>) but I don't know how to access that bean in a
JSTL tag... Has JSF any tag for do this? What can I do?
Thank you very much.

Maybe you can use the 'rendered' attribute?
 
B

beatdown

How? What I need, is accessing in some way to the bean attributes to
perform a comparision.

Moiristo ha escrito:
 
D

Danno

beatdown said:
How? What I need, is accessing in some way to the bean attributes to
perform a comparision.

Moiristo ha escrito:

<h:inputText id="edad" value="#{personBean.edad}"
rendered="#{personBean.masDe18}"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top