<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="../CSS/admin.css" rel="stylesheet" type="text/css" /> <title>添加主题</title> <script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script> <script type="text/javascript"> //页面加载的事件 $(function(){ //表单验证 $("#form1").submit(function(){ var cname=$("#categoryName").val(); var flag=true; if(cname==""){ alert("类别名不能为空!"); flag=false; } return flag; }) }) </script> </head> <body> <form action="../doCategoryaddServlet" method="post" id="form1"> <div id="opt_type">添加主题</div> <% //获取错误信息 String msg=(String)request.getAttribute("ermsg"); if(msg==null){ msg=""; } %> <!-- 显示错误信息 --> 主题:<input type="text" class="classlist" name="categoryName" id="categoryName"/><br/> <span style="color:red"><%=msg %></span><br/> <input type="submit" value="提交" class="classlist" /> <input type="reset" value="重置" class="classlist"/> </form> </body> </html>