java.io.FileNotFoundException:a.properties (系统找不到指定的文件。)
package project001.admin.web;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import project001.admin.entity.WebInfo;
import project001.admin.impl.WebPropImpl;
import project001.admin.impl.webInfoImpl;
import project001.admin.model.WebInfoModel;
@Controller
@RequestMapping("/admin/Config")
public class ConfigController {
@RequestMapping("/index")
public String index(ModelMap modelMap) throws IOException{
Map<String,String> m = WebPropImpl.get();
return "/admin/config/index";
}
@RequestMapping("/submit")
public String submit(WebInfoModel webInfoModel){
WebInfo webInfo = webInfoImpl.get(0);
webInfo.setTitle(webInfoModel.getTitle());
webInfo.setCopyright(webInfoModel.getCopyright());
webInfo.setKeyword(webInfoModel.getKeyword());
webInfo.setDescription(webInfoModel.getDescription());
webInfoImpl.update(webInfo);
return "redirect:index";
}
public static void main(String[] args) throws IOException {
/*Map<String,String> propMap = new HashMap<String,String>();
propMap.put("name", "Mr R");
propMap.put("age", "ff");
propMap.put("from", "4");
WebPropImpl.save(propMap);*/
Map<String,String> m = WebPropImpl.get();
System.out.println(m.get("name"));
}
}
如果直接执行main的函数就正常。
但是通过web地址访问index就报:java.io.FileNotFoundException: base.properties (系统找不到指定的文件。)
要看这个类的具体代码,两种方式的路径是不同的