JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Web Framework » WebWork  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
作者 請教Action type:Chain的訊息傳遞
酸葡萄





發文: 40
積分: 0
於 2015-01-20 04:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list


我有一Web應用程式,如上圖
在我刷入條碼後 進行拆碼並存入資料庫後,
要將拆出來的型號更新到頁面的墨匣型號的欄位中
並使用ActionMessage提示使用者
我改用<result name="success" type="chain">之後
這些動作都不Work了,
請教我遺漏了什麼了嗎?

struts.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
        <!-- 顯示資料 -->
    <action name="receiveShow" class="com.Action.OpReceiveShowAction" method="Receive" >
            <result name="success">/Core/Operater/Receive/Show.jsp</result>     
            <result name="input">/Core/Operater/InnerList.jsp</result>           
        </action>
        
         <!-- 資料存檔 -->
        <action name="opReceiveSave" class="com.Action.OpReceiveSaveAction" >
           <result name="success" type="chain">receiveShow</result>
            <result name="input" type="chain">receiveShow</result>           
        </action>   
                
        <!-- 資料刪除 -->
        <action name="receiveDelete" class="com.Action.OpReceiveDeleteAction" >
           <result name="success" type="chain">receiveShow</result>
            <result name="input" type="chain">receiveShow</result>           
        </action>


顯示頁面資料的Action
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class OpReceiveShowAction extends PageHelper  {
  
  OpReceiveDao opReceiveDao = (OpReceiveDao) context.getBean("opReceiveDao");
 
  private int rwid;
  private String doco;
  private String custno;
  private String assyno;
  
  public String Receive() throws Exception {
    // TODO Auto-generated method stub
    Object [] args = {rwid};    
    List receiveHeader = opReceiveDao.getReceiveHeader(args);  
    if(receiveHeader.size()==1){
      Map map = (Map)receiveHeader.get(0);    
      request.put("receiveHeader", map);
      this.setCustno((String)map.get("CUSTNO"));
    }        
    List receiveBody = opReceiveDao.getReceiveBody(args);  
    request.put("receiveBody", this.getPageList(receiveBody));
    return SUCCESS;
  }  


資料存檔的Action
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
public class OpReceiveSaveAction extends PageHelper{
  
  OpReceiveDao opReceiveDao = (OpReceiveDao) context.getBean("opReceiveDao");
  CartridgeSpecDAO cartridgeSpecDao = (CartridgeSpecDAO) context.getBean("cartridgeSpecDao");
  
  private int rwid;
  private String custno;
  private String doco;
  private String workdate;
  private String opreator;
  private String packboo;
  private String barcode;
  private String assyno;
  private String boxno;
  private int fkrwid;
    
  @Override
  public String execute() throws Exception {
    // TODO Auto-generated method stub  
    this.setFkrwid(rwid);
 
    Map properties = cartridgeSpecDao.getCartridgeProperties(barcode);
    //System.out.println("Properties Size: "+ properties.size());
    //將頁面的參數放進Map裡,準備寫入資料表中
    properties.put("FKRWID", this.getFkrwid());
    properties.put("doco".toUpperCase(), this.getDoco());
    properties.put("workdate".toUpperCase(), this.getWorkdate());
    properties.put("opreator".toUpperCase(), this.getOpreator());
    properties.put("boxno".toUpperCase(), this.getBoxno());
    properties.put("packboo".toUpperCase(), this.getPackboo());  
        
    if(!properties.containsKey("ASSYNO")){
      //如果沒有判出型號,就把頁面的型號放進Map裡
      properties.put("ASSYNO", this.getAssyno());
    }else{
      //如果有判出型號,就把頁面的型號更新
      this.setAssyno(properties.get("ASSYNO").toString());      
    }  
    
    int rsc = opReceiveDao.setReceiveBody(properties);    
    if(properties.get("BARFORMAT").toString().equals("Z")){      
      this.addActionError("沒有符合的項目!");      
    }else{
      this.addActionMessage( "墨匣代碼 : "+ this.getAssyno());
    }    
    return SUCCESS;  
  }


酸葡萄 edited on 2015-01-20 04:37
reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
959 請教Action type:Chain的訊息傳遞 酸葡萄 3819 2015-01-20 04:17
675 Re:請教Action type:Chain的訊息傳遞 酸葡萄 3744 2015-01-20 04:31
707 Re:請教Action type:Chain的訊息傳遞 酸葡萄 37 2015-01-27 08:52
» JWorld@TW »  Web Framework » WebWork

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8