?
Solved

JSF and JSP

Posted on 2006-07-18
7
Medium Priority
?
1,640 Views
Last Modified: 2012-05-05
I am new to JSF, I know jsp but in my new project they are using jsf in jsp and I am confused on what the code does in jsp. I wanted to know in the following code which part of the code is calling classes to get data if its calling any. Please help me out. Thanks>

<%-- $Id: receiveSwitchStatus.jsp,v 1.11.2.1 2006/06/30 03:53:32 cdreesbach Exp $ --%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://www.systar.com/bbr-1.0" prefix="bbr" %>

<f:loadBundle basename="pagecode.pages.boa.receive.i18n.Resources" var="resourceReceive" />
<f:loadBundle basename="pagecode.pages.templates.i18n.Resources" var="templatesResources" />

<%@include file="/theme/cache-control.inc" %>
<HTML>
<f:view>
<HEAD>
 <%@include file="/theme/application-head.inc" %>
 <bbr:title id="title" value="#{resourceReceive.title_receive_Switch_status}" />
 <bbr:refresh id="refresh" period="120000" />
<style>
      .global_area
            {height:20%}
      .summary_area
            {height:25%}            
      .zoom_area
            {height:55%}            
</style>
</HEAD>
<BODY>
<h:form id="masterForm">
   <%@include file="/theme/application-header.inc" %>
   <h:panelGrid id="receiveBOA_main_grid" columns="1" rowClasses="global_area, summary_area, zoom_area" width="100%" style="height: 100%">         
      <bbr:dashboardPanel id="receiveBOA_global_panel" contentStyle="padding:4px;"
            width="100%" height="100%" cssRoot="rounded1_" overflow_y="auto" overflow_x="auto">
            <f:facet name="title">
                  <h:outputText id="receiveBOA_panel_title" value="#{resourceReceive.switch_status_main_dashboard}"/>
            </f:facet>                        
            <bbr:entityMosaic
                  id="switch_status_mosaic"
                  entityClass="#{receiveSwitchStatus.switchEntityName}"
                  includeInheritedClasses="true"
                  conditions=""
                  identicalCellSize="true"
                  selectedEntityId="#{receiveSwitchStatus.updatedEntitySwitch}"
                  layoutMode="byLine"
                  lineOrColumnCount="1"
                  mosaicSize="small"
                  styleClass="entityMosaic-allSize" />                  
      </bbr:dashboardPanel>  

    <bbr:dashboardPanel id="receiveBOA_summary_panel" contentStyle="padding:4px;"
            width="100%" height="100%" cssRoot="rounded1_" overflow_y="auto" overflow_x="auto">
            <f:facet name="title">
                  <h:outputText id="switch_panel_title" value="#{receiveSwitchStatus.switchName} #{resourceReceive.receive_summary}"/>
            </f:facet>      
        <bbr:entityTable
                  id="summary_table"
                  entityClass="#{receiveSwitchStatus.switchEntityName}"
                  conditions="#{receiveSwitchStatus.nameCondit}"
                  allowSorting="false"
                  width="100%"      
                  style="border: 0px solid;"
                  styleClass="entityTable"
                  gridLines="none"
                  showHeader = "false"
                  supplementalAttributes="">
                <bbr:expandableColumn id="exp_icl_files" view="ICLFiles"/>  
                  <bbr:attributeColumn id="attributeColumn1" attribute="Label" headerText="" horizontalAlign="right" style="font-weight: bold;">
                     <f:facet name="content">
                   <h:outputText id="column1_content" value="#{resourceReceive.receive_total_files_received}" style="#{'font-weight:bold'}" />
               </f:facet>
                  </bbr:attributeColumn>
                  <bbr:attributeColumn id="attributeColumn1a" attribute="iNumICLFiles" headerText="" horizontalAlign="left"/>
                  <bbr:attributeColumn id="attributeColumn2" attribute="Label" horizontalAlign="right">
                     <f:facet name="content">
                   <h:outputText id="column2_content" value="#{resourceReceive.receive_total_items}" style="#{'font-weight:bold'}" />
               </f:facet>
                  </bbr:attributeColumn>
                  <bbr:attributeColumn id="attributeColumn2a" attribute="iNumItems" headerText="" horizontalAlign="left"/>
                  <bbr:attributeColumn id="attributeColumn3" attribute="Label" horizontalAlign="right">
                     <f:facet name="content">
                   <h:outputText id="column3_content" value="#{resourceReceive.receive_total_amount}" style="#{'font-weight:bold'}" />
               </f:facet>
                  </bbr:attributeColumn>
                  <bbr:attributeColumn id="attributeColumn3a" attribute="fAmount" headerText="" horizontalAlign="left"/>
                  <bbr:expandableColumn id="exp_baseline" view="Baseline"/>
                  <bbr:attributeColumn id="attributeColumn4" attribute="Label" horizontalAlign="right">
                     <f:facet name="content">
                   <h:outputText id="column4_content" value="#{resourceReceive.receive_last_transfer}" style="#{'font-weight:bold'}" />
               </f:facet>
                  </bbr:attributeColumn>
                  <bbr:attributeColumn id="attributeColumn4a" attribute="dtLastTransfer" headerText="" horizontalAlign="left"/>
            </bbr:entityTable>            
   </bbr:dashboardPanel>  
   
   <bbr:dashboardPanel id="receiveBOA_zoom_panel0" contentStyle="padding:4px;text-align: center;"
            width="100%" height="100%" cssRoot="rounded1_" overflow_y="auto" overflow_x="auto">
            <f:facet name="title">
                  <h:panelGroup id="receiveBOA_zoom_panel_group0" >
                        <h:outputText id="receiveBOA_zoom_panel_title0" value="#{resourceReceive.receive_switch_file_status_label}"/>
                  </h:panelGroup>
            </f:facet>                        
            <bbr:entityTable
                        id="file_list0"
                        entityClass="#{receiveSwitchStatus.partnerEntityName}"           
                        includeInheritedClasses="true"
                        conditions="#{receiveSwitchStatus.condit}"
                        allowSorting="true"
                        sortColumnId="attributeColumnRecStatus"
                        sortOrder="descending"
                        width="100%"      
                        styleClass="entityTable"
                        gridLines="horizontal"
                        supplementalAttributes="">
                      <bbr:expandableColumn id="exp01" view="TableView"/>
                      <bbr:attributeColumn id="attributeColumnPartner" attribute="Label" headerText="#{resourceReceive.receive_partner_label}" horizontalAlign="left"/>
                      <bbr:attributeColumn id="attributeColumnRecStatus" attribute="Status" headerText="#{resourceReceive.receive_partner_file_status_label}" contentFormat="Icon" horizontalAlign="center"/>
                      <bbr:attributeColumn id="attributeColumnItems" attribute="iNumItems" headerText="#{resourceReceive.receive_items_label}" horizontalAlign="right"/>
                        <bbr:attributeColumn id="attributeColumnAmount" attribute="fAmount" headerText="#{resourceReceive.receive_amount_label}" horizontalAlign="right"/>
                  </bbr:entityTable>                  
      </bbr:dashboardPanel>      
      
   </h:panelGrid>
