当前位置: 首页 > news >正文

JSF 与 HTML 标签的联系

*页面的开头

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>

<%@ taglib uri="http://jsftutorials.net/htmLib" prefix="htm"%>

<%@ taglib uri="http://www.ccb.cn/xmdc" prefix="xmdc"%>

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>

<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>

<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%>

<link rel="stylesheet" type="text/css"

       href="<%=request.getContextPath()%>/css/style_organ.css" />

<link rel="stylesheet" type="text/css"

       href="<%=request.getContextPath()%>/css/public.css" />

<link rel="stylesheet" type="text/css"

       href="<%=request.getContextPath()%>/css/ext.css" />

*假数据的构造

<%String str[] = new String[] { "项目名称1", "项目名称2" };

javax.faces.model.ArrayDataModel ad = new javax.faces.model.ArrayDataModel(str);

pageContext.setAttribute("ad", ad, PageContext.SESSION_SCOPE);

%>

1inputTextarea

常用属性:cols

          Rows

常用的写法:

<h:inputTextarea value=”” rows=”8” style=”width:100%” />

2inputText

   常用属性:readonly

               Size       框的大小

               Maxlength  最多字符数

     常用的写法:

<h:inputText value=”” size=”5” readonly=”true”

Maxlength=”6”

style=”color:yellow;background:Teal;” />

3outputText

常用属性:escape   如果设置为true,会转义<>和&字符。默认值为false   

使用举例:

 <h:outputText value="outputtext"

         style="height:30;width:100%;text-align:center;" />

4outputFormat

此标签用于tag体中指定的参来格式化组合的消息,

例如:

 <h:outputFormat value=”{0} is {1} years old!” >

 <f:param value=”Bill” />

 <f:param value=”38” />

 </h:outputFormat>

5graphicImage

      常用例子:

          <h:graphicImage value=”/tjefferson.jpg” style=”border:thin solid black” />

           <h:graphicImage value=”/tjefferson.jpg” style=”border:0px” />

      <h:graphicImage value="../../images/fadajing.gif" />

6commandButton

     常用属性:

         Type     

      使用举例:

     <h:panelGrid columns="2" align="center">

            <h:commandButton value="确认" action="" styleClass="button" style="margin-right:10px"/>

            <h:commandButton value="取消" action="" styleClass="button" />

</h:panelGrid>

<h:panelGrid columns="6" align="center" cellspacing="5">

       <xmdc:outputText value="请选择:" />

       <h:selectOneMenu>

              <f:selectItem itemValue="0" itemLabel="下一步" />

       </h:selectOneMenu>

       <h:commandButton value=" " action="" styleClass="button" />

       <h:commandButton value=" " action="" styleClass="button" />

       <h:commandButton value=" " action="" styleClass="button" />

       <h:commandButton value="撤消审批意见" οnclick="javascript:cancelApproval()"

              action="" styleClass="button" />

</h:panelGrid>

7commandLink

使用举例:

   <h:commandLink>

      h:outputText value=”#{msgs.linkTex}” />

   </h:commandLink>

8outputLink

使用举例:

   <h:outputLink value=”” title=”outputLink的标题” target=”blank” >

       <h:outputText value=”” />           </h:outputLink>

   <h:outputLink value="http://www.ccb.cn">

                         <xmdc:outputText value="额度信息" bold="true" />

</h:outputLink>

9selectBooleanCheckbox

      复选框(单个的)

      <h:selectBooleanCheckbox value=”sdfsdf” />

10selectManyCheckbox

一组复选框

<h:selectManyCheckbox value=”#{form.colors}” >

    <f:selectItem itemValue=”” />

    <f:selectItem itemValue=”” />

    <f:selectItem itemValue=”” />

    <f:selectItem itemValue=”绿” />

    <f:selectItem itemValue=”橙黄” />

</h:selectManyCheckbox>

11selectOneRadio

       单选按钮

<h:selectOneRadio>

         <f:selectItem itemValue="0" itemLabel="全体人员" />

         <f:selectItem itemValue="1" value="true" itemLabel="HR人员" />

</h:selectOneRadio>

12selectOneListbox

  

     <h:selectOneListbox value=”#{}” size=”5” >

         <h:selectItem value=”1900” itemLabel=”1900” />

         <h:selectItem value=”1901” itemLabel=”1901” />

         <h:selectItem value=”1902” itemLabel=”1902” />

         <h:selectItem value=”1903” itemLabel=”1903” />

     </h:selectOneListbox>

