小小的娃儿 2015-05-17 08:56 采纳率: 0%
浏览 2354

求助:No result defined for action X and result input

我使用是SSH框架 ,在web页面点击提交后提示:
com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Could not find action or result
/book2/progenitor2!register.action
No result defined for action cn.book.action.ProgenitorAction and result input

struts.xml配置如下:




/result.jsp
/person/personCenter.jsp


image/bmp,image/png,image/gif,image/pjpeg,img/jpg



/progenitor.jsp


jsp代码如下:




/s:hidden



照片: height="70px" />

/s:form
Action类代码:
public class ProgenitorAction extends ActionSupport {
....
private File file; // File对象
private String fileFileName; // 获取上传文件名
private String fileContentType;

public String register() throws Exception {
    Users user=(Users) ServletActionContext.getRequest().getSession().getAttribute("USER");
    System.out.println("当前用户:"+user.getUsername());
    if(null==user){
        this.tag=4;
    }else{
        if(this.progenitorService.valiUser(user)){
            // 取得后缀名
            String hou = "";
            // 从项目根路径里取得upload文件夹的全路径
            String root = ServletActionContext.getRequest().getRealPath("/upload");
            System.out.println("fileFileName:"+this.fileFileName);
            //判断file不为空的时候执行文件的上传
            if (this.file != null &&!"".equals(this.fileFileName)) {


                // 当文件名不为空时取得后缀
                if (this.fileFileName != null|| this.fileFileName.indexOf(".") != -1) {
                    hou = this.fileFileName.substring(
                            this.fileFileName.lastIndexOf(".") + 1).trim()
                            .toLowerCase();
                }

                // 获取request对象
                HttpServletRequest request = ServletActionContext.getRequest();

                // 创建随机数辅助类对象,并传当前IP参数
                IPTimeStamp ip = new IPTimeStamp(request.getRemoteAddr());
                // 组合文件名
                this.fileFileName = ip.getIPTimeStampRand() + "." + hou;

                // 根据上传文件创建输入流
                InputStream is = new FileInputStream(file);
                File destFile = new File(root, fileFileName);
                OutputStream os = new FileOutputStream(destFile);
                byte[] buffer = new byte[1024];
                int length = 0;
                while (-1 != (length = is.read(buffer))) {
                    os.write(buffer, 0, length);
                }
                os.close();
                is.close();
                //不为空的时候set为当前图片
                progenitor.setPhoto("upload/"+fileFileName);
                System.out.println("图片名称为:"+fileFileName);
            } else {
                // 为空的时候set为默认图片
                progenitor.setPhoto(pic);
            }


            progenitor.setUsers(user);
            this.progenitorService.register(progenitor);


            this.tag=5;
        }else{
            this.tag=6;
        }
    }
    return "doresult";
}
}
  • 写回答

1条回答 默认 最新

  • baidu_28355125 2015-05-27 01:41
    关注

    找不到action对应的result

    评论

报告相同问题?

悬赏问题

  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败