1、- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;
2、- (void)textFieldDidBeginEditing:(UITextField *)textField;
3、- (void)textFieldDidEndEditing:(UITextField *)textField;
如果存在两个UITextField的话,就用UITextField_1和UITextField_2来代替两个,第一次点击UITextField_1的时候,上面三个的只会执行前两个,顺序是1、2,在这种情况下点击UITextField_2的时候,会执行上面3个,执行顺序是1、3、2,其中1、2里的textField是UITextField_2,3里的textField是UITextField_1。
“How is My Waterway”是美国环保署(EPA,EnvironmentalProtection Agency)最新推出的一个应用,用户可以使用智能手机、平板和PC等多种设备,通过应用查找他们所在地区的水系信息,让以科学为基础的水质信息对公众更加透明和易懂。
【应用背景】
数十年来,EPA已经收集了各州和地区根据《水资源清洁法案》报告的健康的和受污染的河流,成千上万的河流已经确定被污染,政府也采取了很多措施来减少污染对人们的健康、经济和环境造成的风险,但是,相比统计报告中的成千上万的河流,人们最关心的还是他周围的那几座湖泊和河流是否受到影响,他们需要一个简单的途径来获知这些信息,就像普通市民们说的,“我只想知道,我周围的水系怎么样?告诉我这些,并且用我能听懂的方式。”在此情况下,EPA开发了“How is MyWaterway”应用。
该应用是网页版,可以通过移动设备,并利用移动设备的定位功能来获取用户当前位置的水系信息,体验地址:http://watersgeo.epa.gov/mywaterway/
【功能和截图】
定位和地址搜索:使用智能手机通过实时定位来搜索当前位置的湖泊、河流和山泉信息,或者通过PC、智能手机和平板输入美国范围的邮政编码或者地名来查询相关地点的水系信息。
快速空间检索:快速列出目标地点周围5英里的水系信息列表,每条水系以未被污染、已被污染、不确定和随时间更新这4个状态来标示;另外,地图中还提供了一个视图,用来展示搜索区域里水系的颜色编码,通过缩放和平移可以获取新的区域。
详细信息展示:一旦从地图或列表中选择一条水系,app和网页就能展示更多的信息,包括水体污染类型,EPA和政府的治理行动等,有需要的用户还可以点击相应的连接查看在线的专业的评估报告。
知识普及:获取简单的、非学术性的水系污染类型的描述说明,包括是什么污染物,它来自哪里,对环境和人类健康产生什么样的危害,水系的经济价值,如何做才能减少污染等等内容;
更多信息:提供了许多友情链接,让用户找到更多关于各类水资源的更多信息,比如海滩、饮用水、鱼类栖息地等等。
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- 添加启动struts2MVC框架的过滤器 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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="/blog_article/<%=basePath%>/index.html">
<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">
<!--
<link rel="stylesheet" type="text/css" href="/blog_article/styles.css">
-->
</head>
<body>
<div align="center">
<h3>
登陆操作
</h3>
<form action="/blog_article/${pageContext.request.contextPath }/csdn/login.action" method="post">
用户名:
<input type="text" name="name" />
<br />
密码:
<input type="password" name="pass" />
<br />
<input type="submit" value="登陆">
</form>
</div>
</body>
</html>
sc.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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="/blog_article/<%=basePath%>/index.html">
<title>My JSP 'sc.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="/blog_article/styles.css">
-->
</head>
<body>
<div align="center">
<h3>登陆成功!</h3>
</div>
</body>
</html>
LoginAction.java
package www.csdn.struts_action.action;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
// 接受客户端的值
private String name;
private String pass;
private String upload;
public String getName() {
return name;
}
// 注入
public void setName(String name) {
this.name = name;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getUpload() {
return upload;
}
public void setUpload(String upload) {
this.upload = upload;
}
public String login() {
System.out.println("处理业务....."+name+"--"+pass+"---"+upload);
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>
<!--
${pageContext.request.contextPath }/csdn/login.action
url:http://localhost:8080/struts_action/csdn/login.action
struts-default 包名
-->
<package name="user" namespace="/csdn" extends="struts-default">
<!-- 全局的结果集 -->
<global-results>
<result name="success" type="dispatcher">/sc.jsp</result>
</global-results>
<!--
<default-class-ref />
Method=execute
-->
<action name="login"
method="login">
<param name="upload">/images</param>
<!--
name="success" <result-type name="dispatcher"
default="true"/>
-->
<result name="success" type="dispatcher">/index.jsp</result>
</action>
</package>
</struts>当没有
<result name="success" type="dispatcher">/index.jsp</result>跳转到sc页面,
添加上
<result name="success" type="dispatcher">/index.jsp</result>则跳转到index页面