13selectManyListbox

   <h:selectManyListbox value=”#{}” size=”5” >

         <h:selectItem value=”1900” itemLabel=”1900” />

         <h:selectItem value=”1901” itemLabel=”1901” />

         <h:selectItem value=”1902” itemLabel=”1902” />

         <h:selectItem value=”1903” itemLabel=”1903” />

     </h:selectManyListbox>

14iframe

<iframe name="main" frameborder="0" framespacing="0" scrolling="no" width="100%" src="Organview/OrganIndex.htm">

</iframe>

15inputCalendar

<x:inputCalendar monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader"

       currentDayCellClass="currentDayCell" renderAsPopup="true" popupTodayString="Today" popupWeekString="Week" popupDateFormat="yyyyMMdd" value=""/> 

16datatable2

<xmdc:dataTable2 value="#{ad}" var="blankstr" width="88%" columnClasses="center">

                                          <h:column>

                                                 <f:facet name="header">

                                                        <h:outputText value="姓名" />

                                                 </f:facet>

                                                 <h:outputText value="#{blankstr}" />

                                          </h:column>

                                          <h:column>

                                                 <f:facet name="header">

                                                        <h:outputText value="成绩" />

                                                 </f:facet>

                                                 <h:outputText value="" />

                                          </h:column>

                                          <h:column>

                                                 <f:facet name="header">

                                                        <h:outputText value="总体成绩" />

                                                 </f:facet>

                                                 <h:outputText value="" />

                                          </h:column>

                                          <h:column>

                                                 <f:facet name="header">

                                                        <h:outputText value="表现评语" />

                                                 </f:facet>

                                          </h:column>

       </xmdc:dataTable2>

17、表头为复杂的datatable

<%//                     些处为复杂表格    %>

              <htm:table width="650" border="1" align="center">

                     <htm:tr>

                            <htm:td height="80" width="56" rowspan="2" align="center"

                                   valign="middle" bgcolor="#f3f3f3">

                                   <h:outputText value="项目" />

                            </htm:td>

                            <htm:td colspan="5" align="center" bgcolor="#f3f3f3">

                                   <h:outputText value="中长期劳动合同员工" />

                            </htm:td>

                            <htm:td rowspan="2" align="center" width="56" bgcolor="#f3f3f3">

                                   <h:outputText value="短期劳动合同员工" />

                            </htm:td>

                            <htm:td rowspan="2" align="center" width="56" bgcolor="#f3f3f3">

                                   <h:outputText value="劳务用工" />

                            </htm:td>

                            <htm:td rowspan="2" align="center" width="56" bgcolor="#f3f3f3">

                                   <h:outputText value="审计系统人员" />

                            </htm:td>

                            <htm:td colspan="2" align="center" bgcolor="#f3f3f3">

                                   <h:outputText value="机构" />

                            </htm:td>

                     </htm:tr>

                     <htm:tr>

                            <htm:td align="center" width="56" bgcolor="#f3f3f3">

                                   <h:outputText value="总计" />

                            </htm:td>

                            <htm:td align="center" bgcolor="#f3f3f3">

                                   <h:outputText value="一级分行行领导或总行本部部门领导" />

                            </htm:td>

                            <htm:td align="center" bgcolor="#f3f3f3">

                                   <h:outputText value="六、七职等管理岗位职务人员" />

                            </htm:td>

                            <htm:td align="center" bgcolor="#f3f3f3">

                                   <h:outputText value="三、四级专业技术岗位职务人员" />

                            </htm:td>

                            <htm:td align="center" width="56" bgcolor="#f3f3f3">

                                   <h:outputText value="党员" />

                            </htm:td>

                            <htm:td align="center" width="56" bgcolor="#f3f3f3">

                                   <h:outputText value="总计" />

                            </htm:td>

                            <htm:td align="center" width="56" bgcolor="#f3f3f3">

                                   <h:outputText value="其中:营业机构" />

                            </htm:td>

                     </htm:tr>

              </htm:table>

<%//                     些处为复杂表格 end    %>

              <xmdc:dataTable2 value="#{ad}" var="blankstr" width="650"

                     columnClasses="center" align="center">

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

                     <h:column>

                            <h:outputText escape="false" value="#{blankstr}" />

                     </h:column>

              </xmdc:dataTable2>

18HRDCdatatable

