网宿开发环境总结

项目发布流程发布步骤:
1.  确认提交代码.

2.  先构建service,后构建war。(构建完了自动发布到服务器)若访问不了,重新构建,知道能够访问了。http://172.28.17.85:8080/itop-war/user/


有问题时可通过secureCRT查看172.28.17.85服务器端 tomcat日志:

有问题没思路时首先看错误日志

ops@copy:/var/lib/tomcat7$ cd logs
ops@copy:/var/lib/tomcat7/logs$ dir
 localhost_access_log.2016-12-02.txt    
ops@copy:/var/lib/tomcat7/logs$ tail -n 100 itop-war.log


config.properties等资源文件并没有打包到war包,发布时需要单独在linux服务器上配置。


图片放在服务器的位置:

 /usr/local/pics


简单测试form表单的springmvc的响应:

文件要html格式的,jsp不行

当选中了传输的文件时,前台逻辑控制显示ffile属性。否则报错:string not not convert to MultipartFile

<html>

<body>
<form id="p" action="http://localhost:8090/itop-war/user/update" 
     method="post" 
     enctype="multipart/form-data">
  <input type="hidden" name="id" value="181"  />
file: <input type="file" name="ffile"/><br>
    idcardno: <input type="text" name="idcardno"/><br>
  <input type="submit" value="ok" />

</form>

</body>

</html>

//后台代码

@ResponseBody
public JSONObject insert(Employee record, @RequestParam(value="ffile",required=false) MultipartFile ffile,
HttpServletRequest request) {
// 图片上传处理
if (ffile != null && !ffile.isEmpty()) {
String dir = Cfg.cfg.getString("server.dir"); // 设定文件保存的目录
String orName = ffile.getOriginalFilename();
int index = orName.lastIndexOf(Commons.DIAN);
String filename = record.getIdcardno() + orName.substring(index); // 文件名用上传的身份证号
try {
FileUtils.writeByteArrayToFile(new File(dir, filename),
ffile.getBytes());
} catch (IOException e) {
log.error("upload fail:" + e.getMessage());
}
record.setPath(filename); // 设置图片所在路径
}else{
record.setPath("");
}


在自己的电脑上使用别人的前台开发环境:

修改文件 C:\Windows\System32\drivers\etc\hosts

172.28.11.10 www.lewis.com  (对方的ip)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值