struts2中运用json的完整实例_struts使用json的例子

this

.user

=

user;
}

public

String getResult() {

return

result;
}

public

void

setResult(String result) {

this

.result

=

result;
}

}



![复制代码](http://common.cnblogs.com/images/copycode.gif)


            


##### 4、建立struts.xml文件




![复制代码](http://common.cnblogs.com/images/copycode.gif)


<? xml version = " 1.0 " encoding = " UTF-8 " ?>

<!

DOCTYPE struts PUBLIC

"

-//Apache Software Foundation//DTD Struts Configuration 2.0//EN

"

"

http://struts.apache.org/dtds/struts-2.0.dtd

"

<

struts

<

constant name

=

"

struts.action.extension

"

value

=

"

do

"

/>

<

constant name

=

"

struts.serve.static.browserCache

"

value

=

"

false

"

/>

<

constant name

=

"

struts.configuration.xml.reload

"

value

=

"

true

"

/>

<

constant name

=

"

struts.devMode

"

value

=

"

true

"

/>

<

package

name

=

"

test

"

extends

=

"

json-default

"

<

action name

=

"

jsonAction

"

class

=

"

com.ljq.action.JsonAction

"

<

result type

=

"

json

"

<

param name

=

"

root

"

result

</

param

</

result

</

action

</

package

</

struts



![复制代码](http://common.cnblogs.com/images/copycode.gif)


        


##### 5、编写index.jsp文件




![复制代码](http://common.cnblogs.com/images/copycode.gif)


<%

@ page language

=

"

java

"

import

=

"

java.util.*

"

pageEncoding

=

"

UTF-8

"

%>

<%

@taglib uri

=

"

/struts-tags

"

prefix

=

"

s

"

%>

<%

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

index.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

"

<

script type

=

"

text/javascript

"

src

=

"

<%=request.getContextPath() %>/js/jquery-1.3.1.js

"

</

script

<

script type

=

"

text/javascript

"

src

=

"

<%=request.getContextPath() %>/js/index.js

"

</

script

</

head

<

body

<

div id

=

"

result

"

</

div

<

s:form name

=

"

userForm

"

action

=

"

/jsonAction.do

"

method

=

"

post

"

最全的Linux教程,Linux从入门到精通

======================

  1. linux从入门到精通(第2版)

  2. Linux系统移植

  3. Linux驱动开发入门与实战

  4. LINUX 系统移植 第2版

  5. Linux开源网络全栈详解 从DPDK到OpenFlow

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

第一份《Linux从入门到精通》466页

====================

内容简介

====

本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。

需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值