基于javaweb+jsp的宠物店信息管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Bootstrap Ajax)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
<if test ='password != null'>`password` = #{password},</if>
<if test ='realName != null'>`real_name` = #{realName},</if>
<if test ='userSex != null'>`user_sex` = #{userSex},</if>
<if test ='userPhone != null'>`user_phone` = #{userPhone},</if>
<if test ='userText != null'>`user_text` = #{userText},</if>
<if test ='userType != null'>`user_type` = #{userType}</if>
</set>
WHERE `id` = #{id}
</update>
<!--获取-->
<select id="findById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM `t_user` WHERE `id` = #{id}
<script type="text/javascript">
//提交之前进行检查,如果return false,则不允许提交
function check() {
//根据ID获取值
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (username == "") {
alert("用户名不能为空!");
return false;
}
if (password == "") {
alert("密码不能为空!");
return false;
}
return true;
vo.setUserType(Util.decode(request, "userType"));
userService.update(vo);
this.redirectList(request, response);
}
/**
* 获取用户的详细信息(详情页面与编辑页面要显示该用户的详情)并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping({"userGet", "userEditPre"})
public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");//取出主键id
User vo = userService.get(id);
response.getWriter().println(com.alibaba.fastjson.JSONObject.toJSONString(vo));
}
this.pageSize = pageSize;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getStartIndex() {
return startIndex;
}
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getUserSex() {
char[] ch = temp.trim().toCharArray();
float chLength = 0;
float count = 0;
for (int i = 0; i < ch.length; i++) {
char c = ch[i];
if (!Character.isLetterOrDigit(c)) {
if (!isChinese(c)) {
count = count + 1;
}
chLength++;
}
}
return count / chLength > 0.4;
}
<label for="edit-petAge" class="control-label">年龄:</label>
<input type="text" class="form-control" name="petAge" id="edit-petAge">
</div>
<div class="form-group">
<label for="edit-petMaster" class="control-label">主人:</label>
<input type="text" class="form-control" name="petMaster" id="edit-petMaster">
</div>
<div class="form-group">
<label for="edit-petMasterPhone" class="control-label">主人电话:</label>
<input type="text" class="form-control" name="petMasterPhone" id="edit-petMasterPhone">
</div>
<div class="form-group">
<label for="edit-petText" class="control-label">备注:</label>
<textarea style="height: 100px;" class="form-control" name="petText" id="edit-petText"></textarea>
</div>
<div class="form-group hidden">
<label for="edit-createTime" class="control-label">创建时间:</label>
<input type="text" class="form-control" name="createTime" id="edit-createTime">
<label for="add-petType" class="control-label">类型:</label>
<input type="text" class="form-control" name="petType" id="add-petType">
</div>
<div class="form-group">
<label class="control-label">性别:</label>
<input name="petSex" id="add-petSex_雄" type="radio" value="雄" checked="checked"/>雄
<input name="petSex" id="add-petSex_雌" type="radio" value="雌"/>雌
</div>
<div class="form-group">
<label for="add-petAge" class="control-label">年龄:</label>
<input type="text" class="form-control" name="petAge" id="add-petAge">
</div>
<div class="form-group">
<label for="add-petMaster" class="control-label">主人:</label>
<input type="text" class="form-control" name="petMaster" id="add-petMaster">
</div>
<div class="form-group">
<label for="add-petMasterPhone" class="control-label">主人电话:</label>
<input type="text" class="form-control" name="petMasterPhone" id="add-petMasterPhone">
</div>
<div class="form-group">
* 根据条件查询宠物的列表并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("petList")
public void list(HttpServletResponse response, HttpServletRequest request) throws IOException {
this.redirectList(request, response);
}
/**
* 跳转到列表页面
*
* @param request
* @param response
*/
private void redirectList(HttpServletRequest request, HttpServletResponse response) throws IOException {
//查询列和关键字
String searchColumn = Util.decode(request, "searchColumn");
String keyword = Util.decode(request, "keyword");
Map<String, Object> params = new HashMap();//用来保存控制层传进来的参数(查询条件)
params.put("searchColumn", searchColumn);//要查询的列
params.put("keyword", keyword);//查询的关键字
<img id="img_validation_code" src="authValidationCode" onclick="refresh()" style="height: 30px;width: 135px;"/>
</div>
</div>
<div class="loginBtn">
<button type="submit" class=" btn btn-pill btn-grad btn-warning loginBtn">登录</button>
</div>
<br>
<br>
</form>
</div>
</div>
</body>
<script type="text/javascript">
//提交之前进行检查,如果return false,则不允许提交
function check() {
//根据ID获取值
var username = document.getElementById("username").value;
@RequestMapping("petAdd")
public void add(HttpServletResponse response, HttpServletRequest request) throws IOException {
Pet vo = new Pet();
//取出页面传进来的参数
vo.setPetName(Util.decode(request, "petName"));
vo.setPetType(Util.decode(request, "petType"));
vo.setPetSex(Util.decode(request, "petSex"));
vo.setPetAge(Util.decode(request, "petAge"));
vo.setPetMaster(Util.decode(request, "petMaster"));
vo.setPetMasterPhone(Util.decode(request, "petMasterPhone"));
vo.setPetText(Util.decode(request, "petText"));
//调用Service层的增加(insert)方法
petService.insert(vo);
this.redirectList(request, response);
}
/**
* 删除宠物
*
* @param response
* @param request
<th style="text-align: center;">
<button class="btn btn-pill btn-grad btn-info btn-sm" data-id="${vo.id}"
data-toggle="modal" data-target="#modal-info">详情
</button>
<button class="btn btn-pill btn-grad btn-warning btn-sm"
<c:if test="${loginUser.userType != '管理员' && vo.id != loginUser.id}">disabled="disabled" title="没有权限!!!"</c:if>
data-id="${vo.id}"
data-toggle="modal" data-target="#modal-edit">编辑
</button>
<button class="btn btn-pill btn-grad btn-warning btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> data-id="${vo.id}"
data-toggle="modal" data-target="#modal-delete">删除
</button>
</th>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div style="float: right;padding-right: 10px;color: #515151;"><jsp:include page="split.jsp"/></div>
</div>
</div>
</div>
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、宠物模块的增删改查管理