Struts2接收请求参数
来源:互联网 发布:如何评价新东方 知乎 编辑:程序博客网 时间:2024/05/01 06:52
HelloWorldAction.java
struts.xml
hello.jsp
或
http://localhost:8080/Struts2/hello/h1_work.action?id=11&name=zzzz
能得到浏览器显示:
public class HelloWorldAction {private Integer id;private String name;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String work() {return "success";}public String execute() throws Exception {return "success";}}
struts.xml
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN""http://struts.apache.org/dtds/struts-2.3.dtd"><struts><constant name="struts.enable.DynamicMethodInvocation" value="false" /><constant name="struts.devMode" value="true" /><constant name="struts.action.extension" value="do,action" /><package name="he" namespace="/hello" extends="struts-default"><action name="h1_*" class="com.zero.HelloWorldAction" method="{1}"><result name="success">/WEB-INF/jsp/hello.jsp</result></action></package></struts>
hello.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>My JSP 'hello.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> id=${id } <br/> name=${name }</html>访问:http://localhost:8080/Struts2/hello/h1_execute.do?id=11&name=zzzz
或
http://localhost:8080/Struts2/hello/h1_work.action?id=11&name=zzzz
能得到浏览器显示:
id=11 name=zzzz
0 0
- struts2 请求参数接收
- Struts2接收请求参数
- Struts2 请求参数接收
- Struts2 请求参数的接收
- Struts2接收请求参数原理
- struts2请求参数的接收
- Struts2接收请求参数1
- struts2-11请求参数接收
- 学习笔记-----------struts2请求参数接收
- 复习struts2之请求参数接收
- struts2教程:11、请求参数接收
- struts2之Action请求参数接收方式
- Struts2之action接收请求参数
- 传智Struts2笔记(8)接收请求参数
- Struts2学习笔记(二)——请求参数的接收
- 关于struts2.1.6接收中文请求参数乱码问题
- struts2中接收请求参数(尤其是复合类型)
- Struts2的第二天(Action接收请求参数)
- Android 混淆代码总结
- iOS判断手机上是否安装微信或qq等应用
- multiple definition of `_start'
- 数据库第六次作业 王小芬 2013212954 理学院
- ios数据存储方式FMDB
- Struts2接收请求参数
- 使用matlab计算DFT时需要注意的幅值对应问题
- 看门狗驱动程序
- C++ 模板笔记
- Cocos2d-x学习笔记(九)纹理CCTexture2D和精灵CCSprite
- Android GradientDrawable高级应用 以后完全用不上美工了
- MobclickAgent——友盟用户分析工具
- vbox下虚拟机同宿主机互相ping,且虚拟机能访问网络的配置
- 记得去实现自己的梦想,dream is power