标签:func xmx upd gui ejb jxl fbi stay 使用
原文:http://www.cnblogs.com/xxyfhjl/p/4074186.html
poster3.1的下载地址:http://files.cnblogs.com/files/lizhigang/poster-3.1.0-fx.zip
目的:验证http请求功能正确与否,需要发送post,get请求,则可以使用Poster插件方便简单。
自我总结,有什么改正的地方请指出,感激不尽!
1.安装Poster插件。
点击firefox右上方的菜单键-->[ 附加组件 ],在搜索框中输入poster点击安装即可
提示重启Firefox,才能用,重启后,在上方菜单栏[ 工具 ]-->即可看到[ Poster ]选项,说明已安装成功。
2.创建一个maven项目"getpost",将war放入tomcat
1). 在webapp目录下创建一个html文件:test.html
2). 表单action跳转路径为同级目录下的index.jsp
3).打成war包放入tomcat
test.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form name="Login" method="post" action="index.jsp">
User ID: <input type="text" name="name"><br>
Password: <input type="password" name="password">
<input type="HIDDEN" name="from" value="welcome">
<input type="submit" value="submit">
</form>
</body>
</html>
index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
response.setContentType("text;html;charset=utf-8");
String username=request.getParameter("name");
String password=request.getParameter("password");
System.out.println("username="+username);
System.out.println("password="+password);
System.out.println("servlet test success....");
%>
Success!
</body>
</html>
3.验证
浏览器测试:http://localhost:8989/getpost/test.html,输入name和password,能正常跳转到index.jsp,显示hello word。
Poster模拟测试:
打开firebug,看到该post请求的参数
将请求的URL,和参数填写到Poster中
点击Body from Parameters按钮,将post请求参数放入body。
点击中间的"post"按钮即可。
如何判断请求成功:
1)查看控制台,控制台打印的name和password的值是否正确。
2)弹出的对话框,reponse页面的内容正确则模拟post的请求成功。
总结:Poster插件不仅仅能发post请求,其他请求也能发。发送http请求也不止Poster这一种方式。
标签:func xmx upd gui ejb jxl fbi stay 使用
原文地址:http://www.cnblogs.com/lizhigang/p/7298873.html