Struts2 中文字符编码问题
来源:互联网 发布:医药公司软件 编辑:程序博客网 时间:2024/06/08 03:26
index.jsp
<% String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><meta http-equiv="Content-Type" content="text/html; charset=GB18030" /><base href="<%=basePath %>"/><body>使用action属性接收参数,测试中文问题<form action="user/user!add" method="post">姓名:<input type="text" name="name"></input><input type="submit" value="submit"/></form></body></html>
user_add_success.jsp
<body>User Add Success!</body>
struts.xml
<struts> <constant name="struts.devMode" value="true" /> <constant name="struts.i18n.encoding" value="GBK" /> <!-- internationalization --> <package name="user" extends="struts-default" namespace="/user"> <action name="userAdd" class="com.bjsxt.struts2.user.action.UserAction" method="add"> <result>/user_add_success.jsp</result> </action> <action name="user" class="com.bjsxt.struts2.user.action.UserAction"> <result>/user_add_success.jsp</result> </action> </package></struts>
UserAction.java
package com.bjsxt.struts2.user.action;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {private String name;public String add() {System.out.println("name=" + name);return SUCCESS;}public String getName() {return name;}public void setName(String name) {this.name = name;}}
阅读全文
0 0
- Struts2 中文字符编码问题
- struts2中文编码问题
- 中文字符编码问题
- mysql中文字符编码问题
- python中文字符编码问题
- 包含中文字符的URL编码问题
- 包含中文字符的URL编码问题
- 包含中文字符的URL编码问题
- 包含中文字符的URL编码问题
- JAVA中文字符编码问题详解
- JAVA中文字符编码问题详解
- JAVA中文字符编码问题详解
- JAVA中文字符编码问题详解
- JAVA中文字符编码问题详解
- JAVA中文字符编码问题详解
- (best!)JAVA中文字符编码问题详解
- JAVA中文字符编码问题详解
- [Java] JAVA中文字符编码问题详解
- mysql语句的探索
- js数组练习
- Codeforces Round #419 (Div. 2) C. Karen and Game 题解
- <p></p>标签字体水平垂直居中
- PHP存储Session
- Struts2 中文字符编码问题
- PHP5生成图形验证码(有汉字)
- 程序员的十层楼
- 剑指offer面试题18:删除链表的节点-java
- 工作3年的程序员应该具备什么技能
- Mysql 列转行统计查询 、行转列统计查询
- eclipse里面关于subversion(svn)插件的安装
- 深度解析艾瑞咨询《2017年度中国商业智能行业研究报告》
- makefile中的wildcard用法