一、前台从后台取值?
servlet-<<jsp
方式一:
servlet:requegst.setAttribute("name","周杰");
jsp:request.getAttribute("name");
方式二:
servlet:request.setAttribute("name","周杰");
${name}
后台往前台写值?
servlet:out.write("网页面写值");
二、Web乱码问题解决方案?
1、jsp中设置contentType="text/html;charset=utf-8"
2、servlet中设置
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
3、数据库访问链接中设置
jdbc:mysql://localhost:3306/dataName?useUnicode=true&useCharacterEncoding=utf-8