Permalink
Browse files

Moved kickstart directory's contents to top level and enhanced to mat…

  • Loading branch information...
1 parent d0da28f commit 60b222be276d917294143b80a36d261b19002be4 @mraible committed Feb 2, 2012
Showing with 2,198 additions and 2,130 deletions.
  1. +13 −7 kickstart.iml
  2. +21 −3 pom.xml
  3. +0 −1 src/main/java/spring/kickstart/repository/CustomerRepositoryImpl.java
  4. +1 −1 src/main/java/spring/kickstart/web/CustomerController.java
  5. +1 −1 src/main/java/spring/kickstart/web/CustomerFormController.java
  6. +4 −4 src/main/resources/jdbc.properties
  7. +21 −5 src/main/resources/repository-config.xml
  8. +30 −19 src/main/webapp/WEB-INF/kickstart-servlet.xml
  9. +6 −9 src/main/webapp/WEB-INF/pages/customerform.jsp
  10. +3 −21 src/main/webapp/WEB-INF/pages/customers.jsp
  11. 0 src/main/webapp/{ → WEB-INF/pages}/index.jsp
  12. +31 −14 src/main/webapp/WEB-INF/web.xml
  13. +10 −0 src/main/webapp/WEB-INF/wro.xml
  14. +25 −8 src/main/webapp/decorators/default.jsp
  15. BIN src/main/webapp/{ → resources}/images/aquadot.jpg
  16. BIN src/main/webapp/{ → resources}/images/arrow_down.png
  17. BIN src/main/webapp/{ → resources}/images/arrow_off.png
  18. BIN src/main/webapp/{ → resources}/images/arrow_up.png
  19. BIN src/main/webapp/{ → resources}/images/fieldbg.gif
  20. BIN src/main/webapp/{ → resources}/images/image.gif
  21. BIN src/main/webapp/{ → resources}/images/powered-by-spring.png
  22. BIN src/main/webapp/{ → resources}/images/springforward2006.png
  23. +0 −2 src/main/webapp/{ → resources}/scripts/application.js
  24. 0 src/main/webapp/{ → resources}/scripts/calendar-setup.js
  25. 0 src/main/webapp/{ → resources}/scripts/calendar.js
  26. 0 src/main/webapp/{ → resources}/scripts/lang/calendar-en.js
  27. +2,007 −2,007 src/main/webapp/{ → resources}/scripts/prototype.js
  28. +2 −3 src/main/webapp/{ → resources}/scripts/stylesheetswitcher.js
  29. 0 src/main/webapp/{ → resources}/styles/deliciouslyblue/calendar.css
  30. +2 −2 src/main/webapp/{ → resources}/styles/deliciouslyblue/deliciouslyblue.css
  31. BIN src/main/webapp/{ → resources}/styles/deliciouslyblue/images/left.gif
  32. BIN src/main/webapp/{ → resources}/styles/deliciouslyblue/images/tableft10.gif
  33. BIN src/main/webapp/{ → resources}/styles/deliciouslyblue/images/tabright10.gif
  34. 0 src/main/webapp/{ → resources}/styles/deliciouslyblue/layout-navtop-subright.css
  35. 0 src/main/webapp/{ → resources}/styles/deliciouslyblue/layout.css
  36. 0 src/main/webapp/{ → resources}/styles/deliciouslyblue/theme.css
  37. 0 src/main/webapp/{ → resources}/styles/deliciouslyblue/tools.css
  38. 0 src/main/webapp/{ → resources}/styles/deliciouslyblue/typo.css
  39. 0 src/main/webapp/{ → resources}/styles/deliciouslygreen/calendar.css
  40. +2 −2 src/main/webapp/{ → resources}/styles/deliciouslygreen/deliciouslygreen.css
  41. BIN src/main/webapp/{ → resources}/styles/deliciouslygreen/images/tableft10.gif
  42. BIN src/main/webapp/{ → resources}/styles/deliciouslygreen/images/tabright10.gif
  43. 0 src/main/webapp/{ → resources}/styles/deliciouslygreen/layout-navtop-subright.css
  44. 0 src/main/webapp/{ → resources}/styles/deliciouslygreen/layout.css
  45. 0 src/main/webapp/{ → resources}/styles/deliciouslygreen/theme.css
  46. 0 src/main/webapp/{ → resources}/styles/deliciouslygreen/tools.css
  47. 0 src/main/webapp/{ → resources}/styles/deliciouslygreen/typo.css
  48. 0 src/main/webapp/{ → resources}/styles/displaytag.css
  49. 0 src/main/webapp/{ → resources}/styles/forms.css
  50. 0 src/main/webapp/{ → resources}/styles/messages.css
  51. +18 −18 src/test/java/spring/kickstart/web/CustomerFormControllerTest.java
  52. +1 −3 src/test/resources/repository-mock-config.xml
