博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
struts2+ajax+jquery
阅读量:2385 次
发布时间:2019-05-10

本文共 3143 字,大约阅读时间需要 10 分钟。

struts2+ajax+jquery

ajax交互

index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"            pageEncoding="UTF-8"%>
Insert title here

action:

AjaxAction.java

public class AjaxAction extends ActionSupport {               private String word;               public String getWord() {                            return word;              }               public void setWord(String word) {                            this.word = word;              }               public InputStream getContentStream() throws Exception {                            return new ByteArrayInputStream("你好事假".getBytes("utf-8"));              }               @Override              public String execute() throws Exception {                            System.out.println("AjaxAction.execute()" + word);                            return SUCCESS;              } }

JsonAction.java

public class AjaxAction extends ActionSupport {               private String word;               public String getWord() {                            return word;              }               public void setWord(String word) {                            this.word = word;              }               public InputStream getContentStream() throws Exception {                            return new ByteArrayInputStream("你好事假".getBytes("utf-8"));              }               @Override              public String execute() throws Exception {                            System.out.println("AjaxAction.execute()" + word);                            return SUCCESS;              } }

JsonAction.java

public class AjaxAction extends ActionSupport {            private String word;            public String getWord() {                      return word;           }            public void setWord(String word) {                      this.word = word;           }            public InputStream getContentStream() throws Exception {                      return new ByteArrayInputStream("你好事假".getBytes("utf-8"));           }            @Override           public String execute() throws Exception {                      System.out.println("AjaxAction.execute()" + word);                      return SUCCESS;           } }

stryts.xml

contentStream
utf-8
message

 

posted @
2017-05-31 11:15 阅读(
...) 评论(
...)

转载地址:http://kkjab.baihongyu.com/

你可能感兴趣的文章
PHP json_encode中文乱码解决方法
查看>>
mysql服务启动、关闭
查看>>
php获取中文字符串的首字符拼音字母
查看>>
php curl通过代理获取数据
查看>>
6 个 Linux性能监控命令行工具
查看>>
mysql 编码字符集配置
查看>>
php查看opcode编码的扩展 opdumper
查看>>
php转换html格式为文本格式
查看>>
mysql-proxy主从服务架构下读写分离和负载均衡实现及原理
查看>>
Nginx location 和 rewrite retry
查看>>
基于nginx的FastCGI的缓存配置
查看>>
Nginx模块fastcgi_cache的几个注意点
查看>>
PHP使用curl伪造IP地址和header信息
查看>>
代理服务器中的HTTP代理与SOCKS代理有什么区别?
查看>>
零基础Python学习路线,小白的进阶之路!
查看>>
CSS的23个垂直居中技巧,你都学会了吗?
查看>>
黑客攻击用的最短代码大揭秘,颠覆你的世界观!
查看>>
零基础的自学前端之路,当年的入坑之旅
查看>>
新手程序员?教你解决办法!基础都掌握了,动手敲代码就一脸懵逼
查看>>
程序员快速进阶学习到底要看书还是要看视频?
查看>>