易截截图软件、单文件、免安装、纯绿色、仅160KB

jsp乱码问题 URL传值乱码问题

 jsp乱码问题解决
1、一般的jsp页面显示乱码
   <%@ page contentType="text/html; charset=UTF-8"%>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
2、表单提交中文时出现乱码
如果jsp提交英文字符能正确显示,而提交中文时就会出现乱码。
原因:浏览器默认使用UTF-8编码方式来发送请求,而UTF- 8和GB2312编码方式表示字符时不一样,
这样就出现了不能识别字符
解决:再jsp页面设定 <%request.seCharacterEncoding("UTF-8");%>对请求进行统一编码
为了避免每页都要写request.setCharacterEncoding("UTF-8"),建议使用过滤器对所有jsp
进行编码处理,
过滤器——.java文件:
   public class SetCharacterEncodingFilter implements Filter{
 /*过滤器,解决中文乱码问题*/
  protected String encoding = "UTF-8";
  protected FilterConfig filterConfig = null;
  protected boolean ignore = true;
 public void destroy() {
  // TODO Auto-generated method stub
     this.encoding = null;
           this.filterConfig = null;
  
 }
 public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) throws IOException, ServletException {
  // TODO Auto-generated method stub
   try {
             // Conditionally select and set the character encoding to be used
             if (ignore || (request.getCharacterEncoding() == null)) {
                 String encoding = selectEncoding(request);
                 if (encoding != null)
                     request.setCh


相关文档:

JSP动作

JSP动作利用XML语法格式的标记来控制Servlet引擎的行为。利用JSP动作可以动态地插入文件、重用JavaBean组件、把用户重定向到另外的页面、为Java插件生成HTML代码。
JSP动作包括:
jsp:include:在页面被请求的时候引入一个文件。
jsp:useBean:寻找或者实例化一个JavaBean。
jsp:setProperty:设置JavaBean的属性。 ......

网站页面自动跳转实现方法PHP、JSP等


自动转向,也叫自动重定向。自动跳转,指当访问用户登陆到某网站时,自动将用户转向其它网页地址的一种技术。转向的网页地址可以是网站内的其它网页,也可以是其它网站。通常情况下,浏览器会收到一个网页,该页面含有自动加载一其它网页的代码。该页面有可能在服务器端被转换,这样的话,浏览器只收到一个页面,而自动转 ......

include和jsp:include

index.jsp:
<html>
<head>
<title>The News</title>
</head>
<body>
<h1> Latest News</h1>
<table>
<tr>
<td><h3><%@include file="items/news1.jsp" %></h3></td>
</tr>
<tr>
<td> ......

jsp嵌入flex


我们使用Google提供的iframe让jsp页面嵌入到flex中
首先,请到http://code.google.com/p/flex-iframe/下载iframe 的swc包
第二步,把swc包放入flex_libs中,如果不是web项目就放入lib下
第三步,创建一个mxml文件
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/ ......

HTML表单复选框及JSP处理Demo

复选框的使用及JSP对数据的处理
<!--
Description: HTML表单复选框及JSP处理测试
Author: pxzl
Date: 2009-08-05 15:12:43
-->
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String[] cheArray1=request.getParameterValues("chkbox1");
String[] cheArray2=req ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号