<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    action中得到request,session和application屬性方法

    public String execute() throws Exception{//僅僅訪問(wèn)添加用這個(gè)
            ActionContext ac=ActionContext.getContext();
            ac.getApplication().put(
    "app","應(yīng)用范圍");
            ac.getSession().put(
    "ses","session應(yīng)用");
            ac.put(
    "req""request范圍");
            
    return "success"
        }

        
    public String rsa() throws Exception{//得到文件的絕對(duì)路徑用此方法
            HttpServletRequest request = ServletActionContext.getRequest();
            ServletContext servletContext 
    = ServletActionContext.getServletContext();
    //        servletContext.getRealPath("/index.html");得到文件的絕對(duì)路徑
    //        request.getSession();
    //        HttpServletResponse response = ServletActionContext.getResponse();
            request.setAttribute("req""request范圍屬性");
            request.getSession().setAttribute(
    "ses","session會(huì)話范圍屬性");
            servletContext.setAttribute(
    "app","應(yīng)用范圍屬性");
            
    return "success";
            
        }

    posted @ 2012-06-05 17:29 youngturk 閱讀(917) | 評(píng)論 (0)編輯 收藏

    struts2訪問(wèn)屬性的添加..ActionContext,在excute執(zhí)行方法中添加..

    public String execute() throws Exception{//在execute方法里面應(yīng)用全局應(yīng)用session
            ActionContext ac=ActionContext.getContext();
            ac.getApplication().put(
    "app","應(yīng)用范圍");//往serviceContext里放入
            ac.getSession().put("session","session應(yīng)用");//往session里面放
            ac.put("req""request范圍");//往req里面放..
            return "success";
        }


    ActionContext ac = ActionContext.getContext();
    ac.

    posted @ 2012-06-05 16:28 youngturk 閱讀(556) | 評(píng)論 (0)編輯 收藏

    oracle本地網(wǎng)絡(luò)服務(wù)名配置

    1,用vpn可以登錄公司內(nèi)網(wǎng),當(dāng)用戶名,密碼登錄上去了以后即現(xiàn)在的環(huán)境就是公司局域網(wǎng)的了
    可以配置:
    database.url=jdbc:oracle:thin:@11,21,123.0:1521:tianjin
    TJGWL61 =//網(wǎng)絡(luò)服務(wù)名,隨便
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 10.138.5.61)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = tianjin),數(shù)據(jù)庫(kù)名
        )
      )

    posted @ 2012-06-05 13:53 youngturk 閱讀(1342) | 評(píng)論 (0)編輯 收藏

    struts2 請(qǐng)求參數(shù)值的獲得

    action文件:
    public class HelloWorldAction {//id=123&name=aaa
     private Integer id;
     private Person person;
     public Person getPerson() {
      return person;
     }


     public void setPerson(Person person) {
      this.person = person;
     }

    實(shí)體bean文件:
    public class Person {
    //需要默認(rèn)構(gòu)造器,struts2利用反射機(jī)制獲得值
     public String getName() {
      return name;
     }
     public void setName(String name) {
      this.name = name;
     }
     public Integer getId() {
      return id;
     }
     public void setId(Integer id) {
      this.id = id;
     }
     private String name;
     private Integer id;
    }
    瀏覽器請(qǐng)求頁(yè)面:
    <form action="<%=request.getContextPath() %>/control/department/helloWordexecute.action">
    <!--    <form action="/control/department/helloWordexecute.action"> -->
         name:<input type="text" name="person.name">
         id:<input type="text" name="person.id">
         <input type="submit" value="send">
       </form>
    接受實(shí)體bean 值文件:

    <body>
       id=${person.id}<br>
       name=${person.name}

      </body>


    posted @ 2012-06-05 10:23 youngturk 閱讀(859) | 評(píng)論 (2)編輯 收藏

    struts,表單form中對(duì)應(yīng)到action付值的獲得

    package cn.itcast.action;

    import java.net.URLEncoder;

    public class HelloWorldAction {//id=123&name=aaa
        private Integer id;
        
    public Integer getId() {
            
    return id;
        }



        
    public void setId(Integer id) {
            
    this.id = id;
        }



        
    public String getName() {
            
    return name;
        }



        
    public void setName(String name) {
            
    this.name = name;
        }


        
    private String name;
        
    private String msg;
        
    private String username;
        
    private String savepath;
        
        
    public String getSavepath() {
            
    return savepath;
        }


    //    struts2會(huì)自動(dòng)獲struts.xml配置文件中parameter付值變量信息值
        public void setSavepath(String savepath) {
            
    this.savepath = savepath;
    //        <action name="helloWord*" class="cn.itcast.action.HelloWorldAction" method="{1}" >
        
    //        <param name="savepath">/department</param>
        
    //        <result name="success">/WEB-INF/page/message.jsp</result>
    //        </action>
        }



        
    public String getUsername() {
            
    return username;
        }


    //    struts2會(huì)自動(dòng)獲得對(duì)應(yīng)表單提交的字段信息,例如form中有username
        public void setUsername(String username) {
            
    this.username = username;
        }



        
    public String getMessage() {
            
    return msg;
        }

        
    public String addUI(){
            msg 
    = "addUI";
            
    return "success";
        }



        
    public String execute() throws Exception{
            
    //this.username = URLEncoder.encode("傳智播客", "UTF-8");
            this.username = "firest";
            
    this.msg = "我的第一個(gè)struts2應(yīng)用";
            
    return "success";
        }

        
        
    public String add(){
            
    return "message";
        }

    }

    posted @ 2012-06-05 09:59 youngturk| 編輯 收藏

    action管理方式

    1struts.action.extension可以修改請(qǐng)求后綴
    在struts.xml中使用
    <constant name="struts.action.extension" value="do,action"/>
    struts.xml中和struts.properties中可以配置常量,最好在struts.xml中定義
    struts-default.xml
    struts-plugin.xml
    struts.xml
    struts.properties
    web.xml
    重復(fù)定義常量,后面的常量值會(huì)覆蓋前面的常量

    2<constantname="struts.i18n.encoding" value="UTF-8"/>
    參數(shù)作用于setCharacterEncoding方法 freemarker的輸出

    系統(tǒng)自動(dòng)重新加載
    <constantname = "struts.configuration.xmlreload"/>

    創(chuàng)建spring負(fù)責(zé)創(chuàng)建actin對(duì)象
    <constantname = "struts.objectFactory"/>
    限制上傳文件大小
    <constantname = "struts.multipart.maxSize" value="10838274"/>
    3處理流程 action的管理方式
    用戶請(qǐng)求--》strutsprepareAndExecuteFilter---》
    inerceptor,struts2d內(nèi)置的一些攔截器---》
    用戶編寫action類---》result進(jìn)行跳轉(zhuǎn)---》jsp、html---》瀏覽器響應(yīng)
    包唯一的
    4,指定多個(gè)struts文件
    <struts>

    <constant name="struts.action.extension" value="do,action"/>
        <include file="department.xml" />
        <include file="employee.xml" />
       
    </struts>
    employee.xml如下:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">

    <struts>
        <package name="employee" namespace="/control/employee" extends="struts-default">
            <action name="helloWord" class="cn.itcast.action.HelloWorldAction" method="execute" >
                <param name="savepath">/employee</param>
                <result name="success">/WEB-INF/page/message.jsp</result>
            </action>
                
        </package>
    </struts>

    posted @ 2012-06-04 23:04 youngturk 閱讀(218) | 評(píng)論 (0)編輯 收藏

    觸發(fā)器 trigger

    create or replace trigger tr_in
      before insert on doptin  
      
    for each row
    declare
      v_count number;
      
      
    -- local variables here
    begin
      select count(
    *) into v_count from dopt 
      where doptid 
    =:new.proid;
      
      
    if v_count =0 then
        insert into dopt(非變異表) values(sq_dopt.nextval,:
    new.proid,:new.innum);
      
    else
        update dopt set dopt.doptnum 
    = doptnum+:new.innum where proid = :new.proid;
      end 
    if;
      
    --檢測(cè)是否第一次入庫(kù)記錄,如果第一次入庫(kù),則在dopt表中
      
    --建立一條記錄,否則修改dopt表中庫(kù)存數(shù)量
      exception when others then
        dbms_output.put_line(sqlerrm);
    end tr_in;


    --------------------


    create or replace trigger tr_out
      before insert on doptout  
    --觸發(fā)表
      
    for each row
    declare
      v_num number;
      
    -- local variables here
    begin
      select dopt.doptnum into v_num from dopt where dopt.proid 
    = :new.proid;
      
    if :new.outnum > v_num then
        raise_application_error(
    -20001,'庫(kù)存不足');
      
    else
        update dopt set doptnum 
    = doptnum - :new.outnum where doptid = :new.proid;
      end 
    if;
    end tr_out;



    ---------------------------------------
    --1觸發(fā)事件 insert delete update
    --2觸發(fā)時(shí)機(jī)
    --對(duì)dml語(yǔ)句之前還是之后讓他工作
    --3觸發(fā)表,觸發(fā)器為之工作的表
    --4觸發(fā)類型:
    -- 4.1行級(jí),語(yǔ)句級(jí)觸發(fā)器即(表級(jí)觸發(fā)器)
    create or replace trigger tr_row_after
      after update on emp  
      
    for each row
    declare
      
    -- local variables here
    begin
      dbms_output.put_line(
    '××行級(jí)后觸發(fā)器工作××');
    end tr_row_after; 

    -------------------
    create or replace trigger tr_row_before
      before update on emp  
      
    for each row
    declare
      
    -- local variables here
    begin
      dbms_output.put_line(
    'row before trigger test');
    end tr_row_before;
    ----------------------------------------
    create or replace trigger tr_tab_before
      before update on emp  
      
    declare
      
    -- local variables here
    begin
      dbms_output.put_line(
    'table  grade before working');
    end tr_tab_before;
    -------------------------
    create or replace trigger tr_tab_after
      before update on emp  
      
    declare
      
    -- local variables here
    begin
      dbms_output.put_line(
    'table  grade after working');
    end tr_tab_after;
    ------------------------------------------執(zhí)行結(jié)果:
    table  grade after working
    table  grade before working
    row before trigger test
    row after trigger test
    row before trigger test
    row after trigger test
    row before trigger test
    row after trigger test
    ----------------------
    -----------觸發(fā)操作(觸發(fā)器中語(yǔ)句塊
    ---周末不能對(duì)員工表做操作

    create or replace trigger tr_emp2_in_up_de
      before insert or update or delete on emp2  
      
    declare
      v_day varchar2(
    20);
      
    -- local variables here
    begin
      select to_char(sysdate,
    'dy') into v_day from dual;

        
    if inserting then
            raise_application_error(
    -20001,'have the rest day can not control employ');
        elseif updating then
            raise_application_error(
    -20001,'have the rest day not control employ');
        elseif deleting then
            raise_application_error(
    -20001,'have the rest day cnot control employ');
        end 
    if;

    end tr_emp2_in_up_de;
    ---------觸發(fā)器執(zhí)行
    --ml操作請(qǐng)求---》觸發(fā)器工作---》dml操作結(jié)束----》commit or roback
    --觸發(fā)器不能還有事務(wù)控制語(yǔ)句;commit roback
    ---不能含有ddl語(yǔ)句,因?yàn)閐dl語(yǔ)句會(huì)自動(dòng)提交;
    ---觸發(fā)器代碼大小不能超過(guò)512k,可以使用觸發(fā)器調(diào)用過(guò)程或者函數(shù)調(diào)用,解決較大代碼調(diào)用問(wèn)題
    ---注意,觸發(fā)器都是在dml結(jié)束前執(zhí)行 ,delete中 :old指刪除的要操作de舊記錄,insert中:new指要插入的新記錄
    --after,與 before觸發(fā)器的區(qū)別,update即可以:new,又可以:old,他們只能在行集觸發(fā)器中使用..
    --行級(jí)before觸發(fā)器可以修改:new的值,而行級(jí)后after觸發(fā)器則不行
    --1觸發(fā)時(shí)機(jī),before比after先執(zhí)行,
    --2-定義取編號(hào)觸發(fā)器
    create or replace trigger tr_teb_before
      before insert on teb  
      
    for each row
    declare
      
    -- local variables here
      v_num number;
    begin
       select sq_teb.nextval into v_num from dual;
       :
    new.tebid := v_num;
    end tr_teb_before;
    ---instead of 觸發(fā)器 視圖觸發(fā)器 做修改操作,視圖只是用來(lái)查詢的,一旦用修改則用instead of觸發(fā)器
    ---多表復(fù)雜視圖 不能通過(guò)dml操作修改,
    --和普通dml觸發(fā)器的區(qū)別:instead of 操作會(huì)中斷dml操作
    --普通觸發(fā)器是dml操作事務(wù)的一部分
    --instead of觸發(fā)器會(huì)結(jié)束當(dāng)前dml操作
    --dml操作請(qǐng)求(即dml操作結(jié)束)---》instead of觸發(fā)器工作, set serveroutput on;insert into v_teb2 values(1,'a');
    create or replace trigger tr_teb2
      instead of insert on v_teb2  
      
    for each row
    declare
      
    -- local variables here
    begin
      dbms_output.put_line(
    'instead of trigger working');
      insert into teb2 values(sq_teb.nextval,
    'trigger working');
    end tr_teb2;

    ----約束表,觸發(fā)表,觸發(fā)器工作的表,example:部門表就是員工表的約束表
    ----變異表,就是dml操作過(guò)程的觸發(fā)表
    ----舊數(shù)據(jù)--臟數(shù)據(jù)--》新數(shù)據(jù)
    ---long double 8b  1101 0100 -----1021 2121----->1200 1323
    ----DML開始操作--》行級(jí)觸發(fā)器工作---》end結(jié)束操作。
    ----每個(gè)部門最多6人,6人后,不允許往這個(gè)部門添加員工,和修改其他部門為這個(gè)部門員工
    ----行級(jí)觸發(fā)器不能讀取變異表,
    ---觸發(fā)表:對(duì)于觸發(fā)器而言,就是觸發(fā)器為之定義的表
    ----變異表:就是當(dāng)前dml操作所影響的表(經(jīng)常來(lái)說(shuō)觸發(fā)表就是變異表)
    create or replace trigger tri_emp
      before insert or update on emp3   
      
    for each row
    declare
      
    -- local variables hereer
      v_count number;
    begin
      select count(
    *) into v_count from emp3(本表:(即變異表行級(jí)觸發(fā)器不允許讀取)) where emp3.deptno = :new.deptno;
      
    if v_count >= 6 then
        raise_application_error(
    -20001,'every dept can not over 6 peaple');
      end 
    if;
    end tri;

    ---矛盾;行級(jí)觸發(fā)器不允許查詢變異表,而表級(jí)觸發(fā)器不允許使用:new
    ----解決方案:
    --1,建立包,定義一個(gè)共同變量,用來(lái)存放部門編號(hào)變量
    create or replace 
    package pak_deptno is
      v_deptno number;
    end pak_deptno;
    --2,建立一個(gè)行級(jí)前或者后觸發(fā)器,僅僅將操作行的部門編號(hào)放入包中。
    create or replace trigger tri_row_emp3
      after insert or update on emp3   
      
    for each row
    declare
     
    begin
      pak_deptno.v_deptno:
    =:new.deptno;
    end tri_row_emp3;
    --3,建立一個(gè)表級(jí)后觸發(fā)器中查詢變異表,來(lái)確定是否可以添加.
    create or replace trigger tri_table_emp
      after insert or update on emp3   
    declare
      
    -- local variables hereer
      v_count number;
    begin
      select count(
    *) into v_count from emp3 where emp3.deptno = pak_deptno.v_deptno;
      
    if v_count >= 6 then
        raise_application_error(
    -20001,'every dept can not over 6 peaple');
      end 
    if;
    end tri_table_emp;


    ----如果是一條insert語(yǔ)句,僅僅插入一行記錄,則oracle中行級(jí)觸發(fā)器允許查詢變異表..
    ---insert into emp3 select * from emp where deptno=10;

    posted @ 2012-06-03 23:06 youngturk 閱讀(299) | 評(píng)論 (0)編輯 收藏

    創(chuàng)建觸發(fā)器trigger原創(chuàng)

    create or repalce 泰森 on 霍利菲爾德
    before 出拳
    as
    咬他耳朵.

    posted @ 2012-06-01 22:20 youngturk 閱讀(205) | 評(píng)論 (0)編輯 收藏

    redirect

    redirect重定向的路徑不能在WEB-INF目錄下,WEB-INF目錄下使用的是dispatcher跳轉(zhuǎn).
    example:
    登錄頁(yè)面,用戶登錄錯(cuò)誤時(shí)候,采用重定向redirect方式,返回到登錄界面
    plaintext定向視圖時(shí)候?qū)⒁晥D源碼輸出
    <action name="redirect"> <!-- 默認(rèn)class為 ActionSurport 默認(rèn) 方法為excute result默認(rèn)值是success -->
             <result type="redirect">/redirect.jsp?username=${username}</result><!-- 默認(rèn)請(qǐng)求轉(zhuǎn)發(fā)類似    dispatcher -->
     </action>

    posted @ 2012-05-31 16:05 youngturk 閱讀(170) | 評(píng)論 (0)編輯 收藏

    第一個(gè)宏定義 <#macro statusInfo main=main>

    <#macro statusInfo  main=main> statusInfo表示宏的名字,左邊的main表示型參(為以后在宏中應(yīng)用),右邊的main表示實(shí)參(也就是java實(shí)際返回的變量名字)
    </#macro>

    posted @ 2012-05-30 09:11 youngturk 閱讀(210) | 評(píng)論 (0)編輯 收藏

    僅列出標(biāo)題
    共33頁(yè): First 上一頁(yè) 12 13 14 15 16 17 18 19 20 下一頁(yè) Last 
    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導(dǎo)航

    統(tǒng)計(jì)

    公告

    this year :
    1 jQuery
    2 freemarker
    3 框架結(jié)構(gòu)
    4 口語(yǔ)英語(yǔ)

    常用鏈接

    留言簿(6)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    相冊(cè)

    EJB學(xué)習(xí)

    Flex學(xué)習(xí)

    learn English

    oracle

    spring MVC web service

    SQL

    Struts

    生活保健

    解析文件

    搜索

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 亚洲午夜AV无码专区在线播放 | 国产羞羞的视频在线观看免费| 9久热这里只有精品免费| AAA日本高清在线播放免费观看| 18国产精品白浆在线观看免费 | 日韩免费三级电影| 亚洲精品乱码久久久久久蜜桃不卡 | 国产免费无码AV片在线观看不卡| 亚洲一级黄色视频| 中文在线免费看视频| 成人au免费视频影院| 久久精品国产亚洲av四虎| 亚洲av无码片vr一区二区三区| 最新国产乱人伦偷精品免费网站 | 四虎永久在线观看免费网站网址| 中文字幕精品亚洲无线码一区| 亚洲第一永久在线观看| 两个人看的www视频免费完整版| 色噜噜AV亚洲色一区二区| 午夜精品一区二区三区免费视频| 免费永久在线观看黄网站| 亚洲色大成网站www永久| 免费看黄福利app导航看一下黄色录像| 久热免费在线视频| 亚洲中久无码永久在线观看同| a级毛片免费全部播放无码| 亚洲色婷婷综合开心网| 国产色爽免费无码视频| 亚洲女人影院想要爱| 99热精品在线免费观看| 亚洲成AV人在线播放无码| 精品人妻系列无码人妻免费视频| 亚洲国产精品va在线播放| 免费H网站在线观看的| 羞羞视频在线免费观看| 成人免费男女视频网站慢动作| 亚洲综合激情六月婷婷在线观看| 成人au免费视频影院| a在线观看免费视频| 亚洲一区AV无码少妇电影| 手机看黄av免费网址|