java - 如果获知一些动作是否顺利正确完成,如上传文件等等...
PHPz
PHPz 2017-04-17 17:44:02
0
5
304

比如,现在在springMVC用MultipartFile去上传文件,好像找不到一个可以返回什么提示的方法。这些情况下,如何得知是否正确完成上传呢?
有个印象就是,有些程序能过,但是却没能完成指定的业务。另外,有时候也需要反馈写什么信息....

PHPz
PHPz

学习是最好的投资!

reply all(5)
大家讲道理

Encapsulate a result object, add different information to the result object, and feed it back to the front desk. The front end gets the data: content in json and prints out the prompt information.

@ResourceMapping("denyApproval")
public RpcResult<Object> denyApproval(@RequestParams
AssetsOrderExt assetsOrderExt, ErrorContext error, Context context) {
    RpcResult<Object> extDataResult = new RpcResult<Object>();
   

} else {

            boSuccess = false;
            sbInfo.append("流程创建失败,请联系系统管理员!");
            logger.info("流程创建失败,请联系系统管理员!");
        }
    } catch (Exception e) {
        boSuccess = false;
        sbInfo.append("审批出现异常,请联系系统管理员!");
        logger.info("审批出现异常,请联系系统管理员!");
    } finally {
        extDataResult.setSuccess(boSuccess);
        extDataResult.setInfo(sbInfo.toString());
    }

    return extDataResult;
       
巴扎黑

Just report the exception directly in the background and return the status code 500 directly.

Ty80

log log....

刘奇

If you refer to: Browser=》Server=》Browser

So if you want to get feedback information, you need some third-party plug-ins, such as: https://blueimp.github.io/

阿神

If it is an error, you can catch the exception, but if a picture is missing a few K, it is considered an exception, so you can only use third-party tools

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template