</h:form>
</BODY>
</f:view>
</HTML>
0
Comment
Question by:suketu9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 4

Accepted Solution

by:
evnafets earned 336 total points
ID: 17135430
The part referencing your classes to get data is encapsulated in Expression Language syntax.
ie all of those #{expr} expressions.

For instance one of them: "#{resourceReceive.receive_switch_file_status_label}"
Translates roughly into java as <%= resourceReceive.getReceive_switch_file_status_label() %>

However the code you have posted here also includes some non-JSF tags - the "bbr" tags.
They could also be accessing data behind the scenes.
Is that a custom taglib or a library you are using?

0
 
LVL 3

Assisted Solution

by:ss_p
ss_p earned 332 total points
ID: 17137136
hi friend

this link should help you

http://www.coreservlets.com/JSF-Tutorial/

Thanks/SSP
0
 
LVL 3

Expert Comment

by:ss_p
ID: 17137148
you can us e this this tutorial as well

http://www.roseindia.net/jsf/

Thanks/SSP
0
 
LVL 15

Assisted Solution

by:bpmurray
bpmurray earned 332 total points
ID: 17144213
Data access is done using value binding to the components. JSF has pretty strong separation of roles in MVC, and the model is referenced by "#{bean.property}". If you look at the tags, you'll see this quite clearly, and there are three references here:

resourceReceive - a bundle that contains localized texts for the UI
templatesResources - another bundle that is never used
receiveSwitchStatus - seems to be a data source

So, in this particular file, there is only one data source (the others are bundles for texts), and that's receiveSwitchStatus, which has a bunch of properties, e.g. switchEntityName. The way JSF resolves this in that it calls the method getSwitchEntityName (note the capital "S") to retrieve data from whatever receiveSwitchStatus actually is; similarly to assign a value to this, it calls the method setSwitchEntityName. Since there is no definition in the file to indicate what receiveSwitchStatus is, it's clearly defined in the faces-config.xml file in the project, as a "Managed bean". If you look in this file (found in the WEB-INF directory), you'll see something like:
       <managed-bean>
            <managed-bean-name>receiveSwitchStatus </managed-bean-name>
            <managed-bean-class>com.foo.jsf.receiveSwitchStatus </managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
This is fairly clear: it gives the name, the actual Java class and the scope, i.e. the visibility of the bean.

The bean itself can be anything, retrieving data from any data source - a database, a file, a web-service, etc.
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 17144221
One other comment: the tag <bbr:entityTable> looks like it generates a table of data. In JSF, this will be generated by iterating over a datacollection returned by the bean. For an explanation on how it does this, have a look at documentation for UIData.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question