Struts2中action重定向跳转到jsp参数中带有中文

来源:互联网 发布:win7网络共享密码 编辑:程序博客网 时间:2024/04/28 13:33


struts.xml中的配置

<action name="list" class="com.dev.action.HelloWorldAction"method="execute"><result name="success" type="redirect"><param name="location">/employeeAdd.jsp</param>            <param name="username">${username}</param>  </result></action>



<%@page import="java.net.URLDecoder"%><%@ page language="java" import="java.util.*,java.net.URLEncoder" pageEncoding="UTF-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <base href="<%=basePath%>">        <title>My JSP 'employeeAdd.jsp' starting page</title>    <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0">    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">-->  </head>    <body>  error:<%=URLDecoder.decode(new String(request.getParameter("username").getBytes("ISO8859-1"),"UTF-8"),"UTF-8") %>    <form action="/xxx">    姓名:<input type="text" name="xxx">    </form>  </body></html>







原创粉丝点击