View
@@ -12,14 +12,14 @@
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
- <root url="file://$MODULE_DIR$/src/test/java" />
- <root url="file://$MODULE_DIR$/src/test/resources" />
+ <root url="file://$MODULE_DIR$/target/generated-sources/annotations" />
</sourceRoots>
</configuration>
</facet>
<facet type="Spring" name="Spring">
<configuration>
- <fileset id="web: application context" profiles="dev" autodetected="true" />
+ <fileset id="MVC dispatcher servlet context" profiles="" autodetected="true" />
+ <fileset id="web: application context" profiles="test" autodetected="true" />
<fileset id="web: kickstart servlet context" profiles="" autodetected="true" />
</configuration>
</facet>
@@ -35,16 +35,14 @@
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/test-annotations" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target/classes" />
- <excludeFolder url="file://$MODULE_DIR$/target/kickstart" />
- <excludeFolder url="file://$MODULE_DIR$/target/maven-archiver" />
- <excludeFolder url="file://$MODULE_DIR$/target/selenium" />
<excludeFolder url="file://$MODULE_DIR$/target/surefire" />
<excludeFolder url="file://$MODULE_DIR$/target/surefire-reports" />
<excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
<excludeFolder url="file://$MODULE_DIR$/target/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="jquery-1.7.1.min" level="application" />
<orderEntry type="library" name="Maven: org.springframework:spring-orm:3.1.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:3.1.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:3.1.0.RELEASE" level="project" />
@@ -78,12 +76,20 @@
<orderEntry type="library" name="Maven: com.lowagie:itext:1.3" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.7.0" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.13" level="project" />
- <orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:servlet-api:2.4" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.glassfish:javax.servlet:3.0" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:jstl:1.1.2" level="project" />
<orderEntry type="library" name="Maven: taglibs:standard:1.1.2" level="project" />
<orderEntry type="library" name="Maven: opensymphony:sitemesh:2.2.1" level="project" />
+ <orderEntry type="library" name="Maven: ro.isdc.wro4j:wro4j-core:1.4.3" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.0.1" level="project" />
+ <orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.8.2" level="project" />
+ <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.2" level="project" />
+ <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: jmock:jmock:1.1.0" level="project" />
+ <orderEntry type="library" name="Maven: commons-dbcp:commons-dbcp:1.4" level="project" />
+ <orderEntry type="library" name="Maven: commons-pool:commons-pool:1.5.4" level="project" />
+ <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.18" level="project" />
</component>
</module>
View
24 pom.xml
@@ -99,10 +99,12 @@
<artifactId>log4j</artifactId>
<version>1.2.13</version>
</dependency>
+ <!-- Servlet 3.0 -->
+ <!-- http://stackoverflow.com/questions/1979957/maven-dependency-for-servlet-3-0-api -->
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
+ <groupId>org.glassfish</groupId>
+ <artifactId>javax.servlet</artifactId>
+ <version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -120,6 +122,11 @@
<artifactId>sitemesh</artifactId>
<version>2.2.1</version>
</dependency>
+ <dependency>
+ <groupId>ro.isdc.wro4j</groupId>
+ <artifactId>wro4j-core</artifactId>
+ <version>1.4.3</version>
+ </dependency>
<!-- testing dependencies -->
<dependency>
@@ -135,5 +142,16 @@
<scope>test</scope>
</dependency>
+ <!-- For prod profile -->
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.18</version>
+ </dependency>
</dependencies>
</project>
@@ -5,7 +5,6 @@
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.annotation.Propagation;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
@@ -21,7 +21,7 @@
@Autowired
CustomerService customerService;
- @RequestMapping("/customers.*")
+ @RequestMapping("/customers")
public String execute(ModelMap model)
throws Exception {
log.debug("entering 'execute' method...");
@@ -72,6 +72,6 @@ public String submit(@ModelAttribute Customer customer, BindingResult errors,
}
}
- return "redirect:customers.htm";
+ return "redirect:customers";
}
}
@@ -1,4 +1,4 @@
-db.driverClassName=org.hsqldb.jdbcDriver
-db.url=jdbc:hsqldb:./db/KICKSTART
-db.userName=sa
-db.password=
+jdbc.driverClassName=com.mysql.jdbc.Driver
+jdbc.url=jdbc:mysql://localhost/kickstart?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
+jdbc.username=root
+jdbc.password=
@@ -5,9 +5,12 @@
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
- http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+ http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
<!-- Activates scanning of @Autowired -->
<context:annotation-config/>
@@ -21,7 +24,8 @@
<tx:annotation-driven/>
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <bean id="entityManagerFactory"
+ class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="spring.kickstart"/>
<property name="jpaVendorAdapter">
@@ -46,9 +50,21 @@
</jdbc:embedded-database>
</beans>
+ <beans profile="jndi">
+ <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/kickstart"/>
+ </beans>
+
<beans profile="prod">
- <jdbc:embedded-database id="dataSource">
- <jdbc:script location="classpath:schema.sql"/>
- </jdbc:embedded-database>
+ <context:property-placeholder location="classpath:jdbc.properties"/>
+ <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
+ <property name="driverClassName" value="${jdbc.driverClassName}"/>
+ <property name="url" value="${jdbc.url}"/>
+ <property name="username" value="${jdbc.username}"/>
+ <property name="password" value="${jdbc.password}"/>
+ <property name="maxActive" value="100"/>
+ <property name="maxWait" value="1000"/>
+ <property name="poolPreparedStatements" value="true"/>
+ <property name="defaultAutoCommit" value="true"/>
+ </bean>
</beans>
</beans>
@@ -1,24 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
-
+<beans:beans
+ xmlns="http://www.springframework.org/schema/mvc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+
<!-- View Resolver for JSPs -->
- <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
- <property name="prefix" value="/WEB-INF/pages/"/>
- <property name="suffix" value=".jsp"/>
- </bean>
+ <beans:bean id="viewResolver"
+ class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+ <beans:property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
+ <beans:property name="prefix" value="/WEB-INF/pages/"/>
+ <beans:property name="suffix" value=".jsp"/>
+ </beans:bean>
+
+ <beans:bean id="messageSource"
+ class="org.springframework.context.support.ResourceBundleMessageSource">
+ <beans:property name="basename" value="messages"/>
+ <beans:property name="useCodeAsDefaultMessage" value="true"/>
+ </beans:bean>
+
+ <context:component-scan base-package="spring.kickstart"/>
+
+ <!-- Enables the Spring MVC @Controller programming model -->
+ <annotation-driven/>
- <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
- <property name="basename" value="messages"/>
- <property name="useCodeAsDefaultMessage" value="true"/>
- </bean>
+ <resources mapping="/resources/**" location="/resources/"/>
- <!-- Activates mapping of @Controller -->
- <context:component-scan base-package="spring.kickstart.web"/>
+ <!-- Maps '/' requests to the 'index' view -->
+ <view-controller path="/" view-name="index"/>
- <!-- Activates @Autowired for Controllers -->
- <context:annotation-config/>
-</beans>
+</beans:beans>
@@ -62,21 +62,18 @@
</c:if>
<li class="buttonBar bottom">
<input type="submit" class="button" name="save" value="Save"/>
- <c:if test="${not empty param.id}">
- <input type="submit" class="button" name="delete" value="Delete"/>
- </c:if>
<input type="submit" class="button" name="cancel" value="Cancel" onclick="bCancel=true"/>
</li>
</ul>
</form:form>
+<c:set var="scripts" scope="request">
<script type="text/javascript">
- Form.focusFirstElement($('customer'));
- Calendar.setup(
- {
+ jQuery("#name").focus();
+ Calendar.setup({
inputField : "customerSince", // id of the input field
ifFormat : "%m/%d/%Y", // the date format
button : "cal" // id of the button
- }
- );
-</script>
+ });
+</script>
+</c:set>
@@ -4,25 +4,6 @@
<title>Customer List</title>
</head>
-<%--<table class="table">
- <thead>
- <tr>
- <th>Id</th>
- <th>Name</th>
- <th>Customer Since</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach var="customer" items="${customerList}">
- <tr>
- <td><a href="<c:url value='/customerform.htm?id=${customer.id}'/>">${customer.id}</a></td>
- <td>${customer.name}</td>
- <td><fmt:formatDate value="${customer.customerSince}" dateStyle="medium"/></td>
- </tr>
- </c:forEach>
- </tbody>
-</table>--%>
-
<button onclick="location.href='customerform.htm'" class="button" id="addCustomer"
style="float: right; margin-top: -30px; width: 100px">Add Customer</button>
@@ -37,7 +18,8 @@
<d:setProperty name="export.excel.filename" value="customers.xls"/>
</d:table>
-
+<c:set var="scripts" scope="request">
<script type="text/javascript">
highlightTableRows("customer");
-</script>
+</script>
+</c:set>
File renamed without changes.
@@ -1,47 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/repository-config.xml</param-value>
</context-param>
-
- <filter>
- <filter-name>exportFilter</filter-name>
- <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>exportFilter</filter-name>
- <servlet-name>kickstart</servlet-name>
- </filter-mapping>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
+ <filter>
+ <filter-name>wro4j</filter-name>
+ <filter-class>ro.isdc.wro.http.WroFilter</filter-class>
+ <init-param>
+ <param-name>configuration</param-name>
+ <param-value>DEPLOYMENT</param-value>
+ </init-param>
+ </filter>
+
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
-
+
+ <filter-mapping>
+ <filter-name>wro4j</filter-name>
+ <url-pattern>/assets/*</url-pattern>
+ </filter-mapping>
+
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>kickstart</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>0</load-on-startup>
+ <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>kickstart</servlet-name>
- <url-pattern>*.htm</url-pattern>
+ <url-pattern>/</url-pattern>
</servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file></welcome-file>
+ </welcome-file-list>
+
+ <jsp-config>
+ <jsp-property-group>
+ <url-pattern>*.jsp</url-pattern>
+ <trim-directive-whitespaces>true</trim-directive-whitespaces>
+ </jsp-property-group>
+ </jsp-config>
</web-app>
Oops, something went wrong.

0 comments on commit 60b222b

Please sign in to comment.