diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
index ff31ad8f4..4f1eb84e7 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
@@ -75,6 +75,15 @@
provided
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+ test
+
+
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
index d66b06a13..8d13a8da0 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
@@ -1,13 +1,12 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
-
+
My AngularJS Struts2 App
-
- ">
+ ">
@@ -23,9 +22,11 @@
">
">
-">
-">
-">
-">
+">
+">
+">
+">
+">
+">
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/directives.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
similarity index 90%
rename from archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/directives.js
rename to archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
index 228cc9f91..6d2da17c5 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/directives.js
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
@@ -18,3 +18,9 @@
* specific language governing permissions and limitations
* under the License.
*/
+(function() {
+ 'use strict';
+
+ angular
+ .module('app', ['ngRoute']);
+})();
\ No newline at end of file
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
new file mode 100644
index 000000000..513760ca7
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
@@ -0,0 +1,40 @@
+/*
+ * $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.
+ */
+(function() {
+ 'use strict';
+
+ angular
+ .module('app')
+ .config(['$routeProvider', '$locationProvider',
+ function($routeProvider, $locationProvider) {
+
+ $locationProvider.html5Mode(true).hashPrefix('!');
+
+ $routeProvider.when('/projects', {
+ templateUrl: 'partials/projects.html',
+ controller: 'ApacheProjectsController'
+ }).when('/home', {
+ templateUrl: 'partials/home.html',
+ controller: 'HomeController'
+ }).otherwise({ redirectTo: '/home' });
+ }
+ ]);
+})();
\ No newline at end of file
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
similarity index 61%
rename from archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
rename to archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
index 07f12d773..0d05615ac 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
@@ -18,20 +18,22 @@
* specific language governing permissions and limitations
* under the License.
*/
-angularStrutsApp.controller('AppController', function ($scope) { });
+(function() {
+ 'use strict';
-angularStrutsApp.controller('HomeController', function ($scope) {
- $scope.name = "Sunshine";
-});
+ angular
+ .module('app')
+ .controller('ApacheProjectsController', ApacheProjectsController);
-angularStrutsApp.controller('ApacheProjectsController', function ($scope, $log, DataService) {
- this.init = function() {
- DataService.getProjects().then(function(data) {
- $scope.projects = data.projectNames;
- }, function() {
- $log.error('Could not receive project names.')
- });
- };
+ function ApacheProjectsController($scope, $log, DataService) {
+ this.init = function() {
+ DataService.getProjects().then(function(data) {
+ $scope.projects = data.projectNames;
+ }, function() {
+ $log.error('Could not receive project names.')
+ });
+ };
- this.init();
-});
+ this.init();
+ }
+})();
\ No newline at end of file
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
similarity index 59%
rename from archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js
rename to archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
index beefd53ed..0f1bc2d5a 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
@@ -18,20 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
+(function() {
+ 'use strict';
-var angularStrutsApp = angular.module('angularStrutsApp', ['ngRoute']);
+ angular
+ .module('app')
+ .controller('AppController', AppController);
-angularStrutsApp.config(['$routeProvider', '$locationProvider',
- function($routeProvider, $locationProvider) {
+ function AppController() {
- $locationProvider.html5Mode(true).hashPrefix('!');
-
- $routeProvider.when('/projects', {
- templateUrl: 'partials/projects.html',
- controller: 'ApacheProjectsController'
- }).when('/home', {
- templateUrl: 'partials/home.html',
- controller: 'HomeController'
- }).otherwise({ redirectTo: '/home' });
}
-]);
+})();
\ No newline at end of file
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
new file mode 100644
index 000000000..d0f23e35c
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
@@ -0,0 +1,31 @@
+/*
+ * $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.
+ */
+(function() {
+ 'use strict';
+
+ angular
+ .module('app')
+ .controller('HomeController', HomeController);
+
+ function HomeController($scope) {
+ $scope.name = "Sunshine";
+ }
+})();
\ No newline at end of file
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
deleted file mode 100644
index 10ec86749..000000000
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
+++ /dev/null
@@ -1,58 +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.
- */
-angularStrutsApp.factory('DataService', ['$http', '$log', '$q', function($http, $log, $q) {
-
- var DataService = {
- urls : {
- projects : "data/projects"
- }
- };
-
- DataService._request = function(url, method, model){
- if(!method) {
- method = 'GET';
- }
- var def = $q.defer();
- if(method === 'GET') {
- $http.get(url).success(function(data) {
- def.resolve(data);
- }).error(function(data, code) {
- def.reject(data);
- $log.error(data, code);
- });
- } else if(method === 'POST'){
- $http.post(url, model).success(function(data) {
- DataService.data = data;
- def.resolve(data);
- }).error(function(data, code) {
- def.reject(data);
- $log.error(data, code);
- });
- }
- return def.promise;
- };
-
- DataService.getProjects = function () {
- return this._request(this.urls.projects);
- };
-
- return DataService;
-}]);
\ No newline at end of file
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js
new file mode 100644
index 000000000..d2612a467
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js
@@ -0,0 +1,67 @@
+/*
+ * $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.
+ */
+(function() {
+ 'use strict';
+
+ angular
+ .module('app')
+ .factory('DataService', DataService);
+
+ function DataService($http, $log, $q) {
+
+ var DataService = {
+ urls : {
+ projects : "data/projects"
+ }
+ };
+
+ DataService._request = function(url, method, model){
+ if(!method) {
+ method = 'GET';
+ }
+ var def = $q.defer();
+ if(method === 'GET') {
+ $http.get(url).success(function(data) {
+ def.resolve(data);
+ }).error(function(data, code) {
+ def.reject(data);
+ $log.error(data, code);
+ });
+ } else if(method === 'POST'){
+ $http.post(url, model).success(function(data) {
+ DataService.data = data;
+ def.resolve(data);
+ }).error(function(data, code) {
+ def.reject(data);
+ $log.error(data, code);
+ });
+ }
+ return def.promise;
+ };
+
+ DataService.getProjects = function () {
+ return this._request(this.urls.projects);
+ };
+
+ return DataService;
+ }
+
+})();
\ No newline at end of file
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java
index 22c07661e..1c3fc2000 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java
@@ -29,6 +29,6 @@ public class IndexTest extends StrutsTestCase {
Index index = new Index();
String result = index.execute();
assertTrue("Expected a success result!", ActionSupport.SUCCESS.equals(result));
- assertTrue("Expected the 'hello' action name!!", "hello".equals(index.getRedirectName()));
+ assertTrue("Expected the 'hello' action name!!", "application".equals(index.getRedirectName()));
}
}