发布于 2016-08-15 09:16:33 | 79 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的JSP教程,程序狗速度看过来!

JSP JAVA公司的WEB开发编程语言

JSP全名为Java Server Pages - java服务器页面是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。JSP技术有点类似ASP技术,它是在传统的网页HTML(标准通用标记语言的子集)文件(*.htm,*.html)中插入Java程序段(Scriptlet)和JSP标记(tag),从而形成JSP文件,后缀名为(*.jsp)。


本篇文章是对jsp:included的使用与jsp:param乱码的解决方法进行了详细的分析介绍,需要的朋友参考下
如果jsp:include 中的page页面存在乱码,则需要在使用<jsp:include page=""> 的页面中的<body>后加上
<%
    request.setCharacterEncoding('UTF-8") ;//或者指定的编码(GBK或其他)
%>
如下面所示:

jsp-include.jsp
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<html>
 <head><title>jsp include测试页</title></head>
 <body>
 <%
  request.setCharacterEncoding("UTF-8") ;
 %>
 <h3>jsp include 指令测试</h3>

 <jsp:include page="forward-result.jsp">
  <jsp:param name="age" value="32" />
  <jsp:param name="username" value="张三" />
 </jsp:include>

 </body>
</html>
forward-result.jsp
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<html>
 <head><title>forward的结果页</title></head>
 <body>
  年龄:<%=request.getParameter("age")%><br />
  姓名:<%=request.getParameter("username") +"--11"%>

 </body>
</html>


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务