mirror of
https://github.com/apache/struts.git
synced 2026-08-08 16:16:58 +00:00
Compare commits
161 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3f712eb1b | |||
| 0b4762bfab | |||
| 43d490927d | |||
| d53c2bfff3 | |||
| a14bf5e249 | |||
| 55a551baa2 | |||
| 9f68f0446c | |||
| 8db503996d | |||
| 50c3b36776 | |||
| 329bb930f0 | |||
| 3ccfbbfde0 | |||
| b23b4f0cc3 | |||
| ac503f6260 | |||
| 165b4e7799 | |||
| 6fcf3cfb56 | |||
| 3559945b53 | |||
| df0084419b | |||
| 4f11ad0878 | |||
| 5ae898d0c8 | |||
| 473deb12f2 | |||
| 68a045ccc7 | |||
| 2522690491 | |||
| 99be8e33cd | |||
| 350ffdcf87 | |||
| e5b380be24 | |||
| 3285a37ebd | |||
| d4f5483489 | |||
| 66a507c643 | |||
| 9bca8b98cc | |||
| 76b2800d18 | |||
| 8373599f01 | |||
| 70341ac8b0 | |||
| d304ea3ffd | |||
| 97d6872beb | |||
| 042e6c0422 | |||
| 157cc6583c | |||
| 13e976f502 | |||
| 411ffc127a | |||
| 2c9a23eaef | |||
| 4a6c4ad085 | |||
| 53d2f7ea4a | |||
| d176c997bf | |||
| d543af34cc | |||
| 845f524255 | |||
| 6b9175c510 | |||
| 0a70a1e477 | |||
| 29b1593301 | |||
| 77d7527d51 | |||
| 4253375672 | |||
| 344eaf3e33 | |||
| 9a278838c2 | |||
| d0f1acad94 | |||
| 44c2413ad2 | |||
| f796b25f33 | |||
| 862a6ed36e | |||
| 0a1d4d7728 | |||
| 1b3f6102f6 | |||
| 2ab4926795 | |||
| b734e6e2e4 | |||
| 2f101588c9 | |||
| 30359e5f62 | |||
| 3a14ddcaba | |||
| cae4e442ed | |||
| b9d365a04c | |||
| 34993c7473 | |||
| 6a46ca7fcd | |||
| 13b136c559 | |||
| 909f724288 | |||
| 60b108e05e | |||
| 60f1622f3d | |||
| d62437ee75 | |||
| 2543a00e62 | |||
| e83468aee5 | |||
| 20f7cdc513 | |||
| 652cd4a899 | |||
| 9b8f0a99c5 | |||
| 8df1a49e44 | |||
| 1e769cc3b3 | |||
| 299579aef2 | |||
| 85c9e4c171 | |||
| 6d3cceca00 | |||
| 2154ad8513 | |||
| fa754949ab | |||
| 9d71021b14 | |||
| b6be295074 | |||
| 13e6ae21d4 | |||
| 1e73567cec | |||
| 8fa480d66b | |||
| 8910d90721 | |||
| db2bf7b4e3 | |||
| 77cb215263 | |||
| 51d985b3b7 | |||
| 3563fe21e7 | |||
| 8f589c03db | |||
| bb8d0bf28a | |||
| 09f11dac5c | |||
| fbe7fe226f | |||
| 4e78cfce78 | |||
| 004ab6c47c | |||
| ff7144ca42 | |||
| ae053fb669 | |||
| f621683dc1 | |||
| 209965eff0 | |||
| 0a64f616e8 | |||
| 6f97753eec | |||
| 46dd4d4ca6 | |||
| 98d4313537 | |||
| 231e27fd5e | |||
| 08f5faf1af | |||
| 1be016ae02 | |||
| 0a6c72e0c7 | |||
| dceee365c0 | |||
| eca621ef35 | |||
| fdcfcb8c15 | |||
| 422c84f511 | |||
| 16939ed8b1 | |||
| b39e1f24c2 | |||
| a1e9ba6aa4 | |||
| 7da5f114b4 | |||
| 4fd5d2ab15 | |||
| fe3d2c2228 | |||
| e75a5ae946 | |||
| a4e91a9581 | |||
| 5c1593c02e | |||
| 28a98b5757 | |||
| df14a287d0 | |||
| 60391db64f | |||
| 6692879894 | |||
| 9452a5c591 | |||
| a181296a17 | |||
| 94d7466015 | |||
| c6c51c6ba4 | |||
| f13243a2bf | |||
| b2496a566c | |||
| 756c2f58d5 | |||
| cac778c170 | |||
| 66479bc36e | |||
| e023f033af | |||
| 8199b1a3b7 | |||
| d078084107 | |||
| c990786a59 | |||
| 3f7dd2ef82 | |||
| 7d8dfff8a1 | |||
| 129e4559ce | |||
| ff9bfe3bd4 | |||
| e163098224 | |||
| dd200c173c | |||
| d7189a6648 | |||
| 2cab82fafc | |||
| 1472a49a0f | |||
| 5e3464d467 | |||
| d60e674046 | |||
| 6e81a692b7 | |||
| fbedbdedbe | |||
| 1a2bd58e65 | |||
| 421ff8d068 | |||
| 0e7dbe0b62 | |||
| ae4e489d9e | |||
| dcc79d485d | |||
| 75b379d5d4 | |||
| cb580fe614 |
-54
@@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 API</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/api/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/api/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/api/</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
<!-- has to be compile for StrutsTestCase, which is part of the base package so others can write unit tests -->
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<showPackage>false</showPackage>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2;
|
||||
|
||||
/**
|
||||
* Default action interface. Provided purely for user convenience. Struts does not require actions to implement any
|
||||
* interfaces. Actions need only implement a public, no argument method which returns {@code String}. If a user does
|
||||
* not specify a method name, Struts defaults to {@code execute()}.
|
||||
*
|
||||
* <p>For example:
|
||||
*
|
||||
* <pre>
|
||||
* static import ResultNames.*;
|
||||
*
|
||||
* public class MyAction <b>implements Action</b> {
|
||||
*
|
||||
* public String execute() {
|
||||
* return SUCCESS;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>is equivalent to:
|
||||
*
|
||||
* <pre>
|
||||
* static import ResultNames.*;
|
||||
*
|
||||
* public class MyAction {
|
||||
*
|
||||
* public String execute() {
|
||||
* return SUCCESS;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Action {
|
||||
|
||||
/**
|
||||
* Executes this action.
|
||||
*
|
||||
* @return result name which matches a result name from the action mapping in the configuration file. See {@link
|
||||
* ResultNames} for common suggestions.
|
||||
*/
|
||||
String execute();
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2;
|
||||
|
||||
/**
|
||||
* Implemented by actions which may need to record errors or messages.
|
||||
*
|
||||
* <pre>
|
||||
* static import ResultNames.*;
|
||||
*
|
||||
* public class SetName implements MessageAware {
|
||||
*
|
||||
* Messages messages;
|
||||
* String name;
|
||||
*
|
||||
* public String execute() {
|
||||
* return SUCCESS;
|
||||
* }
|
||||
*
|
||||
* public void setName(String name) {
|
||||
* if ("".equals(name))
|
||||
* messages.forField("name").addError("name.required");
|
||||
*
|
||||
* this.name = name;
|
||||
* }
|
||||
*
|
||||
* public void setMessages(Messages messages) {
|
||||
* this.messages = messages;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface MessageAware {
|
||||
|
||||
/**
|
||||
* Sets messages.
|
||||
*
|
||||
* @param messages messages
|
||||
*/
|
||||
void setMessages(Messages messages);
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Collection of messages. Supports nesting messages by field name.
|
||||
*
|
||||
* <p>Uses keys when adding instead of actual messages to decouple code from messages.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Messages {
|
||||
|
||||
// TODO: Use Object[] for args instead of String[].
|
||||
|
||||
/**
|
||||
* Message severity.
|
||||
*/
|
||||
public enum Severity {
|
||||
|
||||
/**
|
||||
* Informational messages.
|
||||
*/
|
||||
INFO,
|
||||
|
||||
/**
|
||||
* Warning messages.
|
||||
*/
|
||||
WARN,
|
||||
|
||||
/**
|
||||
* Error messages.
|
||||
*/
|
||||
ERROR,
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets nested messages for the given field.
|
||||
*
|
||||
* <p>Supports dot notation to represent nesting. For example:
|
||||
*
|
||||
* <pre>
|
||||
* messages.forField("foo").forField("bar") == messages.forField("foo.bar")
|
||||
* </pre>
|
||||
*
|
||||
* @param fieldName name of the field
|
||||
* @return nested {@code Messages} for given field name
|
||||
*/
|
||||
Messages forField(String fieldName);
|
||||
|
||||
/**
|
||||
* Gets map of field name to messages for that field.
|
||||
*
|
||||
* @return map of field name to {@code Messages}
|
||||
*/
|
||||
Map<String, Messages> forFields();
|
||||
|
||||
/**
|
||||
* Adds informational message.
|
||||
*
|
||||
* @param key message key
|
||||
* @see Severity.INFO
|
||||
*/
|
||||
void addInformation(String key);
|
||||
|
||||
/**
|
||||
* Adds informational message.
|
||||
*
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
* @see Severity.INFO
|
||||
*/
|
||||
void addInformation(String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Adds warning message.
|
||||
*
|
||||
* @param key message key
|
||||
* @see Severity.WARN
|
||||
*/
|
||||
void addWarning(String key);
|
||||
|
||||
/**
|
||||
* Adds warning message.
|
||||
*
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
* @see Severity.WARN
|
||||
*/
|
||||
void addWarning(String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Adds error message.
|
||||
*
|
||||
* @param key message key
|
||||
* @see Severity.ERROR
|
||||
*/
|
||||
void addError(String key);
|
||||
|
||||
/**
|
||||
* Adds error message.
|
||||
*
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
* @see Severity.ERROR
|
||||
*/
|
||||
void addError(String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Adds message.
|
||||
*
|
||||
* @param severity message severity
|
||||
* @param key message key
|
||||
*/
|
||||
void add(Severity severity, String key);
|
||||
|
||||
/**
|
||||
* Adds request-scoped message.
|
||||
*
|
||||
* @param severity message severity
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
*/
|
||||
void add(Severity severity, String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Gets set of severities for which this {@code Messages} instance has messages. Not recursive.
|
||||
*
|
||||
* @return unmodifiable set of {@link Severity} sorted from least to most severe
|
||||
*/
|
||||
Set<Severity> getSeverities();
|
||||
|
||||
/**
|
||||
* Gets message strings for the given severity. Not recursive.
|
||||
*
|
||||
* @param severity message severity
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> forSeverity(Severity severity);
|
||||
|
||||
/**
|
||||
* Gets error message strings for this {@code Messages} instance. Not recursive.
|
||||
*
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> getErrors();
|
||||
|
||||
/**
|
||||
* Gets error message strings for this {@code Messages} instance. Not recursive.
|
||||
*
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> getWarnings();
|
||||
|
||||
/**
|
||||
* Gets informational message strings for this {@code Messages} instance. Not recursive.
|
||||
*
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> getInformation();
|
||||
|
||||
/**
|
||||
* Returns true if this or a nested {@code Messages} instance has error messages.
|
||||
*
|
||||
* @see Severity.ERROR
|
||||
*/
|
||||
boolean hasErrors();
|
||||
|
||||
/**
|
||||
* Returns true if this or a nested {@code Messages} instance has warning messages.
|
||||
*
|
||||
* @see Severity.WARN
|
||||
*/
|
||||
boolean hasWarnings();
|
||||
|
||||
/**
|
||||
* Returns true if this or a nested {@code Messages} instance has informational messages.
|
||||
*
|
||||
* @see Severity.INFO
|
||||
*/
|
||||
boolean hasInformation();
|
||||
|
||||
/**
|
||||
* Returns true if this and all nested {@code Messages} instances have no messages.
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns true if this and all nested {@code Messages} instances have no messages for the given severity.
|
||||
*
|
||||
* @param severity message severity
|
||||
*/
|
||||
boolean isEmpty(Severity severity);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2;
|
||||
|
||||
/**
|
||||
* Commonly used result names returned by action methods.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public final class ResultNames {
|
||||
|
||||
private ResultNames() {}
|
||||
|
||||
/**
|
||||
* The action executed successfully.
|
||||
*/
|
||||
public static final String SUCCESS = "success";
|
||||
|
||||
/**
|
||||
* The action requires more input, i.e. a validation error occurred.
|
||||
*/
|
||||
public static final String INPUT = "input";
|
||||
|
||||
/**
|
||||
* The action requires the user to log in before executing.
|
||||
*/
|
||||
public static final String LOGIN = "login";
|
||||
|
||||
/**
|
||||
* The action execution failed irrecoverably.
|
||||
*/
|
||||
public static final String ERROR = "error";
|
||||
|
||||
/**
|
||||
* The action executed successfully, but do not execute a result.
|
||||
*/
|
||||
public static final String NONE = "none";
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Implemented by actions which need direct access to the servlet request.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ServletRequestAware {
|
||||
|
||||
/**
|
||||
* Sets the servlet request.
|
||||
*
|
||||
* @param request servlet request.
|
||||
*/
|
||||
void setServletRequest(HttpServletRequest request);
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Context of an action execution.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ActionContext {
|
||||
|
||||
/**
|
||||
* Gets action instance.
|
||||
*/
|
||||
Object getAction();
|
||||
|
||||
/**
|
||||
* Gets action method.
|
||||
*/
|
||||
Method getMethod();
|
||||
|
||||
/**
|
||||
* Gets action name.
|
||||
*/
|
||||
String getActionName();
|
||||
|
||||
/**
|
||||
* Gets the path for the action's namespace.
|
||||
*/
|
||||
String getNamespacePath();
|
||||
|
||||
/**
|
||||
* Gets the {@link Result} instance for the action.
|
||||
*
|
||||
* @return {@link Result} instance or {@code null} if we don't have a result yet.
|
||||
*/
|
||||
Result getResult();
|
||||
|
||||
/**
|
||||
* Adds a result interceptor for the action. Enables executing code before and after a result, executing an
|
||||
* alternate result, etc.
|
||||
*/
|
||||
void addResultInterceptor(Result interceptor);
|
||||
|
||||
/**
|
||||
* Gets context of action which chained to us.
|
||||
*
|
||||
* @return context of previous action or {@code null} if this is the first action in the chain
|
||||
*/
|
||||
ActionContext getPrevious();
|
||||
|
||||
/**
|
||||
* Gets context of action which this action chained to.
|
||||
*
|
||||
* @return context of next action or {@code null} if we haven't chained to another action yet or this is the last
|
||||
* action in the chain.
|
||||
*/
|
||||
ActionContext getNext();
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
/**
|
||||
* Intercepts an action request.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Interceptor {
|
||||
|
||||
/**
|
||||
* Intercepts an action request.
|
||||
*
|
||||
* @param requestContext current request context
|
||||
*/
|
||||
String intercept(RequestContext requestContext) throws Exception;
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import org.apache.struts2.Messages;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Request context. A single request may span multiple actions with action chaining.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface RequestContext {
|
||||
|
||||
/**
|
||||
* Gets context of the currently executing action.
|
||||
*
|
||||
* @return current action context
|
||||
*/
|
||||
ActionContext getActionContext();
|
||||
|
||||
/**
|
||||
* Convenience method. Equivalent to {@code getActionContext().getAction()}.
|
||||
*
|
||||
* @return currently executing action
|
||||
*/
|
||||
Object getAction();
|
||||
|
||||
/**
|
||||
* Gets map of request parameters.
|
||||
*/
|
||||
Map<String, String[]> getParameterMap();
|
||||
|
||||
/**
|
||||
* Gets map of request attributes.
|
||||
*/
|
||||
Map<String, Object> getAttributeMap();
|
||||
|
||||
/**
|
||||
* Gets map of session attributes.
|
||||
*/
|
||||
Map<String, Object> getSessionMap();
|
||||
|
||||
/**
|
||||
* Gets map of application (servlet context) attributes.
|
||||
*/
|
||||
Map<String, Object> getApplicationMap();
|
||||
|
||||
/**
|
||||
* Finds cookies with the given name,
|
||||
*/
|
||||
List<Cookie> findCookiesForName(String name);
|
||||
|
||||
/**
|
||||
* Gets locale.
|
||||
*/
|
||||
Locale getLocale();
|
||||
|
||||
/**
|
||||
* Sets locale. Stores the locale in the session for future requests.
|
||||
*/
|
||||
void setLocale(Locale locale);
|
||||
|
||||
/**
|
||||
* Gets messages.
|
||||
*/
|
||||
Messages getMessages();
|
||||
|
||||
/**
|
||||
* Gets the servlet request.
|
||||
*/
|
||||
HttpServletRequest getServletRequest();
|
||||
|
||||
/**
|
||||
* Gets the servlet response.
|
||||
*/
|
||||
HttpServletResponse getServletResponse();
|
||||
|
||||
/**
|
||||
* Gets the servlet context.
|
||||
*/
|
||||
ServletContext getServletContext();
|
||||
|
||||
/**
|
||||
* Gets the value stack.
|
||||
*/
|
||||
ValueStack getValueStack();
|
||||
|
||||
/**
|
||||
* Invokes the next interceptor or the action method if no more interceptors remain.
|
||||
*
|
||||
* @return result name
|
||||
* @throws IllegalStateException if already invoked or called from the action
|
||||
*/
|
||||
String proceed() throws Exception;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import org.apache.struts2.spi.RequestContext;
|
||||
|
||||
/**
|
||||
* Implemented by actions that need access to the current {@link org.apache.struts2.spi.RequestContext}. Use
|
||||
* judiciously.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface RequestContextAware {
|
||||
|
||||
/**
|
||||
* Sets {@link org.apache.struts2.spi.RequestContext}.
|
||||
*
|
||||
* @param requestContext
|
||||
*/
|
||||
void setRequestContext(RequestContext requestContext);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import org.apache.struts2.spi.RequestContext;
|
||||
|
||||
/**
|
||||
* The result of an action request. Struts creates a new {@code Result} instance for each request.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Result {
|
||||
|
||||
/**
|
||||
* Executes result.
|
||||
*
|
||||
* @param requestContext
|
||||
*/
|
||||
void execute(RequestContext requestContext) throws Exception;
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
/**
|
||||
* A central fixture of the Struts framework, the {@code ValueStack} is a stack which contains the actions
|
||||
* which have executed in addition to other objects. Users can get and set values on the stack using expressions. The
|
||||
* {@code ValueStack} will search down the stack starting with the most recent objects until it finds an object to
|
||||
* which the expression can apply.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ValueStack extends Iterable<Object> {
|
||||
|
||||
/**
|
||||
* Gets the top, most recent object from the stack without changing the stack.
|
||||
*
|
||||
* @return the top object
|
||||
*/
|
||||
Object peek();
|
||||
|
||||
/**
|
||||
* Removes the top, most recent object from the stack.
|
||||
*
|
||||
* @return the top object
|
||||
*/
|
||||
Object pop();
|
||||
|
||||
/**
|
||||
* Pushes an object onto the stack.
|
||||
*
|
||||
* @param o
|
||||
*/
|
||||
void push(Object o);
|
||||
|
||||
/**
|
||||
* Creates a shallow copy of this stack.
|
||||
*
|
||||
* @return a new stack which contains the same objects as this one
|
||||
*/
|
||||
ValueStack clone();
|
||||
|
||||
/**
|
||||
* Queries the stack. Starts with the top, most recent object. If the expression can apply to the object, this
|
||||
* method returns the result of evaluating the expression. If the expression does not apply, this method moves
|
||||
* down the stack to the next object and repeats. Returns {@code null} if the expression doesn't apply to any
|
||||
* objects.
|
||||
*
|
||||
* @param expression
|
||||
* @return the evaluation of the expression against the first applicable object in the stack
|
||||
*/
|
||||
Object get(String expression);
|
||||
|
||||
/**
|
||||
* Queries the stack and converts the result to the specified type. Starts with the top, most recent object. If
|
||||
* the expression can apply to the object, this method returns the result of evaluating the expression converted
|
||||
* to the specified type. If the expression does not apply, this method moves down the stack to the next object
|
||||
* and repeats. Returns {@code null} if the expression doesn't apply to any objects.
|
||||
*
|
||||
* @param expression
|
||||
* @param asType the type to convert the result to
|
||||
* @return the evaluation of the expression against the first applicable object in the stack converted to the
|
||||
* specified type
|
||||
*/
|
||||
<T> T get(String expression, Class<T> asType);
|
||||
|
||||
/**
|
||||
* Queries the stack and converts the result to a {@code String}. Starts with the top, most recent object. If the
|
||||
* expression can apply to the object, this method returns the result of evaluating the expression converted to a
|
||||
* {@code String}. If the expression does not apply, this method moves down the stack to the next object and
|
||||
* repeats. Returns {@code null} if the expression doesn't apply to any objects.
|
||||
*
|
||||
* @param expression
|
||||
* @return the evaluation of the expression against the first applicable object in the stack converted to a {@code
|
||||
* String}
|
||||
*/
|
||||
String getString(String expression);
|
||||
|
||||
/**
|
||||
* Sets a value on an object from the stack. This method starts at the top, most recent object. If the expression
|
||||
* applies to that object, this methods sets the given value on that object using the expression and converting
|
||||
* the type as necessary. If the expression does not apply, this method moves to the next object and repeats.
|
||||
*
|
||||
* @param expression
|
||||
* @param value
|
||||
*/
|
||||
void set(String expression, Object value);
|
||||
|
||||
/**
|
||||
* Returns the number of object on the stack.
|
||||
*
|
||||
* @return size of stack
|
||||
*/
|
||||
int size();
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@@ -1,5 +0,0 @@
|
||||
Apache Struts
|
||||
Copyright 2000-2007 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
+9
-2
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.0.9</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-blank</artifactId>
|
||||
@@ -48,10 +48,17 @@
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<configuration>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee_1.4_spec</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<action name="Login_*" method="{1}" class="example.Login">
|
||||
<result name="input">/example/Login.jsp</result>
|
||||
<result type="redirectAction">Menu</result>
|
||||
<result type="redirect-action">Menu</result>
|
||||
</action>
|
||||
|
||||
<action name="*" class="example.ExampleSupport">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.0.9</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-mailreader</artifactId>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</interceptor-stack>
|
||||
|
||||
<interceptor-stack name="user-submit" >
|
||||
<interceptor-ref name="tokenSession" />
|
||||
<interceptor-ref name="token-session" />
|
||||
<interceptor-ref name="user"/>
|
||||
</interceptor-stack>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<global-results>
|
||||
<result name="error">/pages/Error.jsp</result>
|
||||
<result name="invalid.token">/pages/Error.jsp</result>
|
||||
<result name="login" type="redirectAction">Login_input</result>
|
||||
<result name="login" type="redirect-action">Login_input</result>
|
||||
</global-results>
|
||||
|
||||
<global-exception-mappings>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
</action>
|
||||
|
||||
<action name="Logout" class="mailreader2.Logout">
|
||||
<result type="redirectAction">Welcome</result>
|
||||
<result type="redirect-action">Welcome</result>
|
||||
</action>
|
||||
|
||||
<action name="Login_*" method="{1}" class="mailreader2.Login">
|
||||
<result name="input">/Login.jsp</result>
|
||||
<result name="cancel" type="redirectAction">Welcome</result>
|
||||
<result type="redirectAction">MainMenu</result>
|
||||
<result name="cancel" type="redirect-action">Welcome</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<result name="expired" type="chain">ChangePassword</result>
|
||||
<exception-mapping
|
||||
exception="org.apache.struts.apps.mailreader.dao.ExpiredPasswordException"
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<action name="Registration_*" method="{1}" class="mailreader2.Registration">
|
||||
<result name="input">/Registration.jsp</result>
|
||||
<result type="redirectAction">MainMenu</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
</package>
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<global-results>
|
||||
<result name="input">/Subscription.jsp</result>
|
||||
<result type="redirectAction">Registration_input</result>
|
||||
<result type="redirect-action">Registration_input</result>
|
||||
</global-results>
|
||||
|
||||
<action name="Subscription_save" method="save" class="mailreader2.Subscription">
|
||||
|
||||
@@ -5,7 +5,6 @@ button.doReset=DO_RESULT
|
||||
button.doCancel=org.apache.struts.taglib.html.CANCEL
|
||||
button.reset=Reset
|
||||
button.save=Save
|
||||
button.logon=Log on
|
||||
change.message=Your password has expired. Please ask the system administrator to change it.
|
||||
change.try=Try Again
|
||||
change.title=Password Has Expired
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<s:password key="password" showPassword="true"/>
|
||||
|
||||
<s:submit key="button.logon"/>
|
||||
<s:submit key="button.save"/>
|
||||
|
||||
<s:reset key="button.reset"/>
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.0.9</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
|
||||
@@ -8,8 +8,8 @@ For more on getting started with Struts, see
|
||||
|
||||
WARNING - Additional configuration required for deployment
|
||||
|
||||
Due to difference in portlet container implementations, the portlet
|
||||
WAR is not ready-to-run. Extract the portlet WAR, and then copy the
|
||||
Due to difference in portlet contrainer implementations, the porlet
|
||||
WAR is not ready-to-run. Extract the porlet WAR, and then copy the
|
||||
contents of apps/portlet/src/main/etc/<your_portal_server>/ into the
|
||||
WAR's WEB-INF directory.
|
||||
|
||||
|
||||
+2
-38
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.0.9</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
@@ -17,38 +17,7 @@
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/portlet/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/portlet/</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pluto</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- configure maven-war-plugin to use updated web.xml -->
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- bind 'pluto:assemble' goal to 'process-resources' lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.apache.pluto</groupId>
|
||||
<artifactId>maven-pluto-plugin</artifactId>
|
||||
<version>1.1.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>assemble</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
@@ -66,11 +35,6 @@
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator Config 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.0.9</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
@@ -38,12 +38,6 @@
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-dojo-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jsf-plugin</artifactId>
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class DynamicTreeSelectAction extends ActionSupport {
|
||||
|
||||
|
||||
public String getNodeName() {
|
||||
return currentCategory != null ? currentCategory.getName() : "Node not found";
|
||||
return currentCategory.getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package org.apache.struts2.showcase;
|
||||
|
||||
import org.apache.struts2.showcase.ajax.tree.Category;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
public class ShowAjaxDynamicTreeAction extends ActionSupport {
|
||||
private int nodeId = 1;
|
||||
|
||||
public Category getCategory() {
|
||||
return Category.getById(nodeId);
|
||||
}
|
||||
|
||||
public int getNodeId() {
|
||||
return nodeId;
|
||||
}
|
||||
|
||||
public void setNodeId(int nodeId) {
|
||||
this.nodeId = nodeId;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
|
||||
String name;
|
||||
Date birthday;
|
||||
Date wakeup;
|
||||
String bio;
|
||||
String favouriteColor;
|
||||
List friends;
|
||||
@@ -242,13 +241,7 @@ public class UITagExample extends ActionSupport implements Validateable {
|
||||
return this.thoughts;
|
||||
}
|
||||
|
||||
public Date getWakeup() {
|
||||
return wakeup;
|
||||
}
|
||||
|
||||
public void setWakeup(Date wakeup) {
|
||||
this.wakeup = wakeup;
|
||||
}
|
||||
|
||||
public String doSubmit() {
|
||||
return SUCCESS;
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.showcase.action;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
public class ExampleAction extends ActionSupport {
|
||||
public static final String CONSTANT = "Struts Rocks!";
|
||||
|
||||
public static Date getCurrentDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "John Galt";
|
||||
}
|
||||
|
||||
public String[] getBands() {
|
||||
return new String[] { "Pink Floyd", "Metallica", "Guns & Roses" };
|
||||
}
|
||||
|
||||
public List<String> getMovies() {
|
||||
return Arrays.asList("Lord of the Rings", "Matrix");
|
||||
}
|
||||
|
||||
public Book getBook() {
|
||||
return new Book("Iliad", "Homer");
|
||||
}
|
||||
|
||||
public Map<String, Book> getBooks() {
|
||||
Map<String, Book> books = new HashMap<String, Book>();
|
||||
books.put("Iliad", new Book("Iliad", "Homer"));
|
||||
books.put("The Republic", new Book("The Replublic", "Plato"));
|
||||
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
|
||||
"Friedrich Nietzsche"));
|
||||
return books;
|
||||
}
|
||||
}
|
||||
|
||||
class Book {
|
||||
private String title;
|
||||
private String author;
|
||||
|
||||
public Book(String title, String author) {
|
||||
this.title = title;
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.struts2.showcase.action;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.interceptor.annotations.After;
|
||||
|
||||
/**
|
||||
* Will only work on containers that unzip war files
|
||||
*
|
||||
*/
|
||||
public class JSPEvalAction extends ExampleAction {
|
||||
private String jsp;
|
||||
private final static String FILE = "/interactive/demo.jsp";
|
||||
|
||||
public String execute() throws IOException {
|
||||
if (jsp != null) {
|
||||
//write it to file
|
||||
URL url = ServletActionContext.getServletContext().getResource(FILE);
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(url
|
||||
.getFile())));
|
||||
try {
|
||||
//directive
|
||||
writer.write("<%@ taglib prefix=\"s\" uri=\"/struts-tags\" %>");
|
||||
writer.write(jsp);
|
||||
} finally {
|
||||
if (writer != null)
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
@After
|
||||
public void cleanUp() throws IOException {
|
||||
URL url = ServletActionContext.getServletContext().getResource(FILE);
|
||||
FileOutputStream out = new FileOutputStream(new File(url.getFile()));
|
||||
try {
|
||||
out.getChannel().truncate(0);
|
||||
} finally {
|
||||
if (out != null)
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void setJsp(String jsp) {
|
||||
this.jsp = jsp;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,5 +21,5 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
public class Constants {
|
||||
public static String UPDATE_FREQ = "5000";
|
||||
public static String UPDATE_FREQ = "30000";
|
||||
}
|
||||
|
||||
+1
-6
@@ -30,9 +30,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.util.ServletContextAware;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
@@ -83,9 +81,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
classLines = read(in, -1);
|
||||
}
|
||||
|
||||
String rootPath = ServletActionContext.getServletContext().getRealPath("/");
|
||||
|
||||
if (config != null && config.trim().length() > 0 && (rootPath == null || config.startsWith(rootPath))) {
|
||||
if (config != null && config.trim().length() > 0) {
|
||||
int pos = config.lastIndexOf(':');
|
||||
configLine = Integer.parseInt(config.substring(pos+1));
|
||||
config = config.substring(0, pos).replace("//", "/");
|
||||
@@ -94,7 +90,6 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param className the className to set
|
||||
*/
|
||||
|
||||
+64
-64
@@ -1,73 +1,73 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
<validators>
|
||||
<field name="requiredValidatorField">
|
||||
<field-validator type="required">
|
||||
<message><![CDATA[ required ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<field name="requiredValidatorField">
|
||||
<field-validator type="required">
|
||||
<message><![CDATA[ required ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message key="i18n.nothing.here"><![CDATA[ required and must be string ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message key="i18n.requiredstring"><![CDATA[ required and must be string ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="integerValidatorField">
|
||||
<field-validator type="int">
|
||||
<param name="min">1</param>
|
||||
<param name="max">10</param>
|
||||
<message><![CDATA[ must be integer min 1 max 10 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="dateValidatorField">
|
||||
<field-validator type="date">
|
||||
<param name="min">01/01/1990</param>
|
||||
<param name="max">01/01/2000</param>
|
||||
<message><![CDATA[ must be a min 01-01-1990 max 01-01-2000 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="emailValidatorField">
|
||||
<field-validator type="email">
|
||||
<message><![CDATA[ must be a valid email if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="urlValidatorField">
|
||||
<field-validator type="url">
|
||||
<message><![CDATA[ must be a valid url if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="stringLengthValidatorField">
|
||||
<field-validator type="stringlength">
|
||||
<param name="maxLength">4</param>
|
||||
<param name="minLength">2</param>
|
||||
<param name="trim">true</param>
|
||||
<message><![CDATA[ must be a String of a specific greater than 1 less than 5 if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="regexValidatorField">
|
||||
<field-validator type="regex">
|
||||
<param name="expression">.*\.txt</param>
|
||||
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="fieldExpressionValidatorField">
|
||||
<field-validator type="fieldexpression">
|
||||
<param name="expression">(fieldExpressionValidatorField == requiredValidatorField)</param>
|
||||
<message><![CDATA[ must be the same as the Required Validator Field if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="integerValidatorField">
|
||||
<field-validator type="int">
|
||||
<param name="min">1</param>
|
||||
<param name="max">10</param>
|
||||
<message><![CDATA[ must be integer min 1 max 10 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="dateValidatorField">
|
||||
<field-validator type="date">
|
||||
<param name="min">01/01/1990</param>
|
||||
<param name="max">01/01/2000</param>
|
||||
<message><![CDATA[ must be a min 01/01/1990 max 01/01/2000 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="emailValidatorField">
|
||||
<field-validator type="email">
|
||||
<message><![CDATA[ must be a valid email if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="urlValidatorField">
|
||||
<field-validator type="url">
|
||||
<message><![CDATA[ must be a valid url if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="stringLengthValidatorField">
|
||||
<field-validator type="stringlength">
|
||||
<param name="maxLength">4</param>
|
||||
<param name="minLength">2</param>
|
||||
<param name="trim">true</param>
|
||||
<message><![CDATA[ must be a String of a specific greater than 1 less than 5 if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="regexValidatorField">
|
||||
<field-validator type="regex">
|
||||
<param name="expression">.*\.txt</param>
|
||||
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="fieldExpressionValidatorField">
|
||||
<field-validator type="fieldexpression">
|
||||
<param name="expression">(fieldExpressionValidatorField == requiredValidatorField)</param>
|
||||
<message><![CDATA[ must be the same as the Required Validator Field if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
<!-- END SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
@@ -74,12 +74,5 @@
|
||||
<action name="AutocompleterExample" class="org.apache.struts2.showcase.ajax.AutocompleterExampleAction">
|
||||
<result type="freemarker">/ajax/options.ftl</result>
|
||||
</action>
|
||||
<action name="quizAjax" class="org.apache.struts2.showcase.validation.QuizAction">
|
||||
<interceptor-ref name="jsonValidationWorkflowStack"/>
|
||||
<result>/validation/quiz-success.jsp</result>
|
||||
</action>
|
||||
<action name="getNodes" class="org.apache.struts2.showcase.ShowAjaxDynamicTreeAction">
|
||||
<result type="freemarker">/tags/ui/treeExampleAjaxDynamic.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
|
||||
<struts>
|
||||
<package name="chat" extends="struts-default" namespace="/chat">
|
||||
<interceptors>
|
||||
<interceptor name="chatAuthentication"
|
||||
class="org.apache.struts2.showcase.chat.ChatAuthenticationInterceptor" />
|
||||
<interceptor-stack name="chatAuthenticationStack">
|
||||
<interceptor-ref name="createSession" />
|
||||
<interceptor-ref name="exception"/>
|
||||
<package name="chat" extends="struts-default" namespace="/chat">
|
||||
<interceptors>
|
||||
<interceptor name="chatAuthentication"
|
||||
class="org.apache.struts2.showcase.chat.ChatAuthenticationInterceptor" />
|
||||
<interceptor-stack name="chatAuthenticationStack">
|
||||
<interceptor-ref name="createSession" />
|
||||
<interceptor-ref name="exception"/>
|
||||
<interceptor-ref name="alias"/>
|
||||
<interceptor-ref name="servletConfig"/>
|
||||
<interceptor-ref name="servlet-config"/>
|
||||
<interceptor-ref name="prepare"/>
|
||||
<interceptor-ref name="i18n"/>
|
||||
<interceptor-ref name="chain"/>
|
||||
<interceptor-ref name="debugging"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<interceptor-ref name="model-driven"/>
|
||||
<interceptor-ref name="fileUpload"/>
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="static-params"/>
|
||||
<interceptor-ref name="params"/>
|
||||
<interceptor-ref name="conversionError"/>
|
||||
<interceptor-ref name="validation">
|
||||
@@ -29,62 +29,62 @@
|
||||
<param name="excludeMethods">input,back,cancel,browse</param>
|
||||
</interceptor-ref>
|
||||
<interceptor-ref name="chatAuthentication" />
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<global-results>
|
||||
<result name="login" type="freemarker">/chat/chatLogin.ftl</result>
|
||||
</global-results>
|
||||
|
||||
<action name="main">
|
||||
<interceptor-ref name="chatAuthentication" />
|
||||
<result type="freemarker">/chat/roomSelection.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="login" class="chatLoginAction">
|
||||
<interceptor-ref name="defaultStack" />
|
||||
<result type="redirect">/chat/showRooms.action</result>
|
||||
<result name="input" type="freemarker">/chat/chatLogin.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="logout" class="chatLogoutAction">
|
||||
<interceptor-ref name="defaultStack" />
|
||||
<result type="redirect">/chat/main.action</result>
|
||||
</action>
|
||||
|
||||
<action name="showRooms">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/roomSelection.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="enterRoom" class="enterRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/showRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="exitRoom" class="exitRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="redirect">/chat/showRooms.action</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
<package name="chat-remote" extends="struts-default" namespace="/chat/ajax">
|
||||
<interceptors>
|
||||
<interceptor name="chatAuthentication"
|
||||
class="org.apache.struts2.showcase.chat.ChatAuthenticationInterceptor" />
|
||||
<interceptor-stack name="chatAuthenticationStack">
|
||||
<interceptor-ref name="createSession" />
|
||||
<interceptor-ref name="exception"/>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<global-results>
|
||||
<result name="login" type="freemarker">/chat/chatLogin.ftl</result>
|
||||
</global-results>
|
||||
|
||||
<action name="main">
|
||||
<interceptor-ref name="chatAuthentication" />
|
||||
<result type="freemarker">/chat/roomSelection.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="login" class="chatLoginAction">
|
||||
<interceptor-ref name="defaultStack" />
|
||||
<result type="redirect">/chat/showRooms.action</result>
|
||||
<result name="input" type="freemarker">/chat/chatLogin.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="logout" class="chatLogoutAction">
|
||||
<interceptor-ref name="defaultStack" />
|
||||
<result type="redirect">/chat/main.action</result>
|
||||
</action>
|
||||
|
||||
<action name="showRooms">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/roomSelection.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="enterRoom" class="enterRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/showRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="exitRoom" class="exitRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="redirect">/chat/showRooms.action</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
<package name="chat-remote" extends="struts-default" namespace="/chat/ajax">
|
||||
<interceptors>
|
||||
<interceptor name="chatAuthentication"
|
||||
class="org.apache.struts2.showcase.chat.ChatAuthenticationInterceptor" />
|
||||
<interceptor-stack name="chatAuthenticationStack">
|
||||
<interceptor-ref name="createSession" />
|
||||
<interceptor-ref name="exception"/>
|
||||
<interceptor-ref name="alias"/>
|
||||
<interceptor-ref name="servletConfig"/>
|
||||
<interceptor-ref name="servlet-config"/>
|
||||
<interceptor-ref name="prepare"/>
|
||||
<interceptor-ref name="i18n"/>
|
||||
<interceptor-ref name="chain"/>
|
||||
<interceptor-ref name="debugging"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<interceptor-ref name="model-driven"/>
|
||||
<interceptor-ref name="fileUpload"/>
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="static-params"/>
|
||||
<interceptor-ref name="params"/>
|
||||
<interceptor-ref name="conversionError"/>
|
||||
<interceptor-ref name="validation">
|
||||
@@ -94,42 +94,42 @@
|
||||
<param name="excludeMethods">input,back,cancel,browse</param>
|
||||
</interceptor-ref>
|
||||
<interceptor-ref name="chatAuthentication" />
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
|
||||
<action name="usersAvailable" class="usersAvailableAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/usersAvailable.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="roomsAvailable" class="roomsAvailableAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/roomsAvailable.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="createRoom" class="crudRoomAction" method="create">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/createRoom.ftl</result>
|
||||
<result name="input" type="freemarker">/chat/createRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="messagesAvailableInRoom" class="messagesAvailableInRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/messagesAvailableInRoom.ftl</result>
|
||||
<result name="input" type="freemarker">/chat/messagesAvailableInRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="sendMessageToRoom" class="sendMessageToRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/sendMessageToRoomResult.ftl</result>
|
||||
<result name="input" type="freemarker">/chat/sendMessageToRoomResult.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="usersAvailableInRoom" class="usersAvailableInRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/usersAvailableInRoom.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
|
||||
<action name="usersAvailable" class="usersAvailableAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/usersAvailable.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="roomsAvailable" class="roomsAvailableAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/roomsAvailable.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="createRoom" class="crudRoomAction" method="create">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/createRoom.ftl</result>
|
||||
<result name="input" type="freemarker">/chat/createRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="messagesAvailableInRoom" class="messagesAvailableInRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/messagesAvailableInRoom.ftl</result>
|
||||
<result name="input" type="freemarker">/chat/messagesAvailableInRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="sendMessageToRoom" class="sendMessageToRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/sendMessageToRoomResult.ftl</result>
|
||||
<result name="input" type="freemarker">/chat/sendMessageToRoomResult.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="usersAvailableInRoom" class="usersAvailableInRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/chat/usersAvailableInRoom.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
<result name="input">enterPersonInfo.jsp</result>
|
||||
</action>
|
||||
<action name="showPersonJspCode">
|
||||
<result type="plainText">/conversion/enterPersonInfo.jsp</result>
|
||||
<result type="plaintext">/conversion/enterPersonInfo.jsp</result>
|
||||
</action>
|
||||
<action name="showPersonActionJavaCode">
|
||||
<result type="plainText">/conversion/PersonAction.java.txt</result>
|
||||
<result type="plaintext">/conversion/PersonAction.java.txt</result>
|
||||
</action>
|
||||
<action name="showPersonJavaCode">
|
||||
<result type="plainText">/conversion/Person.java.txt</result>
|
||||
<result type="plaintext">/conversion/Person.java.txt</result>
|
||||
</action>
|
||||
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
<result name="input">enterAddressInfo.jsp</result>
|
||||
</action>
|
||||
<action name="showAddressJspCode">
|
||||
<result type="plainText">/conversion/enterAddressInfo.jsp</result>
|
||||
<result type="plaintext">/conversion/enterAddressInfo.jsp</result>
|
||||
</action>
|
||||
<action name="showAddressActionJavaCode">
|
||||
<result type="plainText">/conversion/AddressAction.java.txt</result>
|
||||
<result type="plaintext">/conversion/AddressAction.java.txt</result>
|
||||
</action>
|
||||
<action name="showAddressJavaCode">
|
||||
<result type="plainText">/conversion/Address.java.txt</result>
|
||||
<result type="plaintext">/conversion/Address.java.txt</result>
|
||||
</action>
|
||||
|
||||
|
||||
@@ -56,19 +56,19 @@
|
||||
<result name="input">enterOperations.jsp</result>
|
||||
</action>
|
||||
<action name="showEnumJspCode">
|
||||
<result type="plainText">/conversion/enterOperations.jsp</result>
|
||||
<result type="plaintext">/conversion/enterOperations.jsp</result>
|
||||
</action>
|
||||
<action name="showOperationsEnumJavaCode">
|
||||
<result type="plainText">/conversion/OperationsEnum.java.txt</result>
|
||||
<result type="plaintext">/conversion/OperationsEnum.java.txt</result>
|
||||
</action>
|
||||
<action name="showOperationEnumActionJavaCode">
|
||||
<result type="plainText">/conversion/OperationsEnumAction.java.txt</result>
|
||||
<result type="plaintext">/conversion/OperationsEnumAction.java.txt</result>
|
||||
</action>
|
||||
<action name="showEnumTypeConverterJavaCode">
|
||||
<result type="plainText">/conversion/EnumTypeConverter.java.txt</result>
|
||||
<result type="plaintext">/conversion/EnumTypeConverter.java.txt</result>
|
||||
</action>
|
||||
<action name="showOperationsEnumActionConversionProperties">
|
||||
<result type="plainText">/conversion/OperationsEnumActionConversion.txt</result>
|
||||
<result type="plaintext">/conversion/OperationsEnumActionConversion.txt</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
@@ -5,44 +5,45 @@
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="integration" extends="struts1-default" namespace="/integration">
|
||||
|
||||
<interceptors>
|
||||
<interceptor name="gangsterForm" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
|
||||
<param name="className">org.apache.struts2.showcase.integration.GangsterForm</param>
|
||||
<param name="name">gangsterForm</param>
|
||||
</interceptor>
|
||||
<interceptor name="gangsterValidation" class="org.apache.struts2.s1.ActionFormValidationInterceptor">
|
||||
<param name="pathnames">/org/apache/struts/validator/validator-rules.xml,/WEB-INF/validation.xml</param>
|
||||
</interceptor>
|
||||
|
||||
<interceptor-stack name="integration">
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="gangsterForm"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<package name="integration" extends="struts1-default" namespace="/integration">
|
||||
|
||||
<interceptors>
|
||||
<interceptor name="gangsterForm" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
|
||||
<param name="className">org.apache.struts2.showcase.integration.GangsterForm</param>
|
||||
<param name="name">gangsterForm</param>
|
||||
</interceptor>
|
||||
<interceptor name="gangsterValidation" class="org.apache.struts2.s1.ActionFormValidationInterceptor">
|
||||
<param name="pathnames">/org/apache/struts/validator/validator-rules.xml,/WEB-INF/validation.xml</param>
|
||||
</interceptor>
|
||||
|
||||
<interceptor-stack name="integration">
|
||||
<interceptor-ref name="static-params"/>
|
||||
<interceptor-ref name="gangsterForm"/>
|
||||
<interceptor-ref name="model-driven"/>
|
||||
<interceptor-ref name="actionForm-reset"/>
|
||||
<interceptor-ref name="basicStack"/>
|
||||
<interceptor-ref name="gangsterValidation"/>
|
||||
<interceptor-ref name="workflow"/>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="integration" />
|
||||
<default-action-ref name="editGangster" />
|
||||
|
||||
<!-- Diplay entry page that uses Model-Driven technique -->
|
||||
<action name="editGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.EditGangsterAction</param>
|
||||
<result>modelDriven.jsp</result>
|
||||
</action>
|
||||
|
||||
<!-- Display the result page whose content is populated using the Model-Driven technique -->
|
||||
<action name="saveGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.SaveGangsterAction</param>
|
||||
<param name="validate">true</param>
|
||||
<result name="input">modelDriven.jsp</result>
|
||||
<result>modelDrivenResult.jsp</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="integration" />
|
||||
<default-action-ref name="editGangster" />
|
||||
|
||||
<!-- Diplay entry page that uses Model-Driven technique -->
|
||||
<action name="editGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.EditGangsterAction</param>
|
||||
<result>modelDriven.jsp</result>
|
||||
</action>
|
||||
|
||||
<!-- Display the result page whose content is populated using the Model-Driven technique -->
|
||||
<action name="saveGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.SaveGangsterAction</param>
|
||||
<param name="validate">true</param>
|
||||
<result name="input">modelDriven.jsp</result>
|
||||
<result>modelDrivenResult.jsp</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="ognl" namespace="/nodecorate" extends="struts-default">
|
||||
<action name="jspEval" class="org.apache.struts2.showcase.action.JSPEvalAction">
|
||||
<interceptor-ref name="params"/>
|
||||
<interceptor-ref name="debugging"/>
|
||||
<interceptor-ref name="annotationWorkflow" />
|
||||
<result>/interactive/demo.jsp</result>
|
||||
</action>
|
||||
<action name="example" class="org.apache.struts2.showcase.action.ExampleAction" />
|
||||
</package>
|
||||
</struts>
|
||||
@@ -22,7 +22,7 @@
|
||||
<result>/tags/non-ui/actionTag/includedPage3.jsp</result>
|
||||
</action>
|
||||
<action name="lookAtSource">
|
||||
<result type="plainText">/tags/non-ui/actionTag/showActionTagDemo.jsp</result>
|
||||
<result type="plaintext">/tags/non-ui/actionTag/showActionTagDemo.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
@@ -104,10 +104,10 @@
|
||||
<result type="freemarker">/tags/non-ui/actionPrefix/redirectActionPrefix.ftl</result>
|
||||
</action>
|
||||
<action name="redirectActionPrefixAction">
|
||||
<result type="redirect">redirectActionPrefix</result>
|
||||
<result type="redirect-action">redirectActionPrefix</result>
|
||||
</action>
|
||||
<action name="viewSource">
|
||||
<result type="plainText">/tags/non-ui/actionPrefix/actionPrefixExample.ftl</result>
|
||||
<result type="plaintext">/tags/non-ui/actionPrefix/actionPrefixExample.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
@@ -47,12 +47,9 @@
|
||||
|
||||
<!-- END SNIPPET: treeExampleDynamicXWorkXml -->
|
||||
|
||||
<action name="showDynamicAjaxTreeAction">
|
||||
<result>/tags/ui/treeExampleAjaxDynamic.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="showComponentTagExampleCode">
|
||||
<result type="plainText">/tags/ui/componentTagExample.jsp</result>
|
||||
<result type="plaintext">/tags/ui/componentTagExample.jsp</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<action name="transfer3" class="org.apache.struts2.showcase.token.TokenAction">
|
||||
<interceptor-ref name="defaultStack"/>
|
||||
<interceptor-ref name="tokenSession"/>
|
||||
<interceptor-ref name="token-session"/>
|
||||
<result name="invalid.token">doublePost.jsp</result>
|
||||
<result name="success" type="redirect">transferDone.jsp</result>
|
||||
</action>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
</action>
|
||||
|
||||
<action name="quizAjax" class="org.apache.struts2.showcase.validation.QuizAction">
|
||||
<interceptor-ref name="jsonValidationWorkflowStack"/>
|
||||
<result name="input">quiz-ajax.jsp</result>
|
||||
<result>quiz-success.jsp</result>
|
||||
</action>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<!-- Some or all of these can be flipped to true for debugging -->
|
||||
<constant name="struts.i18n.reload" value="false" />
|
||||
<constant name="struts.devMode" value="true" />
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<constant name="struts.configuration.xml.reload" value="false" />
|
||||
<constant name="struts.custom.i18n.resources" value="globalMessages" />
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
<constant name="struts.serve.static.browserCache" value="false" />
|
||||
|
||||
<include file="struts-chat.xml" />
|
||||
|
||||
<include file="struts-interactive.xml" />
|
||||
|
||||
<include file="struts-hangman.xml" />
|
||||
|
||||
<include file="struts-continuations.xml"/>
|
||||
|
||||
<include file="struts-tags.xml"/>
|
||||
|
||||
<include file="struts-validation.xml" />
|
||||
@@ -61,7 +61,7 @@
|
||||
<interceptor-stack name="crudStack">
|
||||
<interceptor-ref name="checkbox" />
|
||||
<interceptor-ref name="params" />
|
||||
<interceptor-ref name="staticParams" />
|
||||
<interceptor-ref name="static-params" />
|
||||
<interceptor-ref name="defaultStack" />
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
@@ -110,7 +110,7 @@
|
||||
<interceptor-ref name="basicStack"/>
|
||||
</action>
|
||||
<action name="edit-*" class="org.apache.struts2.showcase.action.EmployeeAction">
|
||||
<param name="empId">{1}</param>
|
||||
<param name="empId">{1}</param>
|
||||
<result>/empmanager/editEmployee.jsp</result>
|
||||
<interceptor-ref name="crudStack"><param name="validation.excludeMethods">execute</param></interceptor-ref>
|
||||
</action>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
|
||||
|
||||
// Calculate the view sources url
|
||||
String sourceUrl = request.getContextPath()+"/viewSource.action";
|
||||
com.opensymphony.xwork2.ActionInvocation inv = com.opensymphony.xwork2.ActionContext.getContext().getActionInvocation();
|
||||
@@ -14,9 +14,9 @@
|
||||
com.opensymphony.xwork2.util.location.Location loc = inv.getProxy().getConfig().getLocation();
|
||||
sourceUrl += "?config="+(loc != null ? loc.getURI()+":"+loc.getLineNumber() : "");
|
||||
sourceUrl += "&className="+inv.getProxy().getConfig().getClassName();
|
||||
|
||||
|
||||
if (inv.getResult() != null && inv.getResult() instanceof org.apache.struts2.dispatcher.StrutsResultSupport) {
|
||||
sourceUrl += "&page="+mapping.getNamespace()+"/"+((org.apache.struts2.dispatcher.StrutsResultSupport)inv.getResult()).getLastFinalLocation();
|
||||
sourceUrl += "&page="+mapping.getNamespace()+"/"+((org.apache.struts2.dispatcher.StrutsResultSupport)inv.getResult()).getLastFinalLocation();
|
||||
}
|
||||
} else {
|
||||
sourceUrl += "?page="+request.getServletPath();
|
||||
@@ -30,6 +30,23 @@
|
||||
<head>
|
||||
<title><decorator:title default="Struts Showcase"/></title>
|
||||
<link href="<s:url value='/styles/main.css' encode='false' includeParams='none'/>" rel="stylesheet" type="text/css" media="all"/>
|
||||
<link href="<s:url value='/struts/niftycorners/niftyCorners.css' encode='false' includeParams='none'/>" rel="stylesheet" type="text/css"/>
|
||||
<link href="<s:url value='/struts/niftycorners/niftyPrint.css' encode='false' includeParams='none'/>" rel="stylesheet" type="text/css" media="print"/>
|
||||
|
||||
<script language="JavaScript" type="text/javascript" src="<s:url value='/struts/niftycorners/nifty.js' encode='false' includeParams='none'/>"></script>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
|
||||
window.onload=function(){
|
||||
if(!NiftyCheck())
|
||||
return;
|
||||
Rounded("blockquote","tr bl","#ECF1F9","#CDFFAA","smooth border #88D84F");
|
||||
Rounded("div#outer-header", "all", "white", "#818EBD", "smooth border #434F7C");
|
||||
Rounded("div#footer", "all", "white", "#818EBD", "smooth border #434F7C");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<decorator:head/>
|
||||
</head>
|
||||
|
||||
@@ -41,7 +58,7 @@
|
||||
<div id="header" class="clearfix">
|
||||
<div id="branding">
|
||||
<h1 class="title">Struts Showcase</h1>
|
||||
<s:action var="dateAction" name="date" namespace="/" executeResult="true" />
|
||||
<s:action id="dateAction" name="date" namespace="/" executeResult="true" />
|
||||
</div><!-- end branding -->
|
||||
|
||||
<div id="search">
|
||||
@@ -78,7 +95,6 @@
|
||||
<li><a href="<s:url value="/tiles/index.action" />">Tiles</a></li>
|
||||
<li><a href="<s:url value="/token/index.jsp"/>">Token</a></li>
|
||||
<li><a href="<s:url value="/validation/index.jsp"/>">Validation</a></li>
|
||||
<li><a href="<s:url value="/interactive/index.jsp"/>">Interactive Demo</a></li>
|
||||
<li class="last"><a href="<s:url value="/help.jsp"/>">Help</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -88,11 +104,11 @@
|
||||
|
||||
</div><!-- end content -->
|
||||
|
||||
<div>
|
||||
<p>
|
||||
<a href="<%=sourceUrl %>">View Sources</a>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<a href="<%=sourceUrl %>">View Sources</a>
|
||||
</p>
|
||||
</div>
|
||||
<div id="footer" class="clearfix">
|
||||
<p>Copyright © 2003-<s:property value="#dateAction.now.year + 1900" /> The Apache Software Foundation.</p>
|
||||
</div><!-- end footer -->
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
@@ -10,152 +9,74 @@
|
||||
<!--// END SNIPPET: common-include-->
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
dojo.event.topic.subscribe("/before", function(event, widget){
|
||||
alert('inside a topic event. before request');
|
||||
//event: set event.cancel = true, to cancel request
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, request, widget){
|
||||
alert('inside a topic event. after request');
|
||||
//data : json object from request
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/value", function(error, request, widget){
|
||||
alert('inside a topic event. on error');
|
||||
//error : error object (error.message has the error message)
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
function showKey() {
|
||||
var autoCompleter = dojo.widget.byId('jsauto');
|
||||
alert(autoCompleter.getSelectedKey());
|
||||
}
|
||||
|
||||
function showValue() {
|
||||
var autoCompleter = dojo.widget.byId('jsauto');
|
||||
alert(autoCompleter.getSelectedValue());
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<s:url var="jsonList" value="/JSONList.action"/>
|
||||
<s:url id="jsonList" value="/JSONList.action"/>
|
||||
|
||||
Using a JSON list returned from an action (href="/JSONList.action"), without autoComplete (autoComplete="false"), use indicator, search substring (searchType="substring")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
indicator="indicator1"
|
||||
href="%{jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
autoComplete="false"
|
||||
searchType="substring"
|
||||
name="state"/>
|
||||
<s:autocompleter name="state" theme="ajax" indicator="indicator1" href="%{jsonList}" cssStyle="width: 200px;" autoComplete="false" searchType="substring"/>
|
||||
<img id="indicator1" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Reload on type (loadOnTextChange="true"), after 3 characters (loadMinimumCount="3", it is "3" by default), without the down arrow button (showDownArrow="false")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
indicator="indicator"
|
||||
href="%{jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
autoComplete="false"
|
||||
loadOnTextChange="true"
|
||||
loadMinimumCount="3"
|
||||
showDownArrow="false"/>
|
||||
<br/>
|
||||
|
||||
Reload on type (loadOnTextChange="true"), after 3 characters (loadMinimumCout="3", it is "3" by default), without the down arrow button (showDownArrow="false")
|
||||
<br/>
|
||||
<s:autocompleter name="state" theme="ajax" indicator="indicator" href="%{jsonList}" cssStyle="width: 200px;" autoComplete="false" loadOnTextChange="true" loadMinimumCount="3" showDownArrow="false"/>
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
|
||||
<br/><br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Using a JSON list returned from an action (href="/JSONList.action"), with autoComplete (autoComplete="true")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
href="%{#jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
autoComplete="true" />
|
||||
<s:autocompleter theme="ajax" href="%{jsonList}" cssStyle="width: 200px;" autoComplete="true" />
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Using a local list (list="%{'apple','banana','grape','pear'}")
|
||||
<br/>
|
||||
<sx:autocompleter list="{'apple','banana','grape','pear'}" cssStyle="width: 150px;"/>
|
||||
<br/>
|
||||
|
||||
<br/><br/>
|
||||
Using a local list (list="{'apple','banana','grape','pear'}")
|
||||
<br/>
|
||||
<s:autocompleter theme="simple" list="{'apple','banana','grape','pear'}" cssStyle="width: 150px;"/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Force valid options (forceValidOption="true")
|
||||
<br/>
|
||||
<sx:autocompleter href="%{#jsonList}" cssStyle="width: 200px;" forceValidOption="true"/>
|
||||
<s:autocompleter theme="ajax" href="%{jsonList}" cssStyle="width: 200px;" forceValidOption="true"/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Make dropdown's height to 180px (dropdownHeight="180")
|
||||
<br/>
|
||||
<sx:autocompleter href="%{#jsonList}" cssStyle="width: 200px;" dropdownHeight="180"/>
|
||||
<s:autocompleter theme="ajax" href="%{jsonList}" cssStyle="width: 200px;" dropdownHeight="180"/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Disabled combobox (disabled="true")
|
||||
<br/>
|
||||
<sx:autocompleter href="%{#jsonList}" cssStyle="width: 200px;" disabled="true"/>
|
||||
<s:autocompleter theme="ajax" href="%{jsonList}" cssStyle="width: 200px;" disabled="true"/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<s:url var="autoex" action="AutocompleterExample" namespace="/nodecorate"/>
|
||||
<s:url id="autoex" action="AutocompleterExample" namespace="/nodecorate"/>
|
||||
|
||||
Link two autocompleter elements. When the selected value in 'Autocompleter 1' changes, the available values in 'Autocompleter 2' will change also.
|
||||
<br/>
|
||||
<form id="selectForm">
|
||||
<p>
|
||||
Autocompleter 1
|
||||
<sx:autocompleter
|
||||
name="select"
|
||||
list="{'fruits','colors'}"
|
||||
value="colors"
|
||||
valueNotifyTopics="/Changed"
|
||||
forceValidOption="true"/>
|
||||
</p>
|
||||
<p>Autocompleter 1 <s:autocompleter theme="simple" name="select" list="{'fruits','colors'}" value="colors" notifyTopics="/Changed" forceValidOption="true" id="sel"/></p>
|
||||
</form>
|
||||
Autocompleter 2
|
||||
<sx:autocompleter
|
||||
href="%{#autoex}"
|
||||
autoComplete="false"
|
||||
formId="selectForm"
|
||||
listenTopics="/Changed"
|
||||
forceValidOption="true" />
|
||||
Autocompleter 2 <s:autocompleter theme="ajax" href="%{#autoex}" autoComplete="false" formId="selectForm" listenTopics="/Changed" forceValidOption="true" id="ops"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Publish before/after/value notify topics
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
href="%{#jsonList}"
|
||||
listenTopics="/reload"
|
||||
beforeNotifyTopics="/before"
|
||||
afterNotifyTopics="/after"
|
||||
valueNotifyTopics="/value"
|
||||
cssStyle="width: 200px;" />
|
||||
<s:submit theme="simple" value="Reload Values" onclick="dojo.event.topic.publish('/reload')"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Get values using JavaScript
|
||||
<br/>
|
||||
<sx:autocompleter href="%{#jsonList}" id="jsauto" name="state"/>
|
||||
<s:submit theme="simple" value="Show Key" onclick="showKey()"/>
|
||||
<s:submit theme="simple" value="Show Value" onclick="showValue()"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
</body>
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Bind Examples</title>
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
dojo.event.topic.subscribe("/before", function(event, widget){
|
||||
alert('inside a topic event. before request');
|
||||
//event: set event.cancel = true, to cancel request
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, request, widget){
|
||||
alert('inside a topic event. after request');
|
||||
//data : text returned from request
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="div1">Div 1</div>
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<br/><br/>
|
||||
<p>
|
||||
1. Attach to "onclick" event on button. Update content of Div 1. Use with indicator.
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<sx:bind id="ex1" href="%{#ajaxTest}" sources="button" targets="div1" events="onclick" indicator="indicator" />
|
||||
<br/>
|
||||
<s:submit theme="simple" type="submit" value="submit" id="button"/>
|
||||
</p>
|
||||
<br/><br/>
|
||||
<p>
|
||||
2. Attach to "onmouseover", and "onclick" event on Area below and update content of Div1, highlight targets with green color
|
||||
<sx:bind id="ex2" href="%{#ajaxTest}" sources="div2" targets="div1" events="onmouseover,onclick" highlightColor="green"/>
|
||||
<div id="div2" style="width: 300px; height: 50px; border: 1px solid black">
|
||||
Mouse Over or Click Here!
|
||||
</div>
|
||||
</p>
|
||||
<br/><br/>
|
||||
<p>
|
||||
3. Attach to "onkeydown" event on Textbox below update content of Div1. Publish topics.
|
||||
<sx:bind id="ex4" href="%{#ajaxTest}" sources="txt1" targets="div1" events="onkeydown" beforeNotifyTopics="/before" afterNotifyTopics="/after" />
|
||||
<br/>
|
||||
<s:textfield id="txt1"/>
|
||||
</p>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,4 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<!--// START SNIPPET: common-include-->
|
||||
<sx:head cache="true"/>
|
||||
<s:head theme="ajax"/>
|
||||
<!--// END SNIPPET: common-include-->
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<hr/>
|
||||
|
||||
<s:url var="backToAjaxExamples" value=".." />
|
||||
<s:url id="backToAjaxExamples" value=".." />
|
||||
|
||||
<s:a href="%{backToAjaxExamples}">Back To AJAX Examples</s:a>
|
||||
|
||||
|
||||
@@ -10,15 +10,14 @@ Note: The Ajax tags are experimental. These examples have only been tested under
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="bind/index.jsp">Bind tag</a></li>
|
||||
<li><a href="autocompleter/index.jsp">Autocompleter combobox tag</a></li>
|
||||
<li><a href="remotebutton/index.jsp">Remote button tag</a></li>
|
||||
<li><a href="remotediv/index.jsp">Remote div tag</a></li>
|
||||
<li><a href="remotelink/index.jsp">Remote link tag</a></li>
|
||||
<li><a href="tabbedpanel/index.jsp">Tabbed panel</a></li>
|
||||
<li><a href="remoteforms/index.jsp">Remote forms</a></li>
|
||||
<li><a href="widgets/index.jsp">Widgets </a> (may not work in all browsers!)
|
||||
<li><a href="autocompleter">Autocompleter combobox tag</a></li>
|
||||
<li><a href="remotebutton">Remote button tag</a></li>
|
||||
<li><a href="remotediv">Remote div tag</a></li>
|
||||
<li><a href="remotelink">Remote link tag</a></li>
|
||||
<li><a href="tabbedpanel">Tabbed panel</a></li>
|
||||
<li><a href="widgets">Widgets </a> (may not work in all browsers!)
|
||||
see the <a href="http://www.dojotoolkit.org">dojo website</a> for more information</li>
|
||||
<li><a href="remoteforms">Remote forms</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -13,10 +12,10 @@
|
||||
function after() {alert("after request");}
|
||||
function handler(widget, node) {
|
||||
alert('I will handle this myself!');
|
||||
dojo.byId(widget.targetsArray[0]).innerHTML = "Done";
|
||||
dojo.byId(widget.targetsArray[0]).innerHTML = "Done";
|
||||
}
|
||||
|
||||
dojo.event.topic.subscribe("/alltopics", function(data, type, e){
|
||||
dojo.event.topic.subscribe("/after", function(data, type, e){
|
||||
alert('inside a topic event. type='+type);
|
||||
//data : text returned
|
||||
//type : "before", "load" or "error"
|
||||
@@ -27,30 +26,26 @@
|
||||
<body>
|
||||
|
||||
<div id="t1">Div 1</div>
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<br/><br/>
|
||||
|
||||
A submit button, that highlights (blue color) its targets
|
||||
<sx:submit type="submit" value="submit" targets="t1" href="%{ajaxTest}" highlightColor="blue"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
A submit button, with an indicator
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<sx:submit type="submit" value="submit" targets="t1" href="%{ajaxTest}" indicator="indicator"/>
|
||||
<s:submit type="submit" theme="ajax" value="submit" targets="t1" href="%{ajaxTest}" align="left" indicator="indicator"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
A submit button, with "notifyTopics"
|
||||
<sx:submit type="submit" value="submit" targets="t1" href="%{ajaxTest}" notifyTopics="/alltopics"/>
|
||||
<s:submit type="submit" theme="ajax" value="submit" targets="t1" href="%{ajaxTest}" align="left" notifyTopics="/after"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Use an image as submit
|
||||
|
||||
<sx:submit type="image" label="Alt Text" targets="t1"
|
||||
src="${pageContext.request.contextPath}/images/struts-power.gif" href="%{ajaxTest}" />
|
||||
<s:submit type="image" theme="ajax" label="Alt Text" targets="t1"
|
||||
src="${pageContext.request.contextPath}/images/struts-power.gif" href="%{ajaxTest}" align="left" />
|
||||
<br/><br/>
|
||||
|
||||
<label for="textInput">Text to be echoed</label>
|
||||
@@ -59,7 +54,7 @@ Use an image as submit
|
||||
Use a button as submit (custom text)
|
||||
<s:form id="form" action="AjaxTest">
|
||||
<input type=textbox name="data">
|
||||
<sx:submit type="button" label="Update Content" targets="t1" id="ajaxbtn"/>
|
||||
<s:submit type="button" theme="ajax" label="Update Content" targets="t1" id="ajaxbtn"/>
|
||||
</s:form>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -8,15 +7,16 @@
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<body>
|
||||
<sx:div
|
||||
<s:div
|
||||
id="once"
|
||||
theme="ajax"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}">
|
||||
Initial Content</sx:div>
|
||||
Initial Content</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -15,15 +14,16 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<body>
|
||||
<sx:div
|
||||
<s:div
|
||||
id="once"
|
||||
theme="ajax"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
handler="handler">
|
||||
Initial Content</sx:div>
|
||||
Initial Content</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -10,17 +9,18 @@
|
||||
|
||||
|
||||
<body>
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<sx:div
|
||||
<s:div
|
||||
id="once"
|
||||
theme="ajax"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{#ajaxTest}"
|
||||
href="%{ajaxTest}"
|
||||
updateFreq="2000"
|
||||
indicator="indicator"
|
||||
>
|
||||
Initial Content</sx:div>
|
||||
Initial Content</s:div>
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -10,16 +9,17 @@
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<sx:div
|
||||
<s:div
|
||||
id="twoseconds"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
theme="ajax"
|
||||
delay="2000"
|
||||
updateFreq="%{#parameters.period}"
|
||||
errorText="There was an error">Initial Content</sx:div>
|
||||
errorText="There was an error">Initial Content</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -10,17 +9,17 @@
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<sx:div
|
||||
<s:div
|
||||
id="fiveseconds"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
theme="ajax"
|
||||
delay="1000"
|
||||
updateFreq="5000"
|
||||
errorText="There was an error"
|
||||
loadingText="reloading"
|
||||
showLoadingText="true">loading now</sx:div>
|
||||
loadingText="reloading">loading now</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -10,15 +9,16 @@
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="ajaxNoUrl" value="/AjaxNoUrl.jsp" />
|
||||
<s:url id="ajaxNoUrl" value="/AjaxNoUrl.jsp" />
|
||||
|
||||
<sx:div
|
||||
<s:div
|
||||
id="error"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="/AjaxNoUrl.jsp"
|
||||
theme="ajax"
|
||||
delay="1000"
|
||||
errorText="Could not contact server"
|
||||
loadingText="reloading">loading now</sx:div>
|
||||
loadingText="reloading">loading now</s:div>
|
||||
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -10,13 +9,14 @@
|
||||
|
||||
<body>
|
||||
|
||||
<sx:div
|
||||
<s:div
|
||||
id="error"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="/AjaxNoUrl.jsp"
|
||||
theme="ajax"
|
||||
delay="1000"
|
||||
showErrorTransportText="true"
|
||||
loadingText="reloading">loading now</sx:div>
|
||||
loadingText="reloading">loading now</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -10,16 +9,17 @@
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="test3" value="/Test3.action" />
|
||||
<s:url id="test3" value="/Test3.action" />
|
||||
|
||||
|
||||
<sx:div
|
||||
<s:div
|
||||
id="error"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{test3}"
|
||||
theme="ajax"
|
||||
delay="1000"
|
||||
executeScripts="true"
|
||||
loadingText="reloading">loading now</sx:div>
|
||||
loadingText="reloading">loading now</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -34,10 +33,11 @@
|
||||
<input type=button value="stop timer" onclick="controller.stop()">
|
||||
<input type=button value="start timer" onclick="controller.start()">
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<sx:div
|
||||
<s:div
|
||||
id="once"
|
||||
theme="ajax"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
loadingText="Loading..."
|
||||
@@ -46,10 +46,9 @@
|
||||
stopTimerListenTopics="/stopTimer"
|
||||
updateFreq="3000"
|
||||
autoStart="true"
|
||||
highlightColor="red"
|
||||
formId="form"
|
||||
>
|
||||
Initial Content</sx:div>
|
||||
Initial Content</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -21,18 +20,11 @@
|
||||
dojo.event.topic.registerPublisher("/startTimer", controller, "start");
|
||||
dojo.event.topic.registerPublisher("/stopTimer", controller, "stop");
|
||||
|
||||
dojo.event.topic.subscribe("/before", function(data, type, e){
|
||||
alert('inside a topic event. before request');
|
||||
//data : source element id
|
||||
//type : "before"
|
||||
//e : request object
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, type, e){
|
||||
alert('inside a topic event. after request');
|
||||
alert('inside a topic event. type='+type);
|
||||
//data : text returned
|
||||
//type : "load"
|
||||
//e : undefined
|
||||
//type : "before", "load" or "error"
|
||||
//e : request object
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -41,10 +33,11 @@
|
||||
<input type=button value="start timer" onclick="controller.start()">
|
||||
<input type=button value="stop timer" onclick="controller.stop()">
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<sx:div
|
||||
id="div1"
|
||||
<s:div
|
||||
id="once"
|
||||
theme="ajax"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
listenTopics="/refresh"
|
||||
@@ -52,10 +45,10 @@
|
||||
stopTimerListenTopics="/stopTimer"
|
||||
updateFreq="10000"
|
||||
autoStart="false"
|
||||
beforeNotifyTopics="/before"
|
||||
afterNotifyTopics="/after"
|
||||
afterLoading="alert('after request')"
|
||||
notifyTopics="/after"
|
||||
>
|
||||
Initial Content</sx:div>
|
||||
Initial Content</s:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="example8.jsp">A div that will listen to events to refresh and start/stop autoupdate, and gets highlighted in red (when it loads)</a>
|
||||
<a href="example8.jsp">A div that will listen to events to refresh and start/stop autoupdate</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
@@ -1,117 +1,107 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<sx:head />
|
||||
<s:head theme="ajax"/>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
dojo.event.topic.subscribe("/beforeSubmit", function(event, widget) {
|
||||
alert('you can manipulate the form before it gets submitted. To cancel the submit event set event.cancel=true');
|
||||
event.cancel = true;
|
||||
});
|
||||
function doSomething() {
|
||||
alert('you can manipulate the form before it gets submitted');
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
|
||||
|
||||
|
||||
<br /><br />
|
||||
Remote form replacing another div:<br/>
|
||||
|
||||
<div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
|
||||
<s:form
|
||||
id='theForm2'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
method='post'
|
||||
theme="ajax">
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO2" targets="two"/>
|
||||
<s:submit value="GO2" theme="ajax" targets="two"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
|
||||
Remote form replacing the forms content:<br/>
|
||||
<s:form
|
||||
id='theForm3'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
method='post'
|
||||
theme="ajax">
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO3" targets="theForm3"/>
|
||||
<s:submit value="GO3" theme="ajax" targets="theForm3"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
Remote form evaluating suplied JS on completion:<br/>
|
||||
<s:form
|
||||
id='theForm4'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='Test3'
|
||||
method='post'>
|
||||
action='AjaxRemoteForm'
|
||||
method='post'
|
||||
theme="ajax">
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO4" executeScripts="true"/>
|
||||
<s:submit value="GO4" theme="ajax"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
Submit outside form:<br/>
|
||||
Remote form replacing the forms content after confirming results:<br/>
|
||||
<s:form
|
||||
id='theForm5'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
method='post'
|
||||
theme="ajax">
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
</s:form>
|
||||
<sx:submit value="GO5" formId="theForm5" targets="two"/>
|
||||
|
||||
<br /><br />
|
||||
<s:url var="remoteUrl" namespace="/remoteforms" action="AjaxRemoteForm"/>
|
||||
Submit outside form, href in submit tag:<br/>
|
||||
<s:submit value="GO3" theme="ajax" targets="theForm5" />
|
||||
|
||||
</s:form>
|
||||
|
||||
Remote form replacing the forms content after running a function:<br/>
|
||||
<s:form
|
||||
id='theForm6'
|
||||
cssStyle="border: 1px solid green;"
|
||||
method='post'>
|
||||
action='AjaxRemoteForm'
|
||||
method='post'
|
||||
theme="ajax">
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
</s:form>
|
||||
<sx:submit value="GO6" formId="theForm6" targets="two" href="%{#remoteUrl}"/>
|
||||
|
||||
<br /><br />
|
||||
Remote form whose submit is cancelled:<br/>
|
||||
<s:submit value="GO3" theme="ajax" targets="theForm6" />
|
||||
|
||||
</s:form>
|
||||
|
||||
A form with no remote submit (so should not be ajaxified):<br/>
|
||||
<s:form
|
||||
id='theForm7'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
method='post'
|
||||
theme="ajax">
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO7" targets="theForm7" beforeNotifyTopics="/beforeSubmit"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
A form with no remote submit (so should not be ajaxified):<br/>
|
||||
<s:form
|
||||
id='theForm8'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<s:submit value="Go AWAY" />
|
||||
<s:submit value="Go AWAY" targets="theForm7" />
|
||||
|
||||
</s:form>
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<s:head theme="ajax"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<s:form name="test1" id="test1" action="/ajax/Test1.action" theme="ajax">
|
||||
Test 1 Form
|
||||
<s:submit theme="ajax" targets="result2"/>
|
||||
</s:form>
|
||||
|
||||
<s:div id="result2" theme="ajax" >test2 - before</s:div>
|
||||
|
||||
<s:div id="result3" theme="ajax">test3 - before</s:div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<s:form name="test2" id="test2" action="/ajax/Test2.action" theme="ajax">
|
||||
Test 2 form
|
||||
<s:submit theme="ajax" targets="result3"/>
|
||||
</s:form>
|
||||
@@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
Test 3 Page
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,5 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
@@ -14,30 +13,10 @@
|
||||
dojo.byId(widget.targetsArray[0]).innerHTML = "Done";
|
||||
}
|
||||
|
||||
dojo.event.topic.subscribe("/before", function(event, widget){
|
||||
alert('inside a topic event. before request');
|
||||
//event: set event.cancel = true, to cancel request
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, request, widget){
|
||||
alert('inside a topic event. after request');
|
||||
//data : text returned from request
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/error", function(error, request, widget){
|
||||
alert('inside a topic event. on error');
|
||||
//error : error object (error.message has the error message)
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/topics", function(data, type, e){
|
||||
dojo.event.topic.subscribe("/after", function(data, type, e){
|
||||
alert('inside a topic event. type='+type);
|
||||
//data : text returned
|
||||
//type : "before", "load", "error"
|
||||
//type : "before", "load" or "error"
|
||||
//e : request object
|
||||
});
|
||||
</script>
|
||||
@@ -52,54 +31,49 @@
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url var="test3" value="/Test3.action" />
|
||||
|
||||
<sx:a id="link0"
|
||||
href="%{#ajaxTest}"
|
||||
targets="t1"
|
||||
highlightColor="red"
|
||||
highlightDuration="2000">Update 'Div 1' and use red highligh to notify user of changed content</sx:a>
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="test3" value="/Test3.action" />
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link1"
|
||||
href="%{#ajaxTest}"
|
||||
<s:a
|
||||
theme="ajax"
|
||||
href="%{ajaxTest}"
|
||||
indicator="indicator"
|
||||
targets="t1,t2"
|
||||
beforeNotifyTopics="/before"
|
||||
afterNotifyTopics="/after" >Update 'Div 1' and 'Div 2', publish topic '/before' and '/after', use indicator</sx:a>
|
||||
targets="t1,t2" notifyTopics="/after" >Update 'Div 1' and 'Div 2', publish topic '/after', use indicator</s:a>
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link2"
|
||||
<s:a id="link2"
|
||||
theme="ajax"
|
||||
href="/AjaxNoUrl.jsp"
|
||||
errorText="Error Loading"
|
||||
targets="t1"
|
||||
errorNotifyTopics="/error">Try to update 'Div 1', publish '/error', use custom error message</sx:a>
|
||||
targets="t1">Try to update 'Div 1', use custom error message</s:a>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link3"
|
||||
href="%{#ajaxTest}"
|
||||
<s:a id="link3"
|
||||
theme="ajax"
|
||||
href="%{ajaxTest}"
|
||||
loadingText="Loading!!!"
|
||||
showLoadingText="true"
|
||||
targets="t1">Update 'Div 1', use custom loading message</sx:a>
|
||||
targets="t1">Update 'Div 1', use custom loading message</s:a>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link4"
|
||||
href="%{#test3}"
|
||||
<s:a id="link4"
|
||||
theme="ajax"
|
||||
href="%{test3}"
|
||||
executeScripts="true"
|
||||
targets="t2">Update 'Div 2' and execute returned javascript </sx:a>
|
||||
targets="t2">Update 'Div 2' and execute returned javascript </s:a>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link5"
|
||||
href="%{#ajaxTest}"
|
||||
<s:a id="link5"
|
||||
theme="ajax"
|
||||
href="%{ajaxTest}"
|
||||
handler="handler"
|
||||
targets="t2">Update 'Div 2' using a custom handler </sx:a>
|
||||
targets="t2">Update 'Div 2' using a custom handler </s:a>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
@@ -112,11 +86,12 @@
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link6"
|
||||
href="%{#ajaxTest}"
|
||||
<s:a id="link6"
|
||||
theme="ajax"
|
||||
href="%{ajaxTest}"
|
||||
targets="t2"
|
||||
formId="form"
|
||||
>Update 'Div 2' with the content of the textbox </sx:a>
|
||||
>Update 'Div 2' with the content of the textbox </s:a>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
|
||||
@@ -1,89 +1,109 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyCorners.css"/>">
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyPrint.css"/>" media="print">
|
||||
<script type="text/javascript" src="<s:url value="/struts/niftycorners/nifty.js"/>"></script>
|
||||
<script type="text/javascript">
|
||||
dojo.event.connect(window, "onload", function() {
|
||||
if (!NiftyCheck())
|
||||
return;
|
||||
Rounded("li.tab_selected", "top", "white", "transparent", "border #ffffffS");
|
||||
Rounded("li.tab_unselected", "top", "white", "transparent", "border #ffffffS");
|
||||
// Rounded("div#tab_header_main li","top","white","transparent","border #ffffffS");
|
||||
// "white" needs to be replaced with the background color
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<body>
|
||||
|
||||
<table cellpadding="0" cellspacing="10" border="0" width="900">
|
||||
<table cellpadding="0" cellspacing="10" border="0" width="600">
|
||||
<tr>
|
||||
<td align="top" width="400">
|
||||
<sx:tabbedpanel id="test" >
|
||||
<sx:div id="one" label="one" >
|
||||
<td align="top">
|
||||
<s:tabbedPanel id="test" >
|
||||
<s:div id="one" label="one" theme="ajax">
|
||||
This is the first pane<br/>
|
||||
<s:form>
|
||||
<s:textfield name="tt" label="Test Text"/> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2"/>
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div id="two" label="two" >
|
||||
</s:div>
|
||||
<s:div id="two" label="two" theme="ajax">
|
||||
This is the second panel
|
||||
</sx:div>
|
||||
<sx:div id="three" label="three" >
|
||||
</s:div>
|
||||
<s:div id="three" label="three" theme="ajax">
|
||||
This is the three
|
||||
</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
</s:div>
|
||||
</s:tabbedPanel>
|
||||
</td>
|
||||
<td align="top">
|
||||
<sx:tabbedpanel id="test2" >
|
||||
<sx:div id="left" label="left" >
|
||||
<s:tabbedPanel id="test2" >
|
||||
<s:div id="left" label="left" theme="ajax">
|
||||
This is the left pane<br/>
|
||||
<s:form>
|
||||
<s:textfield name="tt" label="Test Text"/> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2"/>
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh1"
|
||||
label="remote one"></sx:div>
|
||||
<sx:div id="middle" label="middle" >
|
||||
</s:div>
|
||||
<s:div href="%{ajaxTest}" id="ryh1" theme="ajax"
|
||||
label="remote one"></s:div>
|
||||
<s:div id="middle" label="middle" theme="ajax">
|
||||
middle tab<br/>
|
||||
<s:form>
|
||||
<s:textfield name="tt" label="Test Text44"/> <br/>
|
||||
<s:textfield name="tt2" label="Test Text442"/>
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh21" label="remote right"/>
|
||||
</sx:tabbedpanel>
|
||||
</s:div>
|
||||
<s:div href="%{ajaxTest}" id="ryh21" theme="ajax" label="remote right"/>
|
||||
</s:tabbedPanel>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="top">
|
||||
<sx:tabbedpanel id="testremote">
|
||||
<sx:div href="%{ajaxTest}" id="r1" label="remote one">
|
||||
<s:tabbedPanel id="testremote">
|
||||
<s:div href="%{ajaxTest}" id="r1" theme="ajax" label="remote one">
|
||||
<s:action name="AjaxTest" executeResult="true" />
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="r2" label="remote two"></sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="r3" label="remote three"></sx:div>
|
||||
</sx:tabbedpanel>
|
||||
</s:div>
|
||||
<s:div href="%{ajaxTest}" id="r2" theme="ajax" label="remote two"></s:div>
|
||||
<s:div href="%{ajaxTest}" id="r3" theme="ajax" label="remote three"></s:div>
|
||||
</s:tabbedPanel>
|
||||
</td>
|
||||
<td align="top">
|
||||
<sx:tabbedpanel id="test3" >
|
||||
<sx:tabbedpanel id="test11" label="Container 1">
|
||||
<sx:div id="i11" label="inner 1 one">Inner 1</sx:div>
|
||||
<sx:div id="112" label="inner 1 two">Inner 2</sx:div>
|
||||
<sx:div id="i13" label="inner 1 three">Inner 3</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<sx:tabbedpanel id="test12" label="Container 2">
|
||||
<sx:div id="i21" label="inner 2 one" >Inner 21</sx:div>
|
||||
<sx:div id="122" label="inner 2 two" >Inner 22</sx:div>
|
||||
<sx:div id="i23" label="inner 2 three" >Inner 23</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<sx:tabbedpanel id="test13" label="Container 3">
|
||||
<sx:div id="i31" label="inner 3 one" >Inner 31</sx:div>
|
||||
<sx:div id="132" label="inner 3 two" >Inner 32</sx:div>
|
||||
<sx:div id="i33" label="inner 3 three" >Inner 33</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
</sx:tabbedpanel>
|
||||
<s:tabbedPanel id="test3" >
|
||||
<s:div id="left1" label="out one" theme="ajax">
|
||||
Outer one<br/>
|
||||
<s:tabbedPanel id="test11">
|
||||
<s:div id="i11" label="inner 1 one">Inner 1</s:div>
|
||||
<s:div id="112" label="inner 1 two">Inner 2</s:div>
|
||||
<s:div id="i13" label="inner 1 three">Inner 3</s:div>
|
||||
</s:tabbedPanel>
|
||||
</s:div>
|
||||
<s:div id="middle1" label="out two" theme="ajax">
|
||||
Outer two<br/>
|
||||
<s:tabbedPanel id="test12" >
|
||||
<s:div id="i21" label="inner 2 one" theme="ajax">Inner 21</s:div>
|
||||
<s:div id="122" label="inner 2 two" theme="ajax">Inner 22</s:div>
|
||||
<s:div id="i23" label="inner 2 three" theme="ajax">Inner 23</s:div>
|
||||
</s:tabbedPanel>
|
||||
</s:div>
|
||||
<s:div id="right1" label="out three" theme="ajax">
|
||||
Outer three<br/>
|
||||
<s:tabbedPanel id="test13">
|
||||
<s:div id="i31" label="inner 3 one" theme="ajax">Inner 31</s:div>
|
||||
<s:div id="132" label="inner 3 two" theme="ajax">Inner 32</s:div>
|
||||
<s:div id="i33" label="inner 3 three" theme="ajax">Inner 33</s:div>
|
||||
</s:tabbedPanel>
|
||||
</s:div>
|
||||
</s:tabbedPanel>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div id="left" label="test1" >
|
||||
<s:tabbedPanel id="test2" theme="simple" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<s:div id="left" label="test1" theme="ajax" >
|
||||
I'm a Tab!!!
|
||||
</sx:div >
|
||||
<sx:div id="middle" label="test2" >
|
||||
</s:div >
|
||||
<s:div id="middle" label="test2" theme="ajax" >
|
||||
I'm the other Tab!!!
|
||||
</sx:div >
|
||||
</s:div >
|
||||
|
||||
</sx:tabbedpanel>
|
||||
</s:tabbedPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyCorners.css"/>">
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyPrint.css"/>" media="print">
|
||||
<script type="text/javascript" src="<s:url value="/struts/niftycorners/nifty.js"/>"></script>
|
||||
<script type="text/javascript">
|
||||
dojo.event.connect(window, "onload", function() {
|
||||
if (!NiftyCheck())
|
||||
return;
|
||||
Rounded("li.tab_selected", "top", "white", "transparent", "border #ffffffS");
|
||||
Rounded("li.tab_unselected", "top", "white", "transparent", "border #ffffffS");
|
||||
// Rounded("div#tab_header_main li","top","white","transparent","border #ffffffS");
|
||||
// "white" needs to be replaced with the background color
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url id="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<body>
|
||||
|
||||
@@ -17,24 +30,24 @@
|
||||
<tr>
|
||||
<td align="top">
|
||||
<!--// START SNIPPET: tabbedpanel-tag-->
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div id="left" label="left">
|
||||
<s:tabbedPanel id="test2" theme="simple" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<s:div theme="ajax" id="left" label="left">
|
||||
This is the left pane<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2" />
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh1" label="remote one" preload="false"/>
|
||||
<sx:div id="middle" label="middle">
|
||||
</s:div>
|
||||
<s:div theme="ajax" href="%{ajaxTest}" id="ryh1" label="remote one" />
|
||||
<s:div theme="ajax" id="middle" label="middle">
|
||||
middle tab<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text44" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text442" />
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh21" label="remote right" preload="false"/>
|
||||
</sx:tabbedpanel>
|
||||
</s:div>
|
||||
<s:div theme="ajax" href="%{ajaxTest}" id="ryh21" label="remote right" />
|
||||
</s:tabbedPanel>
|
||||
<!--// END SNIPPET: tabbedpanel-tag-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,57 +1,20 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
<title>Example 4</title>
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>" />
|
||||
</head>
|
||||
|
||||
<script>
|
||||
function enableTab(id) {
|
||||
var tabContainer = dojo.widget.byId('tabContainer');
|
||||
tabContainer.enableTab(id);
|
||||
}
|
||||
|
||||
function disableTab(index) {
|
||||
var tabContainer = dojo.widget.byId('tabContainer');
|
||||
tabContainer.disableTab(index);
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel id="tabContainer" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div id="tab1" label="test1" >
|
||||
Enabled Tab
|
||||
</sx:div >
|
||||
<sx:div id="tab2" label="test2" disabled="true" >
|
||||
Diabled Tab
|
||||
</sx:div >
|
||||
<sx:div id="tab3" label="test2" >
|
||||
Some other Tab
|
||||
</sx:div >
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<br />
|
||||
|
||||
<input type="button" onclick="enableTab(1)" value="Enable Tab 2 using Index" />
|
||||
<input type="button" onclick="disableTab(1)" value="Disable Tab 2 using Index" />
|
||||
|
||||
<br />
|
||||
|
||||
<input type="button" onclick="enableTab('tab2')" value="Enable Tab 2 using Id" />
|
||||
<input type="button" onclick="disableTab('tab2')" value="Disable Tab 2 using Id" />
|
||||
|
||||
<br />
|
||||
|
||||
<input type="button" onclick="enableTab(dojo.widget.byId('tab2'))" value="Enable Tab 2 using widget" />
|
||||
<input type="button" onclick="disableTab(dojo.widget.byId('tab2'))" value="Disable Tab 2 using widget" />
|
||||
|
||||
<br /> <br />
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
<s:url id="panel1url" action="panel1" namespace="/nodecorate" />
|
||||
<s:url id="panel2url" action="panel2" namespace="/nodecorate" />
|
||||
<s:url id="panel3url" action="panel3" namespace="/nodecorate" />
|
||||
<s:tabbedPanel id="tabbedpanel" >
|
||||
<s:div id="panel1" label="Panel1" href="%{#panel1url}" theme="ajax" />
|
||||
<s:div id="panel2" label="Panel2" href="%{#panel2url}" theme="ajax" />
|
||||
<s:div id="panel3" label="Panel3" href="%{#panel3url}" theme="ajax" />
|
||||
</s:tabbedPanel>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true" labelposition="bottom">
|
||||
<sx:div id="left" label="test1" closable="true">
|
||||
<s:tabbedPanel id="test2" theme="simple" cssStyle="width: 500px; height: 300px;" doLayout="true" closeButton="pane" labelposition="bottom">
|
||||
<s:div id="left" label="test1" theme="ajax" >
|
||||
I'm a Tab!!!
|
||||
</sx:div >
|
||||
<sx:div id="middle" label="test2" closable="true">
|
||||
</s:div >
|
||||
<s:div id="middle" label="test2" theme="ajax" >
|
||||
I'm the other Tab!!!
|
||||
</sx:div >
|
||||
</s:div >
|
||||
|
||||
</sx:tabbedpanel>
|
||||
</s:tabbedPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script>
|
||||
dojo.event.topic.subscribe('/before', function(event, tab, tabContainer) {
|
||||
alert("Before selecting tab. Set 'event.cancel=true' to prevent selection");
|
||||
});
|
||||
dojo.event.topic.subscribe('/after', function(tab, tabContainer) {
|
||||
alert("After tab was selected");
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel
|
||||
id="tabContainer"
|
||||
cssStyle="width: 500px; height: 300px;"
|
||||
doLayout="true"
|
||||
beforeSelectTabNotifyTopics="/before"
|
||||
afterSelectTabNotifyTopics="/after">
|
||||
<sx:div id="tab1" label="test1" >
|
||||
Tab 1
|
||||
</sx:div >
|
||||
<sx:div id="tab2" label="test2" >
|
||||
Tab 2
|
||||
</sx:div >
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<br /><br />
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -12,11 +12,10 @@
|
||||
<p>
|
||||
<ol>
|
||||
<li><a href="example2.jsp">A local tabbed panel width fixed size (doLayout="true")</a></li>
|
||||
<li><a href="example4.jsp">A Local tabbed panel with disabled tabs</a></li>
|
||||
<li><a href="example6.jsp">A Local tabbed panel that publishes topics when tabs are selected(before and after)</a></li>
|
||||
<li><a href="example3.jsp">A remote (href != "") and local tabbed panel</a></li>
|
||||
<li><a href="example1.jsp">Various remote and local tabbed panels (with enclosed tabbed pannels) with layout (doLayout="false")</a></li>
|
||||
<li><a href="example5.jsp">A local tabbed panel width fixed size (doLayout="true") with close button on the tab pane (closable="true" on tabs), and tabs on the bottom (labelposition="bottom")</a></li>
|
||||
<li><a href="example4.jsp">A local tabbed panel width fixed size (doLayout="true") with close button on tabs(closeButton="tab"), and tabs on the right (labelposition="right")</a></li>
|
||||
<li><a href="example5.jsp">A local tabbed panel width fixed size (doLayout="true") with close button on the tab pane (closeButton="pane"), and tabs on the bottom (labelposition="bottom")</a></li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
<div id="result">
|
||||
</div>
|
||||
<@sx.form action="panel2Submit" namespace="/nodecorate">
|
||||
<@s.textfield label="Name" name="name" />
|
||||
<@sx.submit targets="result" />
|
||||
</@sx.form>
|
||||
<@s.form action="panel2Submit" namespace="/nodecorate" theme="ajax">
|
||||
<@s.textfield label="Name" name="name" theme="ajax" />
|
||||
<@s.submit theme="ajax" resultDivId="result" />
|
||||
</@s.form>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div id="result">
|
||||
</div>
|
||||
|
||||
<@s.form action="panel3Submit" namespace="/nodecorate">
|
||||
<@sx.autocompleter label="Gender" name="gender" list="%{#{'Male':'Male','Female':'Female'}}" />
|
||||
<@sx.submit targets="result" />
|
||||
<@s.form action="panel3Submit" namespace="/nodecorate" theme="ajax">
|
||||
<@s.select label="Gender" name="gender" list=r"%{#{'Male':'Male','Female':'Female'}}" theme="ajax" />
|
||||
<@s.submit theme="ajax" resultDivId="result" />
|
||||
</@s.form>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<s:iterator value="category.children">
|
||||
<li>
|
||||
<s:if test="children.size() > 0">
|
||||
<sx:a href="toggle.action?catId=%{id}">+</sx:a>
|
||||
<s:a theme="ajax" href="toggle.action?catId=%{id}">+</s:a>
|
||||
</s:if>
|
||||
<s:property value="name"/>
|
||||
</li>
|
||||
@@ -15,7 +15,8 @@
|
||||
<s:set name="display" value="''"/>
|
||||
</s:else> ›
|
||||
|
||||
<sx:div id="children_%{id}"
|
||||
<s:div theme="ajax"
|
||||
id="children_%{id}"
|
||||
cssStyle="display: %{display}"
|
||||
href="getCategory.action?catId=%{id}"
|
||||
refreshListenTopic="children_%{id}"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Tree</title>
|
||||
<sx:head />
|
||||
<s:head theme="ajax"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Showcase - Chat - Login</title>
|
||||
<@s.head />
|
||||
<@s.head theme="ajax" />
|
||||
</head>
|
||||
<body>
|
||||
<@s.actionerror />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Showcase - Chat - Room Selection</title>
|
||||
<@sx.head />
|
||||
<@s.head theme="ajax" />
|
||||
<style type="text/css">
|
||||
div.box {
|
||||
border: 1px solid darkblue;
|
||||
@@ -128,11 +128,11 @@
|
||||
<div class="box">
|
||||
<h3>Users Available In Chat</h3>
|
||||
<@s.url id="usersAvailableUrl" action="usersAvailable" namespace="/chat/ajax" />
|
||||
<@sx.div id="usersAvailable" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"
|
||||
href="%{usersAvailableUrl}"
|
||||
class="box">
|
||||
<@s.div id="usersAvailable" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"
|
||||
theme="ajax" href="%{usersAvailableUrl}"
|
||||
class="box">
|
||||
Initial Loading Users ...
|
||||
</@sx.div>
|
||||
</@s.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -141,20 +141,20 @@
|
||||
<div class="box">
|
||||
<h3>Rooms Available In Chat</h3>
|
||||
<@s.url id="roomsAvailableUrl" action="roomsAvailable" namespace="/chat/ajax" />
|
||||
<@sx.div id="roomsAvailable" listenTopics="topicRoomCreated"
|
||||
updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"
|
||||
href="%{roomsAvailableUrl}" >
|
||||
<@s.div id="roomsAvailable" listenTopics="topicRoomCreated"
|
||||
delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"
|
||||
theme="ajax" href="%{roomsAvailableUrl}" >
|
||||
Initial Loading Rooms ...
|
||||
</@sx.div>
|
||||
</@s.div>
|
||||
</div>
|
||||
|
||||
<div id="createRoom" class="box">
|
||||
<h3>Create Room In Chat</h3>
|
||||
<div id="createRoomResult"></div>
|
||||
<@s.form id="createRoomId" action="createRoom" namespace="/chat/ajax" method="POST">
|
||||
<@s.form id="createRoomId" action="createRoom" namespace="/chat/ajax" method="POST" theme="ajax">
|
||||
<@s.textfield label="Room Name" required="true" name="name" />
|
||||
<@s.textarea theme="xhtml" label="Room Description" required="true" name="Description" />
|
||||
<@sx.submit value="%{'Create Room'}" targets="createRoomResult" afterNotifyTopics="topicRoomCreated" align="left" />
|
||||
<@s.submit value="%{'Create Room'}" resultDivId="createRoomResult" notifyTopics="topicRoomCreated" theme="ajax" align="left" />
|
||||
</@s.form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Showcase - Chat - Show Room </title>
|
||||
<@sx.head />
|
||||
<@s.head theme="ajax" />
|
||||
<style type="text/css">
|
||||
div.box {
|
||||
border: 1px solid darkblue;
|
||||
@@ -109,10 +109,10 @@
|
||||
<div class="box">
|
||||
<h3>Users Available In Chat</h3>
|
||||
<@s.url id="usersAvailableUrl" action="usersAvailable" namespace="/chat/ajax" />
|
||||
<@sx.div id="usersAvailable" href="%{usersAvailableUrl}"
|
||||
updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}">
|
||||
<@s.div id="usersAvailable" href="%{usersAvailableUrl}"
|
||||
theme="ajax" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}">
|
||||
Initial Users Available ...
|
||||
</@sx.div>
|
||||
</@s.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -122,20 +122,20 @@
|
||||
<@s.url id="url" value="/chat/ajax/messagesAvailableInRoom.action" includeContext="true">
|
||||
<@s.param name="roomName" value="%{roomName}" />
|
||||
</@s.url>
|
||||
<@sx.div id="messagesInRoom" href="%{#url}" includeContext="true"
|
||||
updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"
|
||||
<@s.div id="messagesInRoom" href="%{#url}" includeContext="true"
|
||||
theme="ajax" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"
|
||||
listenTopics="topicMessageSend">
|
||||
Initial Messages In Room ...
|
||||
</@sx.div>
|
||||
</@s.div>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3>Send Messages</h3>
|
||||
<@s.form id="sendMessageForm" action="sendMessageToRoom" namespace="/chat/ajax" method="POST">
|
||||
<@s.form id="sendMessageForm" action="sendMessageToRoom" namespace="/chat/ajax" method="POST" theme="ajax">
|
||||
<div id="sendMessageResult"></div>
|
||||
<@s.textarea label="Message"name="message" theme="xhtml" />
|
||||
<@s.hidden name="roomName" value="%{roomName}" />
|
||||
<@sx.submit id="submit" resultDivId="sendMessageResult" afterNotifyTopics="topicMessageSend" value="%{'Send'}" />
|
||||
<@s.submit id="submit" theme="ajax" resultDivId="sendMessageResult" notifyTopics="topicMessageSend" value="%{'Send'}" />
|
||||
</@s.form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,10 +147,10 @@
|
||||
<@s.url id="url" value="/chat/ajax/usersAvailableInRoom.action" includeContext="true">
|
||||
<@s.param name="roomName" value="%{roomName}" />
|
||||
</@s.url>
|
||||
<@sx.div id="usersAvailableInRoom" href="%{#url}" includeContext="true"
|
||||
delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}">
|
||||
<@s.div id="usersAvailableInRoom" href="%{#url}" includeContext="true"
|
||||
theme="ajax" delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}">
|
||||
Initial Users Available In Room ...
|
||||
</@sx.div>
|
||||
</@s.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<!-- START SNIPPET: example -->
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<#list actionMessages as msg>
|
||||
${msg}
|
||||
</#list>
|
||||
|
||||
<@s.form action="guess" method="post">
|
||||
<@s.textfield label="Guess" name="guess"/>
|
||||
<@s.submit value="Guess"/>
|
||||
</@s.form>
|
||||
</body>
|
||||
</html>
|
||||
<!-- END SNIPPET: example -->
|
||||
@@ -14,9 +14,9 @@ An example populating a Set of object (Address.java) into Struts' action (Addres
|
||||
|
||||
<p/>
|
||||
|
||||
See the jsp code <s:url var="url" action="showAddressJspCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for PersonAction.java <s:url var="url" action="showAddressActionJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for Person.java <s:url var="url" action="showAddressJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the jsp code <s:url id="url" action="showAddressJspCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for PersonAction.java <s:url id="url" action="showAddressActionJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for Person.java <s:url id="url" action="showAddressJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
|
||||
<p/>
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
See the jsp code <s:url var="url" action="showEnumJspCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for OperationsEnum.java <s:url var="url" action="showOperationsEnumJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for OperationsEnumAction.java <s:url var="url" action="showOperationEnumActionJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for EnumTypeConverter.java <s:url var="url" action="showEnumTypeConverterJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the properties for OperationsEnumAction-conversion.properties <s:url var="url" action="showOperationsEnumActionConversionProperties" namespace="/conversion" /><s:a href="%{#url}">here.</s:a>
|
||||
See the jsp code <s:url id="url" action="showEnumJspCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for OperationsEnum.java <s:url id="url" action="showOperationsEnumJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for OperationsEnumAction.java <s:url id="url" action="showOperationEnumActionJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for EnumTypeConverter.java <s:url id="url" action="showEnumTypeConverterJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the properties for OperationsEnumAction-conversion.properties <s:url id="url" action="showOperationsEnumActionConversionProperties" namespace="/conversion" /><s:a href="%{#url}">here.</s:a>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ An example populating a list of object (Person.java) into Struts' action (Person
|
||||
|
||||
<p/>
|
||||
|
||||
See the jsp code <s:url var="url" action="showPersonJspCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for PersonAction.java <s:url var="url" action="showPersonActionJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for Person.java <s:url var="url" action="showPersonJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the jsp code <s:url id="url" action="showPersonJspCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for PersonAction.java <s:url id="url" action="showPersonActionJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
See the code for Person.java <s:url id="url" action="showPersonJavaCode" namespace="/conversion" /><s:a href="%{#url}">here.</s:a><br/>
|
||||
|
||||
<p/>
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<s:url var="url" action="enterPersonsInfo" namespace="/conversion" />
|
||||
<s:url id="url" action="enterPersonsInfo" namespace="/conversion" />
|
||||
<s:a href="%{#url}">Populate into the Struts action class a List of Person.java Object</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="enterAddressesInfo" namespace="/conversion" />
|
||||
<s:url id="url" action="enterAddressesInfo" namespace="/conversion" />
|
||||
<s:a href="%{#url}">Populate into Struts action class a Set of Address.java Object</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="enterOperationEnumInfo" namespace="/conversion" />
|
||||
<s:url id="url" action="enterOperationEnumInfo" namespace="/conversion" />
|
||||
<s:a href="%{#url}">Populate into Struts action class a List of OperationEnum.java (Java5 Enum)</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
|
||||
<s:if test="currentEmployee!=null">
|
||||
<s:text var="title" name="item.edit"><s:param><s:text name="employee"/></s:param></s:text>
|
||||
<s:text id="title" name="item.edit"><s:param><s:text name="employee"/></s:param></s:text>
|
||||
</s:if>
|
||||
<s:else>
|
||||
<s:text var="title" name="item.create"><s:param><s:text name="employee"/></s:param></s:text>
|
||||
<s:text id="title" name="item.create"><s:param><s:text name="employee"/></s:param></s:text>
|
||||
</s:else>
|
||||
<html>
|
||||
<head>
|
||||
@@ -18,13 +17,13 @@
|
||||
<body>
|
||||
<h1><s:property value="#title"/></h1>
|
||||
|
||||
<s:action var="skillAction" namespace="/skill" name="list"/>
|
||||
<s:action id="skillAction" namespace="/skill" name="list"/>
|
||||
|
||||
<s:form name="editForm" action="save">
|
||||
<s:textfield label="Employee Id" name="currentEmployee.empId"/>
|
||||
<s:textfield label="%{getText('employee.firstName')}" name="currentEmployee.firstName"/>
|
||||
<s:textfield label="%{getText('employee.lastName')}" name="currentEmployee.lastName"/>
|
||||
<sx:datetimepicker label="Birthdate" name="currentEmployee.birthDate"/>
|
||||
<s:datetimepicker label="Birthdate" name="currentEmployee.birthDate"/>
|
||||
<s:textfield label="Salary" name="currentEmployee.salary"/>
|
||||
<s:checkbox fieldValue="true" label="Married" name="currentEmployee.married"/>
|
||||
<s:combobox list="availablePositions" label="Position" name="currentEmployee.position"/>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</s:if>
|
||||
<s:else>
|
||||
<s:set name="submitType" value="'create'"/>
|
||||
<s:text var="title" name="item.create"><s:param><s:text name="skill"/></s:param></s:text>
|
||||
<s:text id="title" name="item.create"><s:param><s:text name="skill"/></s:param></s:text>
|
||||
</s:else>
|
||||
<html>
|
||||
<head><title><s:property value="#title"/></title></head>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li><s:url var="url" namespace="/skill" action="list"/><s:a href="%{url}">List available Skills</s:a></li>
|
||||
<li><s:url var="url" namespace="/skill" action="edit"/><s:a href="%{url}">Create/Edit Skill</s:a></li>
|
||||
<li><s:url var="url" namespace="/employee" action="list"/><s:a href="%{url}">List available Employees</s:a></li>
|
||||
<li><s:url var="url" namespace="/employee" action="edit"/><s:a href="%{url}">Create/Edit Employee</s:a></li>
|
||||
<li><s:url id="url" namespace="/skill" action="list"/><s:a href="%{url}">List available Skills</s:a></li>
|
||||
<li><s:url id="url" namespace="/skill" action="edit"/><s:a href="%{url}">Create/Edit Skill</s:a></li>
|
||||
<li><s:url id="url" namespace="/employee" action="list"/><s:a href="%{url}">List available Employees</s:a></li>
|
||||
<li><s:url id="url" namespace="/employee" action="edit"/><s:a href="%{url}">Create/Edit Employee</s:a></li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<s:url var="url" action="download"/><s:a href="%{url}">Download image file.</s:a>
|
||||
<s:url id="url" action="download"/><s:a href="%{url}">Download image file.</s:a>
|
||||
The browser should display the Struts logo.
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="download2"/><s:a href="%{url}">Download ZIP file.</s:a>
|
||||
<s:url id="url" action="download2"/><s:a href="%{url}">Download ZIP file.</s:a>
|
||||
The browser should prompt for a location to save the ZIP file.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<s:url var="url" action="upload" namespace="/fileupload" />
|
||||
<s:url id="url" action="upload" namespace="/fileupload" />
|
||||
<s:a href="%{#url}">Single File Upload</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="multipleUploadUsingList" namespace="/fileupload" />
|
||||
<s:url id="url" action="multipleUploadUsingList" namespace="/fileupload" />
|
||||
<s:a href="%{#url}">Multiple File Upload (List)</s:a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="multipleUploadUsingArray" namespace="/fileupload" />
|
||||
<s:url id="url" action="multipleUploadUsingArray" namespace="/fileupload" />
|
||||
<s:a href="%{#url}">Multiple File Upload (Array)</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -9,11 +9,10 @@
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<s:url var="url" action="customFreemarkerManagerDemo" namespace="/freemarker" />
|
||||
<s:url id="url" action="customFreemarkerManagerDemo" namespace="/freemarker" />
|
||||
<s:a href="%{#url}">Demo of usage of a Custom Freemarker Manager</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="standardTags" namespace="/freemarker" />
|
||||
<p/>
|
||||
<s:url id="url" action="standardTags" namespace="/freemarker" />
|
||||
<s:a href="%{#url}">Demo of Standard Struts Freemarker Tags</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Showcase - Hangman</title>
|
||||
<@sx.head />
|
||||
<@s.head theme="ajax" debug="false" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -17,13 +17,14 @@
|
||||
}
|
||||
|
||||
var _listeners = {
|
||||
guessMade: function(request, widget) {
|
||||
var sourceId = widget.widgetId;
|
||||
this.guessMadeFunc(sourceId);
|
||||
this.updateCharacterAvailable(sourceId);
|
||||
this.updateVocab(sourceId);
|
||||
this.updateScaffold(sourceId);
|
||||
this.updateGuessLeft(sourceId);
|
||||
guessMade: function(sourceId, type) {
|
||||
if(type == "before") {
|
||||
this.guessMadeFunc(sourceId);
|
||||
this.updateCharacterAvailable(sourceId);
|
||||
this.updateVocab(sourceId);
|
||||
this.updateScaffold(sourceId);
|
||||
this.updateGuessLeft(sourceId);
|
||||
}
|
||||
},
|
||||
guessMadeFunc: function(sourceId) {
|
||||
var requestAttr = { character: sourceId };
|
||||
@@ -215,11 +216,13 @@
|
||||
<@s.url id="spacerUrl" value="/hangman/images/letter-spacer.png" />
|
||||
|
||||
<@s.url id="blankUrl" value="ajax/blank.action" includeContext="false" />
|
||||
<@sx.a id="%{#currentCharacter}"
|
||||
beforeNotifyTopics="topicGuessMade"
|
||||
<@s.a theme="ajax"
|
||||
href="%{blankUrl}"
|
||||
id="%{#currentCharacter}"
|
||||
notifyTopics="topicGuessMade"
|
||||
showErrorTransportText="true">
|
||||
<img height="36" alt="" src="<@s.property value="%{#chalkboardImageUrl}" />" width="36" border="0" />
|
||||
</@sx.a>
|
||||
</@s.a>
|
||||
</@s.iterator>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<@s.head theme="ajax" debug="true" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<a href="#" id="myAnchor">click</a>
|
||||
|
||||
<script>
|
||||
var anchor = dojo.byId("myAnchor");
|
||||
alert(anchor);
|
||||
dojo.event.connect(anchor, "onclick", function(event) {
|
||||
alert('Custom onclick handler triggered before submitting form... Press OK!');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -22,11 +22,13 @@
|
||||
<@s.url id="spacerUrl" value="/hangman/images/letter-spacer.png" />
|
||||
<@s.url id="blankUrl" value="ajax/blank.action" includeContext="false" />
|
||||
|
||||
<@sx.a id="%{#currentCharacter}"
|
||||
afterNotifyTopics="topicGuessMade"
|
||||
<@s.a theme="ajax"
|
||||
id="%{#currentCharacter}"
|
||||
href="%{blankUrl}"
|
||||
notifyTopics="topicGuessMade"
|
||||
showErrorTransportText="true">
|
||||
<img height="36" alt="" src="<@s.property value="%{#chalkboardImageUrl}" />" width="36" border="0" />
|
||||
</@sx.a>
|
||||
</@s.a>
|
||||
|
||||
<#--
|
||||
<a href="#" id="<@s.property value="%{#currentCharacter}"/>" >
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
<%
|
||||
request.setAttribute("decorator", "none");
|
||||
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
|
||||
response.setHeader("Pragma","no-cache"); //HTTP 1.0
|
||||
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
|
||||
%>
|
||||
<pre style="font-style: normal;">
|
||||
<span class="kw">package</span> org.apache.struts2.showcase.action;
|
||||
|
||||
<span class="kw">import</span> java.util.Arrays;
|
||||
<span class="kw">import</span> java.util.Date;
|
||||
<span class="kw">import</span> java.util.HashMap;
|
||||
<span class="kw">import</span> java.util.List;
|
||||
<span class="kw">import</span> java.util.Map;
|
||||
|
||||
<span class="kw">import</span> com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
<span class="kw">public class</span> ExampleAction <span class="kw">extends</span> ActionSupport {
|
||||
<span class="kw">public static final</span> String CONSTANT = "Struts Rocks!";
|
||||
|
||||
<span class="kw">public static</span> Date getCurrentDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String getName() {
|
||||
return "John Galt";
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String[] getBands() {
|
||||
return new String[] { "Pink Floyd", "Metallica", "Guns & Roses" };
|
||||
}
|
||||
|
||||
<span class="kw">public</span> List<String> getMovies() {
|
||||
return Arrays.asList("Lord of the Rings", "Matrix");
|
||||
}
|
||||
|
||||
<span class="kw">public</span> Book getBook() {
|
||||
<span class="kw">return</span> new Book("Iliad", "Homer");
|
||||
}
|
||||
|
||||
<span class="kw">public</span> Map<String, Book> getBooks() {
|
||||
Map<String, Book> books = new HashMap<String, Book>();
|
||||
books.put("Iliad", new Book("Iliad", "Homer"));
|
||||
books.put("The Republic", new Book("The Replublic", "Plato"));
|
||||
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
|
||||
"Friedrich Nietzsche"));
|
||||
return books;
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">class</span> Book {
|
||||
<span class="kw">private</span> String title;
|
||||
<span class="kw">private</span> String author;
|
||||
|
||||
<span class="kw">public</span> Book(String title, String author) {
|
||||
this.title = title;
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String getTitle() {
|
||||
<span class="kw">return</span> title;
|
||||
}
|
||||
|
||||
<span class="kw">public void</span> setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
<span class="kw">public void</span> setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
@@ -1,247 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>OGNL and tags demo</title>
|
||||
<s:url var="struts" value="/struts" includeParams="none"/>
|
||||
<s:url var="jspEval" action="jspEval" namespace="/nodecorate" includeParams="none"/>
|
||||
<s:url var="viewClass" value="/interactive/example-action.jsp" includeParams="none"/>
|
||||
<s:url var="ognlBase" value="/interactive/ognl_" includeParams="none"/>
|
||||
<s:url var="jspBase" value="/interactive/jsp_" includeParams="none"/>
|
||||
|
||||
<script src="${struts}/webconsole.js"></script>
|
||||
<sx:head/>
|
||||
<script>
|
||||
var index = -1;
|
||||
var runningOgnl = true;
|
||||
var ognlBase = "${ognlBase}";
|
||||
var jspBase = "${jspBase}";
|
||||
var ognlCount = 10;
|
||||
var jspCount = 5;
|
||||
|
||||
dojo.addOnLoad(function() {
|
||||
var classSrc = dojo.byId("classSrc");
|
||||
dojo.io.updateNode(classSrc, "${viewClass}");
|
||||
dojo.html.hide("previous");
|
||||
dojo.html.hide("next");
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/reloadGuide", function() {
|
||||
next();
|
||||
});
|
||||
|
||||
function startOgnl() {
|
||||
selectOGNLTab();
|
||||
index = -1;
|
||||
runningOgnl = true;
|
||||
change(1);
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
function startJSP() {
|
||||
selectJSPTab();
|
||||
index = -1;
|
||||
runningOgnl = false;
|
||||
change(1);
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
function execOgnl(id) {
|
||||
var exp = dojo.string.trim(dojo.byId(id ? id : "example").innerHTML);
|
||||
dojo.byId("wc-command").value = exp;
|
||||
|
||||
keyEvent({keyCode : 13}, '${jspEval}');
|
||||
}
|
||||
|
||||
function execJSP(id) {
|
||||
var exp = dojo.string.trim(dojo.byId(id ? id : "example").innerHTML);
|
||||
dojo.byId("jsp").value = unscape(exp);
|
||||
|
||||
dojo.event.topic.publish("/evalJSP")
|
||||
}
|
||||
|
||||
function unscape(str) {
|
||||
return str.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, '"');
|
||||
}
|
||||
|
||||
function selectClassSrcTab() {
|
||||
dojo.widget.byId("mainTabContainer").selectTab("classTab");
|
||||
}
|
||||
|
||||
function selectJSPTab() {
|
||||
dojo.widget.byId("mainTabContainer").selectTab("jspTab");
|
||||
}
|
||||
|
||||
function selectOGNLTab() {
|
||||
dojo.widget.byId("mainTabContainer").selectTab("ognlTab");
|
||||
}
|
||||
|
||||
function change(delta) {
|
||||
index+=delta;
|
||||
|
||||
var url = (runningOgnl ? ognlBase : jspBase) + index + ".jsp";
|
||||
var bind = dojo.widget.byId("guideBind");
|
||||
bind.href = url;
|
||||
dojo.event.topic.publish("/loadContent");
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
function updateNavigation() {
|
||||
if(index <= 0) {
|
||||
dojo.html.hide("previous");
|
||||
} else {
|
||||
dojo.html.show("previous");
|
||||
}
|
||||
|
||||
var top = runningOgnl ? ognlCount : jspCount;
|
||||
|
||||
if(index == top - 1) {
|
||||
dojo.html.hide("next");
|
||||
} else {
|
||||
dojo.html.show("next");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="">
|
||||
.wc-results {
|
||||
overflow: auto;
|
||||
margin: 0px;
|
||||
padding: 5px;
|
||||
font-family: courier;
|
||||
color: white;
|
||||
background-color: black;
|
||||
height: 200px;
|
||||
}
|
||||
.wc-results pre {
|
||||
display: inline;
|
||||
}
|
||||
.wc-command {
|
||||
margin: 1px 0 0 0;
|
||||
border-style: none;
|
||||
font-family: courier;
|
||||
color: white;
|
||||
background-color: black;
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
.shell {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jsp {
|
||||
border-style: solid;
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
}
|
||||
.jspResult {
|
||||
border-style: none;
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
padding: 5px;
|
||||
}
|
||||
.jspResultHeader {
|
||||
background-color: #818EBD;
|
||||
color: white;
|
||||
width: 100%;
|
||||
height: 15px;
|
||||
}
|
||||
.jspResultHeader span {
|
||||
padding: 5px;
|
||||
}
|
||||
.classSrc {
|
||||
font-family:Courier;
|
||||
font-size:11px;
|
||||
line-height:13px;
|
||||
overflow: auto;
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
.tabContainer {
|
||||
width: 1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.guideContainer {
|
||||
width: 600px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.guide {
|
||||
padding: 5px;
|
||||
}
|
||||
pre {
|
||||
font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;
|
||||
font-style: italic;
|
||||
}
|
||||
span.kw {
|
||||
color: rgb(127, 0, 85);
|
||||
font-weight: bold;;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<sx:bind id="guideBind" targets="guide" listenTopics="/loadContent"/>
|
||||
|
||||
<body>
|
||||
<sx:tabbedpanel id="mainTabContainer" cssClass="tabContainer">
|
||||
<sx:div label="OGNL Console" id="ognlTab">
|
||||
<div id="shell" class="shell">
|
||||
<form onsubmit="return false" id="wc-form">
|
||||
<div class="wc-results" id="wc-result">
|
||||
Welcome to the OGNL console!
|
||||
<br />
|
||||
:->
|
||||
</div>
|
||||
<input type="hidden" name="debug" value="command" />
|
||||
OGNL Expression <input name="expression" onkeyup="keyEvent(event, '${jspEval}')" class="wc-command" id="wc-command" type="text" />
|
||||
</form>
|
||||
</div>
|
||||
</sx:div>
|
||||
<sx:div label="JSP Console" id="jspTab">
|
||||
<table style="width: 100%" cellpadding="1">
|
||||
<tr valign="top">
|
||||
<td width="50%">
|
||||
<form theme="simple" namespace="/nodecorate" action="jspEval" method="post">
|
||||
<s:textarea cssClass="jsp" theme="simple" name="jsp" />
|
||||
<sx:submit
|
||||
value="Eval JSP Fragment"
|
||||
href="%{#jspEval}"
|
||||
targets="jspResult"
|
||||
listenTopics="/evalJSP"/>
|
||||
</form>
|
||||
</td>
|
||||
<td width="50%">
|
||||
<div class="jspResultHeader">
|
||||
<span>JSP Eval Result</span>
|
||||
</div>
|
||||
<div id="jspResult" class="jspResult">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</sx:div>
|
||||
<sx:div label="Class on top of the Value Stack" id="classTab">
|
||||
<div id="classSrc" class="classSrc">
|
||||
</div>
|
||||
</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
<br/><br/>
|
||||
<div class="guideContainer">
|
||||
<div class="jspResultHeader">
|
||||
<span>Interactive Guide</span>
|
||||
</div>
|
||||
<sx:div id="guide" listenTopics="/reloadGuide" cssClass="guide">
|
||||
<p><a href="#" onclick="startOgnl()">Start OGNL Interactive Demo</a></p>
|
||||
<p><a href="#" onclick="startJSP()">Start JSP Interactive Demo</a></p>
|
||||
</sx:div>
|
||||
<div>
|
||||
<a href="#" id="previous" onclick="change(-1)" style="float: left"><< Previous</a>
|
||||
<a href="#" id="next" onclick="change(1)" style="float: right">Next >></a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,62 +0,0 @@
|
||||
<%
|
||||
request.setAttribute("decorator", "none");
|
||||
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
|
||||
response.setHeader("Pragma","no-cache"); //HTTP 1.0
|
||||
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
|
||||
%>
|
||||
<p>
|
||||
<b>String Attributes</b>
|
||||
</p>
|
||||
<p>
|
||||
Some tag attributes are expected to be Strings in which case String literals
|
||||
can be passed as the value, like the <i>href</i> attribute in the <i>a</i> tag.
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:a href="http://struts.apache.org/" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
If the value that you want to use in one of these string literal attributes is stored on the Value Stack,
|
||||
then the <i>%{#name}</i> syntax (alternative syntax) needs to be used. Assuming there is a value
|
||||
with the name "url" stored on the stack:
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:a href="%{#url}" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
will create an anchor and use the value of "url" for the <i>href</i> attribute.
|
||||
</p>
|
||||
<p>
|
||||
<b>Value Attributes</b>
|
||||
</p>
|
||||
<p>
|
||||
Other attributes expect an object as their value(not an string literal). In these attributes you can specify
|
||||
the name of a variable stored on the Value Stack, and the tag will look it up and use it. Like the
|
||||
<i>value</i> attribute in the <i>property</i> tag. Assuming there is an object stored on the Value Stack with
|
||||
the name "movie", then:
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:property value="movie" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
will print the value to the page. To pass an String literal to an attribute that expects a value use the <i>%{'string'}</i>
|
||||
notation.
|
||||
</p>
|
||||
<p>
|
||||
If you don't remember if an attribute expects an string literal or a value, you can always use the <i>%{value}</i> notation:
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:a href="%{'http://struts.apache.org/'}" />
|
||||
<br />
|
||||
<s:property value="%{#movie}" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/tag-syntax.html')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,52 +0,0 @@
|
||||
<%
|
||||
request.setAttribute("decorator", "none");
|
||||
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
|
||||
response.setHeader("Pragma","no-cache"); //HTTP 1.0
|
||||
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
|
||||
%>
|
||||
<p>
|
||||
<b>Print property value, using the <i>property tag</i></b>
|
||||
</p>
|
||||
<p>
|
||||
On the OGNL demo you learned how to access values from the Value Stack using OGNL expressions.
|
||||
The <i>property</i> tag is used to print to the page the result of an OGNL expression. The expression
|
||||
is specified in the <i>value</i> attribute.
|
||||
</p>
|
||||
<p>To print the value of the expression <i>name</i> to the page type:
|
||||
<p>
|
||||
<i id="example0">
|
||||
<s:property value="name" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
As you saw in the OGNL demo, to print a property of an object that is not on top of the stack,
|
||||
use the <i>#object.property</i> notation.
|
||||
</p>
|
||||
<p>To print the value for the key "struts.view_uri" in <i>request</i> to the page type:
|
||||
<p>
|
||||
<i id="example1">
|
||||
<s:property value="#request['struts.view_uri']" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<b>Print property value, using the <i>$</i> operator</b>
|
||||
</p>
|
||||
<p>Use the <i>${name}</i> notation to print values from the Value Stack to the page.
|
||||
<p>To print the value of the expression <i>name</i> to the page type:
|
||||
<p>
|
||||
<i id="example2">
|
||||
${name}
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example2')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/property.html')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,54 +0,0 @@
|
||||
<%
|
||||
request.setAttribute("decorator", "none");
|
||||
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
|
||||
response.setHeader("Pragma","no-cache"); //HTTP 1.0
|
||||
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
|
||||
%>
|
||||
<p>
|
||||
<b><i>if</i> tag</b>
|
||||
</p>
|
||||
<p>
|
||||
The <i>if</i> tag allows you to optionally execute a JSP section. Multiple <i>elseif</i> tags
|
||||
and one <i>else</i> tag can be associated to an <i>if tag</i>.
|
||||
</p>
|
||||
<p>
|
||||
To say hello to John Galt type:
|
||||
</p>
|
||||
<p>
|
||||
<pre id="example0">
|
||||
<s:if test="name == 'John Galt'">
|
||||
Hi John
|
||||
</s:if>
|
||||
<s:else>
|
||||
I don't know you!
|
||||
</s:else>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<b><i>iterator</i> tag</b>
|
||||
</p>
|
||||
<p>
|
||||
The <i>iterator</i> tag loops over an <i>Iterable</i> object one object at a time into
|
||||
the Value Stack (the value will be on top of the stack).
|
||||
</p>
|
||||
<p>
|
||||
To print the all the elements in the "bands" property type:
|
||||
</p>
|
||||
<p>
|
||||
<pre id="example1">
|
||||
<s:iterator value="bands">
|
||||
<s:property />
|
||||
<br />
|
||||
</s:iterator>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/property.html')">[More on the <i>if</i> tag]</a>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/iterator.html')">[More on the <i>iterator</i> tag]</a>
|
||||
</p>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user