<h:dataTable width="95%" align="center" border="1" value="" var="" rowClasses="td01,td02,td02,td02,td02,td02">

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="" />

              </f:facet>

              <h:selectOneRadio>

              </h:selectOneRadio>

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="序号" />

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="客户编号" />

              </f:facet>

              <h:inputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="合同编号" />

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="客户名称" />

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="合同品种" />

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="合同币种" />

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="表内余额" />

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="表外余额" />

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="五级分类"></xmdc:outputText>

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="状态"></xmdc:outputText>

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="经办机构"></xmdc:outputText>

              </f:facet>

              <h:outputText value="" />

       </h:column>

       <h:column>

              <f:facet name="header">

                     <xmdc:outputText value="授信支用详情"></xmdc:outputText>

              </f:facet>

              <h:outputLink value="">

                     <xmdc:outputText value="x001"></xmdc:outputText>

              </h:outputLink>

       </h:column>

</h:dataTable>

19panelGrid

 

       <xmdc:panelGrid columns="4" align="center" width="100%" border="1"

              columnbgcolors="#F3F3F3,#FFFFFF,#F3F3F3,#FFFFFF"

              columnwidths="20%,30%,20%,30%"

               rowheights="22,22,22,22,22"

              columnbgcolors="#F3F3F3,#ffffff,#F3F3F3,#ffffff"

              columnaligns="left,center,right"

              columnvaligns="top,top,"

        colspan=”;2,2;2;3,1;”

              >

              <xmdc:outputText value="债项批复编号" />

              <xmdc:outputText value="" />

              <xmdc:outputText value="合同编号" />

              <xmdc:outputText value="" />

              <xmdc:outputText value="期限" />

              <xmdc:outputText value="" />

              <xmdc:outputText value="合同性质" />

              <xmdc:outputText value="" />

       </xmdc:panelGrid>

20selectOneMenu

<h:selectOneMenu>

       <f:selectItem itemValue="0" itemLabel="新增" />

       <f:selectItem itemValue="1" itemLabel="借新还旧" />

       <f:selectItem itemValue="2" itemLabel="债务转移(签定新合同)" />

       <f:selectItem itemValue="3" itemLabel="整体债务转移" />

       <f:selectItem itemValue="4" itemLabel="展期" />

       <f:selectItem itemValue="5" itemLabel="担保变更" />

       <f:selectItem itemValue="6" itemLabel="信用证修改" />

       <f:selectItem itemValue="7" itemLabel="保函修改" />

       <f:selectItem itemValue="8" itemLabel="资产转让(买断型受让)" />

</h:selectOneMenu>

21、标签页面:multlink

<%//顶部标签%>

              <xmdc:multlink value="1" paneLable="一般客户,集团客户"s            paneLink="CreditineLedgerInfoQuery_Gen.jsf,CreditineLedgerInfoQuery_Gen.jsf"

                     align="left" />

22、页面弹出(按钮)

<h:commandButton type=”button” οnclick=openWindow('examine_approve/2.jsf’,

800,320,100,100)” value=”选择下一个审批人” styleClass=”button” />

23、分页的代码

<xmdc:panelGrid columns="1" align="center" rendered="#{customerMagnifierBackingBean.flag}">

              <xmdc:panelGrid columns="2" align="center" columnaligns="center,center" columnvaligns="middle,middle">

                     <x:dataScroller id="scroll_1" for="userdata" fastStep="10" pageCountVar="pageCount" pageIndexVar="pageIndex" paginator="false" paginatorMaxPages="0" rowsCountVar="rowsCount" displayedRowsCountVar="displayedRowsCountVar" firstRowIndexVar="firstRowIndex"

                            lastRowIndexVar="lastRowIndex" style="display:inline" actionListener="#{customerMagnifierBackingBean.scrollerAction}">

                            <f:facet name="first">

                                   <h:outputText value="首页" />

                            </f:facet>

                            <f:facet name="last">

                                   <h:outputText value="尾页" />

                            </f:facet>

                            <f:facet name="previous">

                                   <h:outputText value="上一页" />

                            </f:facet>

                            <f:facet name="next">

                                   <h:outputText value="下一页" />

                            </f:facet>

                     </x:dataScroller>

                     <x:dataScroller id="scroll_2" for="userdata" rowsCountVar="rowsCount" displayedRowsCountVar="displayedRowsCountVar" firstRowIndexVar="firstRowIndex" lastRowIndexVar="lastRowIndex" pageCountVar="pageCount" pageIndexVar="pageIndex">

                            <h:outputFormat id="outputFormat" value="一共找到{0}条记录,第{1}/{2}" style="display:inline">

                                   <f:param value="#{rowsCount}" />

                                   <f:param value="#{pageIndex}" />

                                   <f:param value="#{pageCount}" />

                            </h:outputFormat>

                     </x:dataScroller>

              </xmdc:panelGrid>

       </xmdc:panelGrid>

