Right Click on the Project >> Properties >> Android >> In the right Panel Scroll down >> Uncheck
isLibrary
isLibrary
arr=(aaa@example.com bbb@example.com ccc@example.com)
for ((i=0; i<${#arr[@]}; i++)); do
echo ${arr[$i]}
done
輸出
$CATALINA_HOME. (Otherwise, read "How to install Tomcat".)struts-2.1.8.1-all.zip".lib", which includes 71 jar-files. To deploy Struts application in Tomcat, these libaries must be available to Tomcat. You could copy the selected jar-files into Tomccat's "lib" directory (i.e., $CATALINA_HOME\lib), which will be available to all the web applications. You could also place the jar-files into a specific web context's "lib" directory, which will be available to only the particular web application.apps", in the form of war-files. In particular, a "blank" application template for which you can use to start writing your own codes. War-file (Web Application Archive) uses ZIP algorithm to compress and group files. You can extract the contents of war-file using WINZIP, WINRAR, or any other ZIP programs.webapps" directory ($CATALINA_HOME\webapps). Let's copy the "blank" sample application struts2-blank-2.1.8.1.war into Tomcat's "webapps". Start your Tomcat. The war-file will be unzipped and deployed automatically. Observer the following message in the Tomcat's console:INFO: Deploying web application archive struts2-blank-2.1.8.1.war May 1, 2010 11:32:41 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info INFO: Parsing configuration file [struts-default.xml] May 1, 2010 11:32:41 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info INFO: Parsing configuration file [struts-plugin.xml] May 1, 2010 11:32:41 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info INFO: Parsing configuration file [struts.xml]
webapps":$CATALINA_HOME\webapps\struts2-blank-2.1.8.1": This directory is known as context root of the web application "struts2-blank-2.1.8.1", which keeps the "html", "jsp" files accessible by the users. In this example, the home page "index.html".$CATALINA_HOME\webapps\struts2-blank-2.1.8.1\WEB-INF": This directory is hidden from user and keeps the configuration files. You keep the configuration file in this directory and program codes in its sub-directories. In this example, it contains a configuration file "web.xml" for configuring this web application.$CATALINA_HOME\webapps\struts2-blank-2.1.8.1\WEB-INF\src": Keep the java program source files (optional).$CATALINA_HOME\webapps\struts2-blank-2.1.8.1\WEB-INF\classes": Keep the java classes.$CATALINA_HOME\webapps\struts2-blank-2.1.8.1\WEB-INF\lib": keep the runtime libraries (jar-files) for this application.$CATALINA_HOME\webapps\struts2-blank-2.1.8.1\META-INF":May 1, 2010 4:18:56 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive struts2-blank-2.1.8.1.war May 1, 2010 4:18:56 PM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info INFO: Parsing configuration file [struts-default.xml] May 1, 2010 4:18:57 PM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info INFO: Parsing configuration file [struts-plugin.xml] May 1, 2010 4:18:57 PM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info INFO: Parsing configuration file [struts.xml]To access the sample struts application, issue URL
http://loaclhost:8080/struts2-blank-2.1.8.1 from a web browser. The home page "index.html" redirect to "example\Helloworld.jsp". Browse thru the source code of these pages.http://loaclhost:8080/struts2-blank-2.1.8.1/example/Welcome.jsp, and browse thru the source codes for these pages in "example" sub-directory.hellostruts2" in Tomcat for our Struts Hello-world application, by creating the standard directory structure for the web context (as shown in the figure below). Create a directory called "hellostruts2", under the Tomcat's webapps directory ($CATALINA_HOME\webapps). Create a sub-directory "WEB-INF" under "hellostruts2". Create sub-directories: "classes", "lib" and "src" under "WEB-INF". Take note that the directory names are case-sensitive.lib": commons-fileupload-1.2.1.jar, commons-io-1.3.2.jar, freemarker-2.3.15.jar, ognl-2.7.3.jar, struts2-core-2.1.8.1.jar, xwork-core-2.1.6.jar.web.xml". Save in "$CATALINA_HOME\webapps\hellostruts2\WEB-INF". The <filter> tag sets up the struts's dispatcher. The <filter-mapping> maps URL pattern "/*" (all requests under the root) to struts.<?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">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Create the following configuration file for struts "struts.xml". Save in "$CATALINA_HOME\webapps\hellostruts2\WEB-INF\classes". An action called HelloWorld is declared, which is mapped to hello.HelloWorld class. If the action returns a string "Success", invoke "/response.jsp".<?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>
<package name="default" extends="struts-default">
<action name="HelloWorld" class="hello.HelloWorld">
<result name="Success">/response.jsp</result>
</action>
</package>
</struts>
input.jsp": save under the context root "$CATALINA_HOME\webapps\hellostruts2". This page is used to produce the following form:<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>User Input Form</h1>
<s:form action="HelloWorld" >
<s:textfield name="name" label="Enter Your Name: " />
<s:submit value="Send" />
</s:form>
</body>
</html>
's'.<s:form> defines a HTML form, with processing action of "HelloWorld". The "HelloWorld" action is mapped to "hello.HelloWorld" class (in "struts.xml").<s:textfield> define a text field element. The value will be captured in a field "name" of the "hello.HelloWorld" class.hello.HelloWorld": save as "hellostruts2\WEB-INF\src\hello\HelloWorld.java"package hello;
public class HelloWorld {
private String message;
private String name;
public String execute() {
setMessage("Hello, " + getName());
return "Success";
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
hellostruts2\WEB-INF", and use -d option to set the output directory: > javac -d classes src\hello\HelloWorld.java
execute() method, which returns a string. From "struts.xml", if the return result is "Success", forward to "\response.jsp".name and message, are defined together with the public getters and setters.response.jsp": saved as "hellostruts2\response.jsp". This page accesses the "message" property of the class "hello.HelloWorld", and has a "Back" button to return to "/input.jsp".<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
<title>Response Page</title>
</head>
<body>
<h1><s:property value="message" /></h1>
<s:form action="/input.jsp" >
<s:submit value="Back" />
</s:form>
</body>
</html>
hellostruts2" has been started.May 1, 2010 4:18:59 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory hellostruts2 May 1, 2010 4:18:59 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info INFO: Parsing configuration file [struts-default.xml] May 1, 2010 4:18:59 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info INFO: Parsing configuration file [struts-plugin.xml] May 1, 2010 4:18:59 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info INFO: Parsing configuration file [struts.xml]
http://localhost:8080/hellostruts2/input.jsp
input.jsp" and "response.jsp".