Skip to content

Commit 49ba1cf

Browse files
committed
original struts-blank project
1 parent 610b582 commit 49ba1cf

File tree

13 files changed

+525
-1
lines changed

13 files changed

+525
-1
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!/target/struts-blank.war

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target/
2+
.idea/

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM docker.io/tomcat:9.0.87-jre21-temurin-jammy
2+
COPY target/struts-blank.war /usr/local/tomcat/webapps/
3+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ How to run
77
- Run the following command.
88

99
```bash
10-
./scripts/deploy-local.sh
10+
./scripts/start.sh
1111
```
1212

1313
- Open the following URL with your browser.

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tools]
2+
maven = '3.9.9'
3+
java = 'zulu-21.40.17'

pom.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
19+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
21+
22+
<modelVersion>4.0.0</modelVersion>
23+
<groupId>org.apache.struts</groupId>
24+
<artifactId>struts-blank</artifactId>
25+
<packaging>war</packaging>
26+
<name>Struts Apps - Blank</name>
27+
<version>1.0.0</version>
28+
29+
<dependencies>
30+
<dependency>
31+
<groupId>org.apache.struts</groupId>
32+
<artifactId>struts-taglib</artifactId>
33+
<version>1.3.10</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>javax.servlet</groupId>
37+
<artifactId>servlet-api</artifactId>
38+
<version>2.3</version>
39+
<scope>provided</scope>
40+
</dependency>
41+
</dependencies>
42+
43+
<build>
44+
<finalName>${project.artifactId}</finalName>
45+
<plugins>
46+
<plugin>
47+
<groupId>org.apache.maven.plugins</groupId>
48+
<artifactId>maven-war-plugin</artifactId>
49+
<version>3.4.0</version>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
</project>

