锘??xml version="1.0" encoding="utf-8" standalone="yes"?>91综合久久,欧美欧美欧美欧美首页,欧洲毛片在线视频免费观看http://www.aygfsteel.com/chen45257211/articles/354956.html涓冨瓚涓冨瓚Mon, 25 Jul 2011 02:22:00 GMThttp://www.aygfsteel.com/chen45257211/articles/354956.htmlhttp://www.aygfsteel.com/chen45257211/comments/354956.htmlhttp://www.aygfsteel.com/chen45257211/articles/354956.html#Feedback0http://www.aygfsteel.com/chen45257211/comments/commentRss/354956.htmlhttp://www.aygfsteel.com/chen45257211/services/trackbacks/354956.html

comanndButton鍜宑ommandLink: 

h:commandButton 
鍙互鎻愪氦琛ㄥ崟錛屼絾涓嶈兘浼犻掑弬鏁?nbsp;
h:commandLink 
鍙互鎻愪氦琛ㄥ崟錛屽張鑳戒紶閫掑弬鏁幫紝浣嗘槸浠ラ摼鎺ョ殑褰㈠紡灞曠幇 

commandLink蹇呴』瑕佸湪涓涓猣rom涓?nbsp;

comanndButton鍜宑ommandLink瑕佸湪涓涓猣rom涓墠鑳芥彁浜よ〃鍗曞唴瀹廣?nbsp;

浼氬彂閫佸洖鏈〉闈紝騫惰Е鍙慗SF鐨勭敓鍛藉懆鏈燂紝姣斿錛氶噸寤虹粍浠舵爲銆佸簲鐢ㄨ姹傚肩瓑錛屽洜姝わ紝鍏佽璁劇疆actionListener鍜宎ction灞炴э紝榪欐牱浠栦滑鍙互寰堣交鏉懼畬鎴愬己澶х殑鍔熻兘銆?nbsp;

Java浠g爜  鏀惰棌浠g爜
  1. <h:commandButton actionListener="#{actionListener.check}"; value="閫佸嚭"; action="#{user.check}" />  



actionListener 鍝嶅簲鐨勪竴涓簨浠?褰撶劧榪欎釜鍜宩s涓殑浜嬩歡涓嶄竴鏍?actionListener="#{actionListener.check}"鍝嶅簲鐨勬槸鏈嶅姟鍣ㄧ鐨勪簨浠禷ctionListener綾葷殑check鏂規硶. 

action 鐢ㄨ繃STRUTS鐨勯兘鐭ラ亾,鎻愪氦鍚庢墽琛岀殑鏂規硶.褰撶劧鍦⊿RTUTS涓璦ction="URL"錛岃岃繖閲屾槸涓涓猽ser綾葷殑check鏂規硶. 

涓嶈凍鍦ㄤ簬錛氬鏋滈噸寤虹粍浠舵爲鐨勬垚鏈瘮杈冮珮錛堟瘮濡傦細褰撳墠欏甸潰鏄劇ず涓涓暟鎹〃鏍鹼級錛岃岃繖浜涚粍浠跺浜庡嵆灝嗚煩杞埌鐨勯〉闈㈡病浠涔堢敤鏃訛紝灝卞簲璇ヨ冭檻浣跨敤outputLink浜嗐?nbsp;

Java浠g爜  鏀惰棌浠g爜
  1. <h:commandLink action="#{user.testLink}"><f:verbatim>澧炲姞</f:verbatim></h:commandLink>  



鍙﹀錛氬鏋滈渶瑕佷紶閫掑弬鏁?lt;f:param.../>錛屼嬌鐢╟ommandLink 
鍦╝ction鎴朼ctionListener涓幏鍙?lt;f:param.../>錛?/p>

Java浠g爜  鏀惰棌浠g爜
  1. FacesContext ctx = FacesContext.getCurrentInstance();   
  2. int productId = Integer.parseInt((String)ctx.getExternalContext().getRequestParameterMap().get("productId"));   



outputLink 

姣旇搗鍓嶄袱涓潵璇達紝浠栫浉褰撶殑杞婚噺綰т簡銆備粬浼氱洿鎺ヤ駭鐢熶竴涓?lt;a href=""></a>閾炬帴錛岃煩杞埌鐩稿簲鐨勯〉闈紝鍥犳娌℃湁榪涘叆JSF鐢熷懡鍛ㄦ湡鐨勯澶栧紑閿錛岃窡鎴戜滑鐩存帴鍐欎竴涓猦tml鐨勯摼鎺ユ病浠涔堝尯鍒?nbsp;