24、上传下载

文档上传必须统一使用myfaces控件,不得使用其他上传方法。

界面:

<x:inputFileUpload value="#{creditLimitApplicationSchemeBackingBean.myFile}" storage="file" required="true"></x:inputFileUpload>

Backingbean:

InputStream inputStream = new BufferedInputStream(myFile.getInputStream());

下载必须采用Basebackingbean的downLoadFile方法:

/**

   * 文件下载

   * @param object FileInputStream或ByteArrayOutputStream

   * @param FileName 文件名

   * @param contenttype 下载类型

   */

  public void downLoadFile(Object object,String fileName,String contenttype)

界面主要是一个动作对应后台一个方法

Backingbean调用如下方法:

例如:

        public String downloadExcel()

        {

                 String contentType = "application/vnd.ms-excel";

                // 获得Excel文件流(可能是输出流,也可能是输入流)

                object = IBizApplicationUCC.downloadExcel(bizId)

                // 生成默认文件名

               defaultFileName = 文档类型代码.业务申报书 + BriefBizTaskVO.bizEventNumber

                //弹出窗口给界面下载

                downLoadFile(Object object,String defaultFileName ,String contenttype)

                return null;

        }

转载于:https://www.cnblogs.com/netliang/p/4183930.html

相关文章:

  • c# 中的UserControl是什么 用户控件和自定义控件有什么区别
  • PHP实现懒加载
  • 漂亮的ActionBar效果
  • Entity Framework 的事务 DbTransaction
  • Android中的Unable to start activity ComponentInfo或者Unable to instantiate activity ComponentInfo的错误...
  • HTTP 方法:GET 对比 POST
  • 移动web开发中,好用的小方法
  • Resx 文件无效,未能加载 .RESX 文件中使用的类型
  • JDK中文方框乱码问题
  • 32 脚本编程风格
  • 让低版本的 Android 项目显示出 Material 风格的点击效果
  • eclipse安装pydev插件时没有任何错误提示,但是就是装完了后不显示pydev的设置项...
  • bzoj2337
  • android sqlite 数据类型
  • 来一篇新鲜的招聘笔试题(2014秋招版)
  • 【node学习】协程
  • const let
  • CSS 提示工具(Tooltip)
  • iOS高仿微信项目、阴影圆角渐变色效果、卡片动画、波浪动画、路由框架等源码...
  • Iterator 和 for...of 循环
  • JavaScript新鲜事·第5期
  • js对象的深浅拷贝
  • LeetCode18.四数之和 JavaScript
  • Linux后台研发超实用命令总结
  • Redis中的lru算法实现
  • Synchronized 关键字使用、底层原理、JDK1.6 之后的底层优化以及 和ReenTrantLock 的对比...
  • vue中实现单选
  • 程序员该如何有效的找工作?
  • 技术发展面试
  • 力扣(LeetCode)21
  • 利用DataURL技术在网页上显示图片
  • 【运维趟坑回忆录 开篇】初入初创, 一脸懵
  • python最赚钱的4个方向,你最心动的是哪个?
  • Salesforce和SAP Netweaver里数据库表的元数据设计
  • 数据库巡检项
  • ![CDATA[ ]] 是什么东东
  • #控制台大学课堂点名问题_课堂随机点名
  • (2022 CVPR) Unbiased Teacher v2
  • (4.10~4.16)
  • (LeetCode 49)Anagrams
  • (Matlab)遗传算法优化的BP神经网络实现回归预测
  • (Redis使用系列) SpirngBoot中关于Redis的值的各种方式的存储与取出 三
  • (二十一)devops持续集成开发——使用jenkins的Docker Pipeline插件完成docker项目的pipeline流水线发布
  • (附源码)spring boot北京冬奥会志愿者报名系统 毕业设计 150947
  • (六)软件测试分工
  • (论文阅读40-45)图像描述1
  • (免费领源码)python+django+mysql线上兼职平台系统83320-计算机毕业设计项目选题推荐
  • (十八)用JAVA编写MP3解码器——迷你播放器
  • (四)Tiki-taka算法(TTA)求解无人机三维路径规划研究(MATLAB)
  • (转载)从 Java 代码到 Java 堆
  • ***汇编语言 实验16 编写包含多个功能子程序的中断例程
  • **PHP二维数组遍历时同时赋值
  • ./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’: ./incl
  • .Net CF下精确的计时器
  • .Net Framework 4.x 程序到底运行在哪个 CLR 版本之上