碰到一個鬱悶的問題

今天在用WW2時碰到一個很奇怪的問題:
view:
<%@ page pageEncoding="gb2312" contentType="text/html;charset=gb2312"%>
<%@taglib prefix="ww" uri="webwork" %>
<html>
<link rel ="stylesheet" type="text/css" href="template/xhtml/styles.css" title="Style">
<body>
<form name="list" action="userlist.action" method="post">
<input type="hidden" name="actionEvent" value="view">
<input type="hidden" name="id">
<a href="#" οnclick="javascript:doUpdate(<ww:property value="id" />);">修改</a>
</form>
</body>
</html>
<script>
    function doUpdate(id)
    {
  var form = document.list;
  var objid = form.id;
        var objaction = form.actionEvent;
  objid.value = id;
        objaction.value = "update";
  form.submit();       
     }
</script>
control:
   
。。。。
    public Object getModel() {
        if(userDTO != null) return userDTO;
        Integer pid = null;
        System.out.println(ActionContext.getContext().getParameters());//(1)
        if(ActionContext.getContext().getParameters().get("id")!=null)
        {   
        ActionContext context = ActionContext.getContext();
        Map params = context.getParameters();
       // String sid =String.valueOf(params.get("id"))
        String sid = (String) params.get("id");   //(2)
        pid = new Integer(sid);
        }
        if(pid != null) {
             try {
                user = userService.getUserByID(pid);
                //po 轉換成 dto
                userDTO = new UserDTO(user);
            } catch (Exception e) {
                log.error("該用戶已不存在",e);
            }
         }else{
             userDTO = new UserDTO();
         }
         return userDTO;
    }
  。。。。
程序一執行,竟然在(2)報錯:

java.lang.ClassCastException


在(1)的打印信息是:
{actionEvent=[Ljava.lang.String;@1734b48,id=[Ljava.lang.String;@1495bb8}
發佈了38 篇原創文章 · 獲贊 0 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章