JSF1.2学习笔记

来源:互联网 发布:大数据技术 编辑:程序博客网 时间:2024/06/04 19:21

1.
style="text-align:right" 用来实现<h:panelGrid,右对齐。


2.
synchronized(className){     }  
  其实在OBJECT类里面就说了,每个对象都有一把“锁”,当在线程处理时,为了防止不同的线  
  程同时访问一个方法造成出错,通过这样的方式就可以把当前用这个方法的对象的“锁”加上去,别 
  的线程就没有办法进来,只有等到当前线程用执行过后,才会自动打开锁,允许其它线程使用。


3.
两种打开子窗口的语句。
onclick="javascript:Richfaces.showModalPanel('AddservSpecPanel');"
onclick="showModal('sspecCompGrp_addServ.jsp')"


4.
用HtmlDataTable 进行binding时,变量一定要小写.
Binding与value的区别:?
如果只有Binding不能成功,可以尝试把value同时加上。

 

5.
面板超出时自动出现下拉条:
style="overflow:auto"

 

6.
style="display:none" 通过样式控制

 

7.
用替换tab页的方式显示页面时,要把两个tab部分放一个文件里,分多个文件会找不到

 


8.
其他bean取得segmentBean的transId:
FacesContext ctx = FacesContext.getCurrentInstance();   
SegmentBean segmentBean = (SegmentBean) ctx.getELContext().getELResolver().getValue(ctx.getELContext(), null, "segment");   
String mm = segmentBean.transId;

 


9.
新增模块的设置:
增加Agent,后台bean,web页面。要在web-inf中添加新模块的config.xml文件(描述bean,和页面)。然后在web.xml文件里加入config.xml的信息。

 


10.
控制控件的显示和隐藏
方法一:(rendered属性方式)
 <h:outputText value="服务"  rendered = "#{offeringBean.UItype}"/> 值为boolean类型


方法二:(JSTL方式) (另还有C:if方法。)
 <c:set var="k" value="#{offeringBean.UItype}"/>

    <c:choose>
   <c:when test="${k eq 2}">
    <h:outputText value="服务" /> 
   </c:when>
     
   <c:when test="${k==3}">
        <h:outputText value="终端" /> 
   </c:when>
     
   <c:otherwise>
        <h:outputText value="产品" /> 
   </c:otherwise>
  </c:choose>
注:jsf中JSTL的添加-》在lib里加入jstl.jar包,然后每个页面表头添加: xmlns:c="http://java.sun.com/jstl/core" 

 


11.
对弹出页面一定要刷新弹出页面的form

 

 

12.
控件的不可修改disabled="true"

 

 

13.
<body onpaste="return false"> 禁止粘贴
onselectstart="return false"  禁止选择
 
function key(){
  if(event.shiftKey){
  window.close();}
  //禁止shift
  if(event.altKey){
  window.close();}
  //禁止alt
  if(event.ctrlKey){
  window.close();}
  //禁止ctrl
  return false;
}


function norightclick(e){
  if (window.Event){
  if (e.which == 2 || e.which == 3)
  return false;}
  else
  if (event.button == 2 || event.button == 3){
  event.cancelBubble = true
  event.returnValue = false;
  return false;}
  }
//禁止右键

 

原创粉丝点击