8-14教务管理系统

来源:互联网 发布:代理怎么找淘宝货源 编辑:程序博客网 时间:2024/04/29 03:29

关键词:注解;JQuery;JSP传递数据;XML数据类型查询方法XQuery;


把staffinfo_add.jsp和staffinfo.java的属性名对应起来

在input 的name中加上对应的属性,比如:



在staffinfo_add.jsp内添加完毕后,在system 下建一个包 controller 建立staffinfocontroller类



这次主要写了两个类和一个接口,接口是system.service下的StaffInfoService,类是system.controller下的StaffInfoController.java和system.service.impl下的StaffInfoServiceImpl:


staffinfoMapper接口里有许多方法。


在staffinfocontroller类中添加一个:

@InitBinder
public void initBinder(ServletRequestDataBinder bin){
bin.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
}

用于鉴别jsp上输入的日期是否符合各式。


在staffinfo_list  48行添加:
<div align="center">
<div class="alert alert-warning" style="margin:0px;padding:5px;width:80%;">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
</button>
<p align="center" style="color:red;">${info }员工信息添加成功</p>
</div>
</div>


效果图:





所用到的一些注解:

用于注释的注解:

@return:一种java注解,一般写在方法的上面,说明该方法有返回值。只是起到一个说明作用
@param是参数的解释。
=======================================================================


@Service 用于标注业务层组件:


@RequestMapping()是一个用来处理请求地址映射的注解,可用于类或方法上

http://blog.csdn.net/kobejayandy/article/details/12690041


@Resource把一个bean注入到当前的类中,可以不必通过配置文件或者导包的方式注入就可以使用该bean,默认是ByName的方式注入


@InitBinder

http://blog.csdn.net/axin66ok/article/details/17938095


@Controller用于标注控制层组件(如struts中的action)

@RequestMapping(/aa.do)这个注解是SpringMVC中的一个注解,该注解说明的是,对于/aa.do的请求,通过注解标签下面的方法进行响应:



之后的记录不会事无巨细一步一步记录,就记录一些关键字和关键语句。



JSP支持分页查询:




然后在JSP查询条件那里写一个下拉框,加入编号年龄移动电话等选项。






StaffInfoMapper.xml中的对应代码:

<select id="getStaffInfoList" resultMap="BaseResultMap" parameterType="com.bfw.po.StaffInfo">
    select 
    <include refid="Base_Column_List" />
    from staff_info  where  staff_state !='0'


    <if test="staffId != null and staffId!=''" >
        and staff_id=#{staffId,jdbcType=INTEGER}
        </if>
        <if test="staffName != null and staffName!='' ">
        and staff_name=#{staffName}
        </if>
        <if test="staffMobilePhone != null and staffMobilePhone!='' ">
        and staff_mobile_phone=#{staffMobilePhone}
        </if>
         <if test="userNumber != null and userNumber!='' ">
        and user_number=#{userNumber}
        </if>
        <if test="userPassowrd != null and userPassowrd!='' ">
        and user_passowrd=#{userPassowrd}
        </if>
          <if test="staffState != null and staffState!='' ">
        and staff_state=#{staffState}
        </if>


    order by staff_id  desc
    
  </select>





原创粉丝点击