先详细介绍下情况:[页面如下]
-------------------------------------------
【添加按钮】  【查找按钮】 【编辑按钮】------------------上部结束---------------页面下面是个Iframe框架
-------------------------------------------
上面就是大致的页面布局,问题就是我点添加按钮的时候  iframe里面出现我的表单向里面输入值后,这时候我在后台Acion在保存对象的时候故意把某一属性x【x属性是User类类型】;
让x不保存USER类型,而去保存String类型 
这时候肯定是保错了 而我在struts.xml里面有设置了   <result name="input">contentAdd.jsp</result> 
这是后报异常它就跳到输入表单的页面。
但问题就在这 当它报异常跳转到contentAdd.jsp 时候  我点编辑按钮要跳到别的页面 都不行 还一直是contentAdd.jsp页面重新打开个新浏览器 iframe 里面还是contentAdd.jsp页面只有重启tomcat才重新进入登陆页面 , 谁能说明下原因 是不是iframe的原因 还是struts2的原因

解决方案 »

  1.   

    Action实例范围问题吧。
    贴贴代码
      

  2.   


    /**
     * 添加文章
     * @return
     */
    public String addArticleJsp(){
    return "contentAdd";
    } public String addArticle(){
    if(getIntegerParameter("articleId")==null){
    article=new Article();
    }else{
    article=getEntityDao().get(getIntegerParameter("articleId"));
    }
    Caption c=getEntityDao().get(Caption.class, getIntegerParameter("captionId"));
    article.setWdate(new Date());
    article.setCaption(c);  //不存对象存String出上面错误
    article.setTitle(model.title);
    Enumeration<String> params = (Enumeration<String>) getRequest().getParameterNames();
    String parameter;
    while(params.hasMoreElements()) {
    parameter = params.nextElement();
                if(parameter.equals("EditorDefault")){
                 article.setArtText(Hibernate.createBlob(getStringParameter(parameter).getBytes()));
                 text=getStringParameter(parameter);
                }
    }
    InputStream input=null;
    try {
    if(file!=null){
    input=new FileInputStream(file);
    Blob b1=Hibernate.createBlob(input);
    article.setPhoto(b1);
    getEntityDao().save(article);
    input.close();
    }
    getEntityDao().save(article);
    } catch (Exception e) {
    try {
    input.close();
    } catch (Exception e1) {
    e1.printStackTrace();
    }
    e.printStackTrace();
    }
    return showArticle();
    }
      

  3.   

    不做这动作可以胜利去换  
    就是做了这动作 然后后台异常 跳到input结果去后就不动了  任何按钮都跳到input里去 不知道是否和Iframe有关