JavaWeb开发基于
主要介绍了JavaWeb开发基于ssm的校园服务系统,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
开发基于ssm的校园服务系统
的校园服务系统(实例详解
实例详解)
利用Javaweb开发的一个校园服务系统,通过发布自己的任务并设置悬赏金额,有些类似于赏金猎人,在这里分享给大家,有需要可以联系我:2186527424:
stuid, studentid, password, schoolid, sex, name, registertime, money, state
delete from user
where stuid = #{stuid,jdbcType=INTEGER}
insert into user (stuid, studentid, password,
schoolid, sex, name,
registertime, money, state
)
values (#{stuid,jdbcType=INTEGER}, #{studentid,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{schoolid,jdbcType=INTEGER}, #{sex,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{registertime,jdbcType=TIMESTAMP}, #{money,jdbcType=DOUBLE}, #{state,jdbcType=INTEGER}
)
insert into user
stuid,
studentid,
password,
schoolid,
sex,
name,
registertime,
money,
state,
#{stuid,jdbcType=INTEGER},
#{studentid,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR},
#{schoolid,jdbcType=INTEGER},
#{sex,jdbcType=INTEGER},
#{name,jdbcType=VARCHAR},
#{registertime,jdbcType=TIMESTAMP},
#{money,jdbcType=DOUBLE},
#{state,jdbcType=INTEGER},
update user
studentid = #{studentid,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
schoolid = #{schoolid,jdbcType=INTEGER},
sex = #{sex,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
registertime = #{registertime,jdbcType=TIMESTAMP},
money = #{money,jdbcType=DOUBLE},
state = #{state,jdbcType=INTEGER},
where stuid = #{stuid,jdbcType=INTEGER}
update user
set studentid = #{studentid,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
schoolid = #{schoolid,jdbcType=INTEGER},
sex = #{sex,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
registertime = #{registertime,jdbcType=TIMESTAMP},
money = #{money,jdbcType=DOUBLE},
state = #{state,jdbcType=INTEGER}
where stuid = #{stuid,jdbcType=INTEGER}
注销登录界面
package com.ssm.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.ssm.util.JsonUtil;
import com.ssm.po.School;
import com.ssm.po.User;
import com.ssm.service.SchoolService;
import com.ssm.service.UserService;
/**
* 注销登录*
* 异步读取院校列表*
* 读取一个用户信息*
* @author
*
*/
@Controller
@SessionAttributes({ "nowuser","nowadmin"})
@RequestMapping(value = "common/")
public class CommonController {
@Resource(name = "schoolService")
public SchoolService schoolService;
@Resource(name = "userService")
public UserService userService;
// 注销
@RequestMapping("logout.do")
public String logout(HttpServletRequest request, Model model) {
model.addAttribute("msg", "已退出");
request.getSession(false).removeAttribute("nowuser");
request.getSession(false).removeAttribute("nowadmin");
return "login";
}
@RequestMapping("getallschools.do")
public void getallschools(HttpServletResponse response) throws IOException{
System.out.println("000000000000000000000000000000000");
List
list = schoolService.getAllSchoolsNoState();
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
String list_String = JsonUtil.list2json(list);
PrintWriter out = response.getWriter();
out.println(list_String);
out.flush();
out.close();
}
@RequestMapping("getuser.do")
public String getuser(String stuidstr,HttpServletRequest request,Model model) {
int stuid = 0;
try {
stuid = Integer.parseInt(stuidstr);
} catch (Exception e) {
model.addAttribute("msg", "出现错误");
return "userInfo";
}
if (stuid==0) {
model.addAttribute("msg", "出现错误");
return "userInfo";
}
User user = userService.getByUid(stuid);
model.addAttribute("theuser", user);
return "userInfo";
}
}
用户界面
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
个人中心
总结总结
以上所述是小编给大家介绍的JavaWeb开发基于ssm的校园服务系统,希望对大家有所帮助!