[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1667
  • Last Modified:

JSF and JSP

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
suketu9
Asked:
suketu9
  • 2
  • 2
3 Solutions
 
evnafetsCommented:
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
 
ss_pCommented:
hi friend

this link should help you

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

Thanks/SSP
0
 
ss_pCommented:
you can us e this this tutorial as well

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

Thanks/SSP
0
 
bpmurrayCommented:
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
 
bpmurrayCommented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now