Simple JSF Application (Part II)

25 December 2007

We were making a simple JSF application in Simple JSF Application (Part I). We have already discussed the first page. Now we look into second page, on which, we will move after entering a number and clicking submit button on first page i.e. welcome.jsp. Second page is factor.jsp. On the first page, we get a number as input, on this page we will display factors of that number.

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<f:view>
<html>
<head>
<title>
Factors
</title>
</head>
<body>
<h:form id="factorForm">
<h:outputText id="factorOutput"
value="Factors of "
style	  ="color: blue"/>
<h:outputText id="welcomeBeanOutput"
value="#{welcomeBean.numControls}"/>
<br/>
<h:panelGrid id="controlPanel"
binding="#{welcomeBean.htmlPanel}"
columns="5" border="1" cellspacing="0"/>
</h:form>
</body>
</html>
</f:view>

This jsp file has almost same components, which we have seen in the previous file with one exception. In the start there are imports. Then , and tags get used. And then, the new tag , which was not there in first jsp file. It is the representation of HtmlPanelGrid component. HtmlPanelGrid is a container to hold other components and display them in html table. Html tables are used widely used for design side settings and here it fulfills our purpose. Any component in JSF can be associated directly with a bean with binding attribute of . Here we have attached binding with “#{welcomeBean.htmlPanel}”. It is JSF expression language that references property of welcomeBean namely htmlPanel.

del.icio.us:Simple JSF Application (Part II)  digg:Simple JSF Application (Part II)  spurl:Simple JSF Application (Part II)  wists:Simple JSF Application (Part II)  simpy:Simple JSF Application (Part II)  newsvine:Simple JSF Application (Part II)  blinklist:Simple JSF Application (Part II)  furl:Simple JSF Application (Part II)  reddit:Simple JSF Application (Part II)  fark:Simple JSF Application (Part II)  blogmarks:Simple JSF Application (Part II)  Y!:Simple JSF Application (Part II)  smarking:Simple JSF Application (Part II)  magnolia:Simple JSF Application (Part II)  segnalo:Simple JSF Application (Part II)  gifttagging:Simple JSF Application (Part II)

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: Simple JSF Application (Part II)

Leave a Reply