Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
82ab40d
Struts2-TypeConversion Error handling added , but not performed.
A-pZ Dec 12, 2014
57f8e53
Struts2.3.20 update+Thymeleaf-Spring plugin support
A-pZ Dec 22, 2014
68e4e22
update thymeleaf 2.1.4
A-pZ Dec 26, 2014
51a9ac0
add Thymeleaf Spring Result.
A-pZ Jan 16, 2015
828bfb3
Loading config from struts.xml
A-pZ Feb 9, 2015
dc7ab33
Add Struts2-Spring-Diarect for Struts2-Type convetion error, <sth:field>
A-pZ Feb 9, 2015
1754653
Configulation and logging update.
A-pZ Feb 13, 2015
70ff34e
Change template engine provider loading and DI Container loading.
A-pZ Feb 16, 2015
4e89977
update plugin config.
A-pZ Feb 18, 2015
3b60eac
Request-parameter overwrite from Struts2 which cause convertion error
A-pZ Feb 26, 2015
7bbc0a8
update version 2.3.22
A-pZ Feb 26, 2015
79c5354
templateEngine property name changed.
A-pZ Mar 20, 2015
7e08d6e
update struts 2.3.23
A-pZ Apr 7, 2015
0fe2a78
correct misspelled...
A-pZ Apr 9, 2015
2233bbc
update pom.xml - Struts2.3.23-SNAPSHOT
A-pZ May 4, 2015
bd3928e
Add FieldErrorClassAttrProcessor
A-pZ May 4, 2015
f5e275d
フィールドDiarect更新。
A-pZ May 11, 2015
ed9ed1a
Merge remote-tracking branch 'origin/thymeleaf-spring' into
A-pZ May 11, 2015
69a0c82
Revert "Add FieldErrorClassAttrProcessor"
A-pZ May 11, 2015
8cf28f0
Merge remote-tracking branch 'origin/thymeleaf-spring' into thymeleaf…
A-pZ May 11, 2015
fac0c68
refactoring, guard block.
A-pZ May 12, 2015
8669fa3
change to valid Javadoc.
A-pZ May 19, 2015
2251332
Update readme.md version 2.3.24
A-pZ Jun 5, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea/
target/
.idea/
target/
*.iml
/.settings/
/.classpath
Expand Down
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,34 @@ The following reflects the default settings.
<constant name="struts.thymeleaf.suffix" value=".html"/>
<constant name="struts.thymeleaf.cacheable" value="true"/>
<constant name="struts.thymeleaf.cacheTtlMillis" value="3600000"/>
<constant name="struts.thymeleaf.templateEngineName" value="default"/>

## Version 2.3.24 - Spring support & type conversion handling

Since version 2.3.24 , this plugin provided accessibility for spring bean , and Struts2 type conversion error handling support.

### How to use Spring Bean

* use result type : thymeleaf-spring
* in html template : ${beans.[BeanName]}
* struts.properties : struts.thymeleaf.templateEngineName=spring

### Hot to use Type conversion support field.

use this namespace : sth
this diarect supported value and errorclass such as thymeleaf spring support.

Code example :

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:sth="http://serendip.thymeleaf">
...
<input name="name" type="text" value=""
sth:value="${name}" sth:errorclass="field-error-background" />
...
</html>

## License

Expand All @@ -84,4 +111,4 @@ The following reflects the default settings.
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.
limitations under the License.
6 changes: 6 additions & 0 deletions changelog.2.3.22.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ChangeLog 2.3.16.3 -> 2.3.22

* Add new result-type : "thymeleaf-spring" , usable to spring beans '${beans.(beanName)}'.
* Add new diarect for Struts2 Type convertion error output, namespace and attribute 'sth:field'.
* Add support output Struts2 'Field error' , named 'field'. An example usage ${field['task']}.

202 changes: 114 additions & 88 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,94 +1,120 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codework</groupId>
<artifactId>struts2-thymeleaf-plugin</artifactId>
<packaging>jar</packaging>
<version>2.3.16.3</version>
<name>struts2-thymeleaf-plugin</name>
<url>http://www.codework.org/struts2-thymeleaf-plugin</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<struts2.version>2.3.16.3</struts2.version>
<thymeleaf.version>2.1.3.RELEASE</thymeleaf.version>
</properties>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codework</groupId>
<artifactId>struts2-thymeleaf-plugin</artifactId>
<packaging>jar</packaging>
<version>${struts2.version}</version>
<name>struts2-thymeleaf-plugin</name>
<url>http://www.codework.org/struts2-thymeleaf-plugin</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<struts2.version>2.3.24</struts2.version>
<thymeleaf.version>2.1.4.RELEASE</thymeleaf.version>
<spring.version>4.1.6.RELEASE</spring.version>
</properties>

<repositories>
<repository>
<id>maven-org-repo</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<repositories>
<repository>
<id>maven-org-repo</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>apache.snapshots</id>
<name>ASF Maven 2 Snapshot</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>

<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
<meminitial>256m</meminitial>
<maxmem>512m</maxmem>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>2.2</version>
<configuration>
<downloadJavadocs>true</downloadJavadocs>
<downloadSources>true</downloadSources>
<jdkName>1.6</jdkName>
<jdkLevel>1.6</jdkLevel>
</configuration>
</plugin>
</plugins>
</build>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>${thymeleaf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
<meminitial>256m</meminitial>
<maxmem>512m</maxmem>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>2.2</version>
<configuration>
<downloadJavadocs>true</downloadJavadocs>
<downloadSources>true</downloadSources>
<jdkName>1.6</jdkName>
<jdkLevel>1.6</jdkLevel>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
*/
package org.codework.struts.plugins.thymeleaf;

import com.opensymphony.xwork2.LocaleProvider;
import org.thymeleaf.context.WebContext;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.thymeleaf.context.WebContext;

import com.opensymphony.xwork2.LocaleProvider;

/**
* Extends the {@link org.thymeleaf.context.WebContext} to provide access to the
* Struts action.
* <p/>
*
* For actions that implement the {@link com.opensymphony.xwork2.LocaleProvider}
* interface (i.e., actions that extend ActionSupport), the action's locale will
* be used in this context. Otherwise, the context will default to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
*/
package org.codework.struts.plugins.thymeleaf;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.inject.Inject;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsConstants;
import org.codework.struts.plugins.thymeleaf.spi.TemplateEngineProvider;
import org.thymeleaf.TemplateEngine;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.inject.Inject;

/**
* Renders a Thymeleaf template as the result of invoking a Struts action.
Expand All @@ -40,7 +41,7 @@ public class ThymeleafResult implements Result {

/**
* The result parameter name to set the name of the template to.
* <p/>
*
* IMPORTANT! Struts2 will look for this field reflectively to determine which
* parameter is the default. This allows us to have a simplified result
* configuration. Don't remove it!
Expand Down
Loading