濡傛灉闇瑕佷紶閫掑弬鏁幫紝宓屽叆<f:param name="a" value="b"/>灝卞彲浠ヤ簡錛屽綋鐒惰繖閲岀殑value鍙互鐢ㄨ〃杈懼紡鏉ヨ〃紺猴紝姣斿value="#{param.productId}"錛岀敤璧鋒潵鏄浉褰撴柟渚跨殑銆?/p>

Java浠g爜 澶嶅埗浠g爜
  1. <h:outputLink value="productEdit.faces">    
  2. <h:outputText value="緙栬緫"/>    
  3. <f:param name="productId" value="#{item.productId}"/>    
  4. </h:outputLink>  



鍏舵晥鏋滀負<a href="..jsf?productId=..."></a> 

h:commandButton銆乭:commandLink 鍜宧:outputLink鐨勫樊鍒湪浜庯細h:outputLink娌℃湁榪涘叆JSF鐨勭敓鍛藉懆鏈?鑰宧:commandLink鍜宧:commandButton閮借榪涘叆JSF鐨勭敓鍛藉懆鏈?



涓冨瓚 2011-07-25 10:22 鍙戣〃璇勮
]]>
緙栧啓 JSF 鑷畾涔夊鍚堢粍浠剁殑鎶宸у拰紿嶉棬http://www.aygfsteel.com/chen45257211/articles/354763.html涓冨瓚涓冨瓚Thu, 21 Jul 2011 02:56:00 GMThttp://www.aygfsteel.com/chen45257211/articles/354763.htmlhttp://www.aygfsteel.com/chen45257211/comments/354763.htmlhttp://www.aygfsteel.com/chen45257211/articles/354763.html#Feedback0http://www.aygfsteel.com/chen45257211/comments/commentRss/354763.htmlhttp://www.aygfsteel.com/chen45257211/services/trackbacks/354763.html闃呰鍏ㄦ枃

涓冨瓚 2011-07-21 10:56 鍙戣〃璇勮
]]>
Js閫氱敤鍒嗛〉鏂規硶錛堣漿杞斤級http://www.aygfsteel.com/chen45257211/articles/354367.html涓冨瓚涓冨瓚Fri, 15 Jul 2011 01:12:00 GMThttp://www.aygfsteel.com/chen45257211/articles/354367.htmlhttp://www.aygfsteel.com/chen45257211/comments/354367.htmlhttp://www.aygfsteel.com/chen45257211/articles/354367.html#Feedback0http://www.aygfsteel.com/chen45257211/comments/commentRss/354367.htmlhttp://www.aygfsteel.com/chen45257211/services/trackbacks/354367.html

Java浠g爜

銆銆Java鍚庡彴錛?/p>

銆銆public class PageEntity {

銆銆private int page;//褰撳墠欏電爜

銆銆private int total;//涓鍏卞灝戞潯

銆銆private int totalPage;//涓鍏卞灝戦〉

銆銆private int firstResult;//褰撳墠棣栬褰?/p>

銆銆private int lastResult;//褰撳墠灝捐褰?/p>

銆銆private int pageSize = 10; //姣忛〉鍑犳潯鏁版嵁

銆銆public int getPage() {

銆銆return page;

銆銆}

銆銆public void setPage(int page) {

銆銆this.page = page;

銆銆}

銆銆public int getTotal() {

銆銆return total;

銆銆}

銆銆public void setTotal(int total) {

銆銆this.total = total;

銆銆}

銆銆public int getTotalPage() {

銆銆return totalPage;

銆銆}

銆銆public void setTotalPage(int totalPage) {

銆銆this.totalPage = totalPage;

銆銆}

銆銆public int getFirstResult() {

銆銆return firstResult;

銆銆}

銆銆public void setFirstResult(int firstResult) {

銆銆this.firstResult = firstResult;

銆銆}

銆銆public int getLastResult() {

銆銆return lastResult;

銆銆}

銆銆public void setLastResult(int lastResult) {

銆銆this.lastResult = lastResult;

銆銆}

銆銆public int getPageSize() {

銆銆return pageSize;

銆銆}

銆銆public void setPageSize(int pageSize) {

銆銆this.pageSize = pageSize;

銆銆}

銆銆}

銆銆//榪欓噷娉ㄦ剰page蹇呴』鍦╢irstResult涔嬪墠璁$畻

