<th id="wu2k2"><s id="wu2k2"></s></th> <blockquote id="wu2k2"></blockquote>
  • <tr id="wu2k2"></tr>
  • <samp id="wu2k2"><tbody id="wu2k2"></tbody></samp><samp id="wu2k2"><tbody id="wu2k2"></tbody></samp>
  • 更多精彩內(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 久久精品国产亚洲AV高清热| 亚洲精品成人无码中文毛片不卡| 国产精品原创巨作av女教师| 国产精品青草视频免费播放 | 精品国产一区二区三区不卡| 亚洲国产精品自产在线播放| porn在线精品视频| 精品国产三级a∨在线| 91国内揄拍国内精品对白不卡| 国产亚洲精品久久久久秋霞 | 久久亚洲私人国产精品vA| 一区二区三区免费精品视频| 狠狠色香婷婷久久亚洲精品| 国产精品186在线观看在线播放| 国产真实乱子伦精品视| 亚洲va精品中文字幕| 国产精品久久久久AV福利动漫| 国产精品视频白浆免费视频 | 久久er国产精品免费观看8| 九九热在线视频精品| 国内精品久久久久久野外| 国产午夜福利久久精品| 亚洲精品乱码久久久久久V| 91大神精品在线观看| 四虎国产精品永久在线| 亚洲国产另类久久久精品小说| 国产精品免费AV片在线观看| 全球AV集中精品导航福利| 日韩一级精品视频在线观看| 日韩精品亚洲人成在线观看| 国产精品2019| 精品无码成人网站久久久久久| 99re热久久这里只有精品首页| 久久精品www人人爽人人| 无码国产精品一区二区免费式直播 | 日韩精品免费一区二区三区| 99久久99这里只有免费费精品| 99亚洲精品卡2卡三卡4卡2卡| 久久精品亚洲日本波多野结衣| 精品午夜久久网成年网| 国产精品亚洲高清一区二区|