web
jsp动态包含
jsp:include 动态包含标签,就是将jsp页面经过编译之后,把页面展示的效果引入进来
jsp静态包含
include: 静态包含标签,相当于是将代码复制粘贴过来,file属性指的就是复制代码的路径
jsp:useBean 用来创建对象的标签
- id属性:表示创建的对象名字
- class属性:表示要创建对象的类所在的路径
新闻的增加
//post表单提交中文
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
//获取表单信息
//获取新闻类别
String categoryId=request.getParameter("categoryId");
//获取新闻标题
String title=request.getParameter("title");
//获取作者
String author=request.getParameter("author");
//获取摘要
String summary=request.getParameter("summary");
//获取内容
String newscontent=request.getParameter("newscontent");
newsDetail.setAuthor(author);
newsDetail.setCategoryId(Long.parseLong(categoryId));
newsDetail.setTitle(title);
newsDetail.setSummary(summary);
newsDetail.setContent(newscontent);
newsDetail.setCreateDate(new Date());
newsDetail.setModifyDate(new Date());
//开始保存新闻信息
boolean flag=service.addNews(newsDetail);
if(flag){
//保存成功
response.sendRedirect("newsDetailList.jsp");
}else{
response.sendRedirect("newsDetailCreateSimple.jsp");
}
标签:String,request,getParameter,获取,jsp,newsDetail,day46
From: https://www.cnblogs.com/ayuuuuu/p/16882824.html