admin管理员组文章数量:1794759
实训小结
学习小结
为期两个星期的实训结束了,在这两周的时间里,我学到了不少之前没有接触过的知识,这也是我第一次正式接触前端后端的开发。在学习开发的过程中,出现过不少问题,自己能够解决的、自己不能解决的都有,下面是我对这次实训的一次总结。
首先是了解了什么是SSM(SSM=Spring+springMvc+mybatis)、SpringMVC的工作原理以及如何搭建SpringMVC的步骤,再深一步就是注解开发和非注解开发,项目建立的基本步骤:新建web,File—new--other--Web--Dynamic web Project--next--Project name--next--next--Web Module里面选中Generate—Finish,在开发过程中,最可能出现的错误就是404和500,出现404就要考虑是不是配的注解不对,还是路径不对,如果出现500则是代码的问题。
学习了前端的开发之后,就是添加数据库的问题了,建立数据库大概分为这几个步骤以及需要注意的问题(以具体的实例举例):
添加数据库--
添加数据库之后,需要将前端后端结合起来,实现各个功能,下面是我自己的一些总结以及注意点:
e.g @RequestMapping(value="/user")
public class UserController {
@Autowired
private DepartmentService deparetmentSerivce;
@RequestMapping(value = "findDep")
public ModelAndView findDep(Integer departid,String departname)throws Exception {
department department = deparetmentSerivce.findDep(departid, departname);
ModelAndView mv = new ModelAndView();
mv.addObject("department",department);
mv.setViewName("bumenguanli/save2_index2");
return mv;
}
注意:
1、在Service中新建一个文件后,需要在config(配置文件)中spring包中的applicationContext-service.xml文件中加入
<bean id="DepartmentService class="com.neuedu.service.DepartmentServiceImpl"/>
Springmvc 如果不在web-inf中,那么value的值<property name="prefix" value="/"/>
.jsp文件中要改chareset=UTF-8,否则会乱码
e.g<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
function chaxun(){
var dp_id =document.getElementById("departid").value;
var dp_name = document.getElementById("departname").value;
precision.style.display=“";
2、.jsp中的方法
e.g
function chaxun(){
var dp_id =document.getElementById("departid").value;
var dp_name = document.getElementById("departname").value;
precision.style.display="";
window.location.href="../user/findDep?departid="+dp_id+"&departname="+dp_name;
/* ?后面和controller参数相对应 */ ../user/findDep和controller的value相同
}
写方法的时候,public int insDep(Department department)throws Exception;
int是返回类型,参数是通过什么查询之类的,多的话就用对象传
resultType 返回的类型 parameter 传入的的类型可以不写
integer比int多一个null值
以上就是我在这次实训中的一些学习心得。版权声明:本文标题:实训小结 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686779198a101755.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论