scripts/start.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
SCRIPT_DIR=$(realpath "$(dirname $BASH_SOURCE)")
6+
PROJECT_BASE_DIR=$(realpath "$SCRIPT_DIR/..")
7+
8+
APP_NAME=blank
9+
CONTAINER_NAME=springing-struts1-$APP_NAME
10+
DOCKER=$( (command -v podman &> /dev/null) && echo podman || echo docker )
11+
12+
main() {
13+
build && start
14+
}
15+
16+
build() {
17+
mvn clean package -U
18+
}
19+
20+
start() {
21+
$DOCKER build -t $CONTAINER_NAME . \
22+
&& $DOCKER rm -f $CONTAINER_NAME \
23+
&& $DOCKER run -d \
24+
-p 8080:8080 \
25+
-p 5005:5005 \
26+
--name $CONTAINER_NAME \
27+
--env DEBUG_PORT=5005 \
28+
$CONTAINER_NAME
29+
}
30+
31+
(cd "$PROJECT_BASE_DIR" \
32+
&& eval "$(mise env)" \
33+
&& main
34+
)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# -- standard errors --
17+
errors.header=<UL>
18+
errors.prefix=<LI>
19+
errors.suffix=</LI>
20+
errors.footer=</UL>
21+
# -- validator --
22+
errors.invalid={0} is invalid.
23+
errors.maxlength={0} can not be greater than {1} characters.
24+
errors.minlength={0} can not be less than {1} characters.
25+
errors.range={0} is not in the range {1} through {2}.
26+
errors.required={0} is required.
27+
errors.byte={0} must be an byte.
28+
errors.date={0} is not a date.
29+
errors.double={0} must be an double.
30+
errors.float={0} must be an float.
31+
errors.integer={0} must be an integer.
32+
errors.long={0} must be an long.
33+
errors.short={0} must be an short.
34+
errors.creditcard={0} is not a valid credit card number.
35+
errors.email={0} is an invalid e-mail address.
36+
# -- other --
37+
errors.cancel=Operation cancelled.
38+
errors.detail={0}
39+
errors.general=The process did not complete. Details should follow.
40+
errors.token=Request could not be completed. Operation is not in sequence.
41+
# -- welcome --
42+
welcome.title=Struts Blank Application
43+
welcome.heading=Welcome!
44+
welcome.message=To get started on your own application, copy the struts-blank.war to a new WAR file using the name for your application. Place it in your container's "webapp" folder (or equivalent), and let your container auto-deploy the application. Edit the skeleton configuration files as needed, restart your container, and you are on your way! (You can find the MessageResources.properties file with this message in the /WEB-INF/src folder.)
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
19+
<!DOCTYPE struts-config PUBLIC
20+
"-//Apache Software Foundation//DTD Struts Configuration 1.4//EN"
21+
"http://struts.apache.org/dtds/struts-config_1_4.dtd">
22+
23+
<!--
24+
This is a blank Struts configuration file with an example
25+
welcome action/page and other commented sample elements.
26+
27+
Struts Validator is configured using the factory defaults
28+
and is ready-to-use.
29+
30+
NOTE: If you have a generator tool to create the corresponding Java classes
31+
for you, you could include the details in the "form-bean" declarations.
32+
Otherwise, you would only define the "form-bean" element itself, with the
33+
corresponding "name" and "type" attributes, as shown here.
34+
-->
35+
36+
37+
<struts-config>
38+
39+
40+
<!-- ================================================ Form Bean Definitions -->
41+
42+
<form-beans>
43+
<!-- sample form bean descriptor for an ActionForm
44+
<form-bean
45+
name="inputForm"
46+
type="app.InputForm"/>
47+
end sample -->
48+
49+
<!-- sample form bean descriptor for a DynaActionForm
50+
<form-bean
51+
name="logonForm"
52+
type="org.apache.struts.action.DynaActionForm">
53+
<form-property
54+
name="username"
55+
type="java.lang.String"/>
56+
<form-property
57+
name="password"
58+
type="java.lang.String"/>
59+
</form-bean>
60+
end sample -->
61+
</form-beans>
62+
63+
64+
<!-- ========================================= Global Exception Definitions -->
65+
66+
<global-exceptions>
67+
<!-- sample exception handler
68+
<exception
69+
key="expired.password"
70+
type="app.ExpiredPasswordException"
71+
path="/changePassword.jsp"/>
72+
end sample -->
73+
</global-exceptions>
74+
75+
76+
<!-- =========================================== Global Forward Definitions -->
77+
78+
<global-forwards>
79+
<!-- Default forward to "Welcome" action -->
80+
<!-- Demonstrates using index.jsp to forward -->
81+
<forward
82+
name="welcome"
83+
path="/Welcome.do"/>
84+
</global-forwards>
85+
86+
87+
<!-- =========================================== Action Mapping Definitions -->
88+
89+
<action-mappings>
90+
<!-- Default "Welcome" action -->
91+
<!-- Forwards to Welcome.jsp -->
92+
<action
93+
path="/Welcome"
94+
forward="/pages/Welcome.jsp"/>
95+
96+
<!-- sample input and input submit actions
97+
98+
<action
99+
path="/Input"
100+
type="org.apache.struts.actions.ForwardAction"
101+
parameter="/pages/Input.jsp"/>
102+
103+
<action
104+
path="/InputSubmit"
105+
type="app.InputAction"
106+
name="inputForm"
107+
scope="request"
108+
validate="true"
109+
input="/pages/Input.jsp"/>
110+
111+
<action
112+
path="/edit*"
113+
type="app.Edit{1}Action"
114+
name="inputForm"
115+
scope="request"
116+
validate="true"
117+
input="/pages/Edit{1}.jsp"/>
118+
119+
end samples -->
120+
</action-mappings>
121+
122+
123+
<!-- ======================================== Message Resources Definitions -->
124+
125+
<message-resources parameter="MessageResources" />
126+
127+
128+
<!-- =============================================== Plug Ins Configuration -->
129+
130+
<!-- ======================================================= Tiles plugin -->
131+
<!--
132+
This plugin initialize Tiles definition factory. This later can takes some
133+
parameters explained here after. The plugin first read parameters from
134+
web.xml, thenoverload them with parameters defined here. All parameters
135+
are optional.
136+
The plugin should be declared in each struts-config file.
137+
- definitions-config: (optional)
138+
Specify configuration file names. There can be several comma
139+
separated file names (default: ?? )
140+
- moduleAware: (optional - struts1.1)
141+
Specify if the Tiles definition factory is module aware. If true
142+
(default), there will be one factory for each Struts module.
143+
If false, there will be one common factory for all module. In this
144+
later case, it is still needed to declare one plugin per module.
145+
The factory will be initialized with parameters found in the first
146+
initialized plugin (generally the one associated with the default
147+
module).
148+
true : One factory per module. (default)
149+
false : one single shared factory for all modules
150+
- definitions-parser-validate: (optional)
151+
Specify if xml parser should validate the Tiles configuration file.
152+
true : validate. DTD should be specified in file header (default)
153+
false : no validation
154+
155+
Paths found in Tiles definitions are relative to the main context.
156+
157+
To use this plugin, download and add the Tiles jar to your WEB-INF/lib
158+
directory then uncomment the plugin definition below.
159+
160+
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
161+
162+
<set-property property="definitions-config"
163+
value="/WEB-INF/tiles-defs.xml" />
164+
<set-property property="moduleAware" value="true" />
165+
</plug-in>
166+
-->
167+
168+
169+
<!-- =================================================== Validator plugin -->
170+
171+
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
172+
<set-property
173+
property="pathnames"
174+
value="/org/apache/struts/validator/validator-rules.xml,
175+
/WEB-INF/validation.xml"/>
176+
</plug-in>
177+
178+
</struts-config>
179+

0 commit comments

Comments
 (0)