<sup id="m40ya"></sup>
  • 
    
  • <kbd id="m40ya"></kbd>
    <samp id="m40ya"></samp>
    <ul id="m40ya"></ul>
  • 更多精彩內(nèi)容,歡迎關(guān)注:

    視頻號(hào)
    視頻號(hào)

    抖音
    抖音

    快手
    快手

    微博
    微博

    當(dāng)前位置:首頁(yè) 科技百科 java result

    java result

    文檔

    java result

    javaresult是表示數(shù)據(jù)庫(kù)結(jié)果集的數(shù)據(jù)表。預(yù)定義的Result比如:1、dispatcher,它屬于是實(shí)現(xiàn)類ServletDispatcherResult。2、redirect,它是用來(lái)實(shí)現(xiàn)跳轉(zhuǎn)到下一個(gè)頁(yè)面的,與dispatcher不一樣的是,它的特點(diǎn)是全新的請(qǐng)求。
    推薦度:
    導(dǎo)讀javaresult是表示數(shù)據(jù)庫(kù)結(jié)果集的數(shù)據(jù)表。預(yù)定義的Result比如:1、dispatcher,它屬于是實(shí)現(xiàn)類ServletDispatcherResult。2、redirect,它是用來(lái)實(shí)現(xiàn)跳轉(zhuǎn)到下一個(gè)頁(yè)面的,與dispatcher不一樣的是,它的特點(diǎn)是全新的請(qǐng)求。

    java result是什么?讓我們一起來(lái)了解一下吧!

    java result是表示數(shù)據(jù)庫(kù)結(jié)果集的數(shù)據(jù)表。它的完整英文名稱是javax.servlet.jsp.jstl.sql.Result。如果要獲得Result,我們應(yīng)該先要獲得Result,接著ResultSupport.toResult(rs)轉(zhuǎn)化。

    ?

    下面是如何得到result的具體步驟:

    Statement?stmt?=?con.createStatement(
    ??????????????????????????????????????ResultSet.TYPE_SCROLL_INSENSITIVE,
    ??????????????????????????????????????ResultSet.CONCUR_UPDATABLE);
    ???????ResultSet?rs?=?stmt.executeQuery("SELECT?a,?b?FROM?TABLE2");
    ???????Result?rst?=?ResultSupport.toResult(rs);

    預(yù)定義的Result比如:

    1.dispatcher

    它屬于是實(shí)現(xiàn)類ServletDispatcherResult。在它的ResultType的實(shí)現(xiàn)中,調(diào)用了javax.servlet.RequestDispatcher類里面的forward(),

    所以它的作用是跳轉(zhuǎn)頁(yè)面,同時(shí)通過(guò)它的跳轉(zhuǎn)可以儲(chǔ)存原來(lái)頁(yè)面中request的數(shù)據(jù)信息。

    2.redirect

    它也是用來(lái)實(shí)現(xiàn)跳轉(zhuǎn)到下一個(gè)頁(yè)面的,與dispatcher不一樣的是,它的特點(diǎn)是全新的請(qǐng)求,因此其數(shù)據(jù)信息是不同的。

    實(shí)戰(zhàn)演練,具體步驟如下:

    import?org.apache.commons.lang.StringUtils;
    import?java.io.Serializable;
    import?java.util.HashMap;
    import?java.util.Map;
    public?class?Result??extends?BaseDomain?implements?Serializable?{
    ????private?String?code;
    ????private?String?msg;
    ????private?T?data;
    ????private?Result()?{
    ????????this.code?=?UnifyStrErrorCode.SUCCESS.getCode();
    ????????this.msg?=?UnifyStrErrorCode.SUCCESS.getMsg();
    ????}
    ????private?Result(T?data)?{
    ????????this.code?=?UnifyStrErrorCode.SUCCESS.getCode();
    ????????this.msg?=?UnifyStrErrorCode.SUCCESS.getMsg();
    ????????this.setData(data);
    ????}
    ????private?Result(String?code,?String?msg)?{
    ????????this.code?=?UnifyStrErrorCode.SUCCESS.getCode();
    ????????this.msg?=?UnifyStrErrorCode.SUCCESS.getMsg();
    ????????this.setCode(code);
    ????????this.setMsg(msg);
    ????}
    ????private?Result(String?code,?String?msg,?T?data)?{
    ????????this.code?=?UnifyStrErrorCode.SUCCESS.getCode();
    ????????this.msg?=?UnifyStrErrorCode.SUCCESS.getMsg();
    ????????this.setCode(code);
    ????????this.setMsg(msg);
    ????????this.setData(data);
    ????}
    ????public?Result?setError(String?code,?String?msg)?{
    ????????this.setCode(code);
    ????????this.setMsg(msg);
    ????????return?this;
    ????}
    ????public?Result?setError(UnifyStrErrorCode?errorCode)?{
    ????????this.setCode(errorCode.getCode());
    ????????this.setMsg(errorCode.getMsg());
    ????????return?this;
    ????}
    ????public?boolean?isSuccess()?{
    ????????return?StringUtils.equals(this.getCode(),?UnifyStrErrorCode.SUCCESS.getCode());
    ????}
    ????public?static??Result?instance()?{
    ????????return?new?Result();
    ????}
    ????public?static??Result?instance(T?data)?{
    ????????return?new?Result(data);
    ????}
    ????public?static??Result?instance(String?code,?String?msg)?{
    ????????return?new?Result(code,?msg);
    ????}
    ????public?static??Result?instance(String?code,?String?msg,?T?data)?{
    ????????return?new?Result(code,?msg,?data);
    ????}
    ????public?String?getCode()?{
    ????????return?this.code;
    ????}
    ????public?void?setCode(String?code)?{
    ????????this.code?=?code;
    ????}
    ????public?String?getMsg()?{
    ????????return?this.msg;
    ????}
    ????public?void?setMsg(String?msg)?{
    ????????this.msg?=?msg;
    ????}
    ????public?T?getData()?{
    ????????return?this.data;
    ????}
    ????public?void?setData(T?data)?{
    ????????this.data?=?data;
    ????}
    ????public?Map?toJsonMap(){
    ????????Map?map?=?new?HashMap<>();
    ????????map.put("data",this.data);
    ????????map.put("msg",this.msg);
    ????????map.put("code",this.code);
    ????????return??map;
    ????}
    }

    以上就是小編今天的分享了,希望可以幫助到大家。

    文檔

    java result

    javaresult是表示數(shù)據(jù)庫(kù)結(jié)果集的數(shù)據(jù)表。預(yù)定義的Result比如:1、dispatcher,它屬于是實(shí)現(xiàn)類ServletDispatcherResult。2、redirect,它是用來(lái)實(shí)現(xiàn)跳轉(zhuǎn)到下一個(gè)頁(yè)面的,與dispatcher不一樣的是,它的特點(diǎn)是全新的請(qǐng)求。
    推薦度:
    為你推薦
    資訊專欄
    熱門視頻
    相關(guān)推薦
    java resultset java resume java retrofit java reverse() java reverse java rotate java rsa加密 java path java paypal java phoenix java ping java pipeline java rsa公鑰加密 java rsa私鑰加密 java rtp java runnable java runtime.exec java rxjava java sandbox java script java rest java requests java partial java request java parser java repeat java parse java pandas java override java render java region java require java resolve java resources java overload java outofmemory java outer java orm java openssl java regex
    Top 真实国产乱子伦精品一区二区三区| 国产cosplay精品视频| 国产精品免费看久久久无码| 久久精品国产亚洲精品2020| 久久精品女人天堂AV麻| 国产精品无码制服丝袜| 国产成人精品日本亚洲18图| 久久精品99视频| 在线亚洲精品福利网址导航| 国产精品免费看久久久无码| 呦交小u女国产精品视频| 精品人人妻人人澡人人爽人人| 日韩精品无码一区二区视频| 亚洲精品tv久久久久| 国产青草亚洲香蕉精品久久| 思思re热免费精品视频66| 日韩国产成人精品视频| 精品久久久久久亚洲| 久久精品国产精品亚洲艾草网美妙| 国产剧情AV麻豆香蕉精品| 欧美日本精品一区二区三区| 精品国产一区二区三区久久久狼| 久久精品国产99国产精2020丨| 99久久精品毛片免费播放| 亚洲一区二区三区国产精品| 国产三级精品视频| 国产精品综合一区二区| 国语自产精品视频在线看| 欧美精品黑人粗大视频| 精品国产成人亚洲午夜福利| 国产国产成人精品久久| 亚洲精品国产成人中文| 中国精品videossex中国高清| 久久国产精品亚洲综合| 久久精品99国产精品日本| 亚洲AV永久青草无码精品| 久9热免费精品视频在线观看| 久久精品视频久久| 麻豆国产在线精品国偷产拍| 99久久亚洲综合精品成人网| 亚洲综合精品一二三区在线|