銆銆public PageEntity getPageEntity(HttpServletRequest request,GenericIface entityDao,String where) {

銆銆String strPage = request.getParameter("page") == null ? "1":request.getParameter("page");

銆銆int page = Integer.parseInt(strPage);//瑕佹煡璇㈢殑欏墊暟

銆銆int total = entityDao.findNumber(where);//褰撳墠鏁版嵁搴撴昏褰曟暟

銆銆int pageSize = 20;//姣忛〉瑕佹樉紺虹殑璁板綍

銆銆int firstResult = 0;//璧峰璁板綍

銆銆int lastResult = 0;//鏈熬璁板綍

銆銆int totalPage = 0;

銆銆if(total > 0){

銆銆totalPage = (total + pageSize -1)/pageSize;

銆銆if(page == -1){

銆銆page = totalPage;

銆銆}else if(page < 1){

銆銆page = 1;

銆銆}else if(page > totalPage){

銆銆page = totalPage;

銆銆}

銆銆firstResult = (page-1)*pageSize;

銆銆lastResult = firstResult + pageSize;

銆銆}else{

銆銆//濡傛灉娌℃湁璁板綍  鍒欐竻闆?nbsp; 鍥犱負欏甸潰鏈夊姞1澶勭悊  鎵浠irstResult=-1

銆銆page = 0;

銆銆firstResult = -1;

銆銆lastResult = 0;

銆銆}

銆銆PageEntity pageEntity = new PageEntity();

銆銆pageEntity.setFirstResult(firstResult);

銆銆pageEntity.setLastResult(lastResult);

銆銆pageEntity.setPage(page);

銆銆pageEntity.setTotal(total);

銆銆pageEntity.setTotalPage(totalPage);

銆銆pageEntity.setPageSize(pageSize);

銆銆return pageEntity;

銆銆}

銆銆鍓嶅彴js錛?/p>

銆銆//鍒嗛〉紼嬪簭 1琛ㄧず絎竴欏?2琛ㄧず涓婁竴欏?3琛ㄧず涓嬩竴欏?4琛ㄧず灝鵑〉

銆銆function changePage(e){

銆銆var page = document.getElementById("nowPage") == null ? "1":document.getElementById("nowPage").value;

銆銆switch(e){

銆銆case 1:page=1;break;

銆銆case 2:page--;break;

銆銆case 3:page++;break;

銆銆case 4:page=-1;break;

銆銆}

銆銆var url = "action.do?page=" + page + getCondition(page);

銆銆document.location.href = url;

銆銆}

銆銆function forwardPage(){

銆銆var page = document.getElementById("nowPage") == null ? "1":document.getElementById("nowPage").value;

銆銆var exp = /^(0|[1-9]\d*)$/;

銆銆var result = page.match(exp);

銆銆if(result != null){

銆銆var url = " action.do?page=" + page + getCondition(page);

銆銆document.location.href = url;

銆銆}else{

銆銆alert("璇瘋緭鍏ュ悎娉曟暟瀛?");

銆銆}

銆銆}

銆銆Jsp欏甸潰:

銆銆<div id="page" class="w_872 mrg_s10">

銆銆<label><input name="" type="button" class="tnleft1" onClick="changePage(1)" title="棣栭〉" /></label>

銆銆<label><input name="" type="button" class="tnleft2" onClick="changePage(2)" title="涓婁竴欏? /></label>

銆銆<label class="fo">欏電爜 <input type="text" class="input5" id="nowPage" value="${pageEntity.page }" onblur="forwardPage()"> of <span>${pageEntity.totalPage }</span></label>

銆銆<label><input name="" type="button" class="tnrig2" onClick="changePage(3)" title="涓嬩竴欏? /></label>

銆銆<label><input name="" type="button" class="tnrig1" onClick="changePage(4)" title="灝鵑〉" /></label>

銆銆<label class="rig"><span>${pageEntity.firstResult+1 }</span> to <span>${pageEntity.lastResult }</span>錛屽叡<span>${pageEntity.total }</span>鏉?lt;/label>

銆銆</div>

銆銆欏甸潰鏁堟灉灞曠ず:


鏂囩珷鍑哄 錛?a >http://java.chinaitlab.com/ServletJsp/816055.html
                                                                                                                                               




涓冨瓚 2011-07-15 09:12 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 彰武县| 吉安市| 宜宾县| 闵行区| 汤阴县| 囊谦县| 图们市| 资中县| 徐水县| 南丹县| 镇安县| 大埔区| 永和县| 平邑县| 驻马店市| 丰宁| 新晃| 内乡县| 吉安市| 诸城市| 张北县| 东光县| 平定县| 铜山县| 晴隆县| 仪陇县| 青州市| 丰原市| 平南县| 龙游县| 墨江| 乳山市| 六枝特区| 桂阳县| 永昌县| 密山市| 阳新县| 重庆市| 共和县| 大同县| 鸡东县|