diff --git a/README.md b/README.md index 937c6051a..b4e04b2ca 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,29 @@ # Spring Bootstrap Showcase -The unofficial Spring MVC Showcase with Bootstrap. +The unofficial Spring MVC Showcase with Bootstrap 3 and 2. -A fork of [Spring MVC Showcase](https://github.com/SpringSource/spring-mvc-showcase), replacing JQuery-UI with [Bootstrap](http://twitter.github.com/bootstrap/), Tomcat with Jetty, Tiles with [Sitemesh](http://www.sitemesh.org/) and other goodies. +A fork of [Spring MVC Showcase](https://github.com/SpringSource/spring-mvc-showcase), replacing JQuery-UI with [Bootstrap](http://twitter.github.com/bootstrap/) versions, Tomcat with embedded Jetty, Tiles with [Sitemesh](http://www.sitemesh.org/), and other goodies. -The user-interface in this example is basic and doesn't utilize the full power of Bootstrap and Less. If you're interested in a modern, frontend development with [GulpJs](http://gulpjs.com) and a pure Bootstrap experience, checkout [Lesser](https://github.com/priyatam/lesser). +For a complex use of Spring/JQuery/Bootstrap/Ajax, see my [Spring Best Practices App](https://github.com/priyatam/spring-best-practices). -Branches: +Major Versions used: -- Spring 4.1.0 / Bootstrap 3.2 - Master -- Spring 3.2.5 / Bootstrap 3.0 - [Branch 3.X](https://github.com/priyatam/springmvc-bootstrap-showcase/tree/3.x) -- Spring 3.1.0 / Bootstrap 2.3 - [Branch 2.X](https://github.com/priyatam/springmvc-bootstrap-showcase/tree/2.x) +- Spring 3.2.5 +- Twitter Bootstrap 3.0.2 (master) +- Twitter Bootstrap 2.3.x ([Branch 2.3](https://github.com/priyatam/springmvc-twitterbootstrap-showcase/tree/2.x)) -Live Demo on Heroku. +Live Demo on Heroku (Default is Bootstrap 3) > http://spring-bootstrap.herokuapp.com/ -## Usage +Build, Run -Build and Run: - - mvn clean install - mvn jetty:run - -Preview at: - - http://localhost:8080/spring-mvc-showcase/ +1. mvn clean install +2. mvn jetty:run +3. http://localhost:8080/spring-mvc-showcase/ ## Tutorials +- [The original blog](http://blog.springsource.com/2010/07/22/spring-mvc-3-showcase/) +- A [screencast](http://s3.springsource.org/MVC/mvc-showcase-screencast.mov) showing the showcase in action +- The presentation is located in this directory (MasteringSpringMVC3.pdf) -- [Spring Best Practices](https://github.com/priyatam/spring-best-practices) -- [SpringMVC Screencast](http://s3.springsource.org/MVC/mvc-showcase-screencast.mov) showing the showcase in action - -## Status - -I'm no longer active in Java and code primarily in Nodejs and Clojure. - -If you're interested in maintaining this repo, including a port of the frontend with Backbone or [Angular](http://java.dzone.com/articles/angularjs-single-page-app), please email me. \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3090ce637..02ebe9c11 100644 --- a/pom.xml +++ b/pom.xml @@ -1,308 +1,272 @@ - 4.0.0 - priyatam - springmvc-bootstrap-showcase - spring-mvc-showcase - war - 1.0.0-BUILD-SNAPSHOT - - 1.7 - 4.1.0.RELEASE - 3.2.0.RELEASE - 1.8.1 - 1.6.1 - - - - - org.springframework - spring-context - ${org.springframework-version} - - - - commons-logging - commons-logging - - - - - org.springframework - spring-webmvc - ${org.springframework-version} - - - - org.aspectj - aspectjrt - ${org.aspectj-version} - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + org.springframework.samples + spring-mvc-showcase + spring-mvc-showcase + war + 1.0.0-BUILD-SNAPSHOT + + 1.6 + 3.2.5.RELEASE + 1.6.10 + 1.6.1 + + + + + org.springframework + spring-context + ${org.springframework-version} + + + + commons-logging + commons-logging + + + + + org.springframework + spring-webmvc + ${org.springframework-version} + + + + org.aspectj + aspectjrt + ${org.aspectj-version} + - - - org.slf4j - slf4j-api - ${org.slf4j-version} - - - org.slf4j - jcl-over-slf4j - ${org.slf4j-version} - runtime - - - org.slf4j - slf4j-log4j12 - ${org.slf4j-version} - runtime - - - log4j - log4j - 1.2.16 - runtime - + + + org.slf4j + slf4j-api + ${org.slf4j-version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j-version} + runtime + + + org.slf4j + slf4j-log4j12 + ${org.slf4j-version} + runtime + + + log4j + log4j + 1.2.16 + runtime + - - - javax.inject - javax.inject - 1 - + + + javax.inject + javax.inject + 1 + - - - org.apache.tomcat - tomcat-servlet-api - 7.0.30 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - javax.servlet.jsp.jstl - jstl-api - 1.2 - - - javax.servlet - servlet-api - - - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - + + + + javax.servlet + servlet-api + 2.5 + provided + + + javax.servlet.jsp + jsp-api + 2.1 + provided + + + javax.servlet.jsp.jstl + jstl-api + 1.2 + + + org.glassfish.web + jstl-impl + 1.2 + - - - opensymphony - sitemesh - 2.4.2 - + + + opensymphony + sitemesh + 2.4.2 + - - - com.fasterxml.jackson.core - jackson-databind - 2.4.1 - + + + org.codehaus.jackson + jackson-mapper-asl + 1.8.1 + - - - com.rometools - rome - 1.5.0 - + + + net.java.dev.rome + rome + 1.0.0 + - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.1.0.Final - + + + javax.validation + validation-api + 1.0.0.GA + + + org.hibernate + hibernate-validator + 4.1.0.Final + - - - joda-time - joda-time - 2.3 - + + + joda-time + joda-time + 1.6.2 + - - - commons-fileupload - commons-fileupload - 1.2.2 - - - commons-io - commons-io - 2.0.1 - + + + commons-fileupload + commons-fileupload + 1.2.2 + + + commons-io + commons-io + 2.0.1 + - - - org.springframework.security - spring-security-web - ${org.springframework.security-version} - + + + junit + junit + 4.8.2 + test + - - - org.springframework - spring-test - ${org.springframework-version} - test - - - junit - junit - 4.11 - test - - - xmlunit - xmlunit - 1.2 - test - - - com.jayway.jsonpath - json-path - 0.8.1 - test - - - org.hamcrest - hamcrest-library - 1.3 - test - - - - - - org.springframework.maven.snapshot - Spring Maven Snapshot Repository - http://repo.spring.io/snapshot - false - true - - - - org.springframework.maven.milestone - Spring Maven Milestone Repository - http://repo.spring.io/milestone - false - - - - ${project.artifactId} - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - ${java-version} - ${java-version} - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - **/*Tests.java - - - **/Abstract*.java - - junit:junit - -Xmx512m - - - - org.apache.maven.plugins - maven-dependency-plugin - - - install - install - - sources - - - - - - org.codehaus.mojo - aspectj-maven-plugin - - 1.2 - - - - org.aspectj - aspectjrt - ${org.aspectj-version} - - - org.aspectj - aspectjtools - ${org.aspectj-version} - - - - - - compile - test-compile - - - - - true - ${java-version} - ${java-version} - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - 2.2 - - - org.eclipse.jetty - jetty-maven-plugin - 9.0.6.v20130930 - - - /${project.artifactId} - - - - - - \ No newline at end of file + + + + + org.springframework.maven.snapshot + Spring Maven Snapshot Repository + http://maven.springframework.org/snapshot + + false + + + true + + + + + org.springframework.maven.milestone + Spring Maven Milestone Repository + http://maven.springframework.org/milestone + + false + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + ${java-version} + ${java-version} + + + + org.apache.maven.plugins + maven-dependency-plugin + + + install + install + + sources + + + + + + org.codehaus.mojo + aspectj-maven-plugin + + 1.2 + + + + org.aspectj + aspectjrt + ${org.aspectj-version} + + + org.aspectj + aspectjtools + ${org.aspectj-version} + + + + + + compile + test-compile + + + + + true + ${java-version} + ${java-version} + + + + org.mortbay.jetty + maven-jetty-plugin + 6.1.10 + + 10 + foo + 9999 + + + + start-jetty + pre-integration-test + + run + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + + diff --git a/src/main/java/org/springframework/samples/mvc/messageconverters/MessageConvertersController.java b/src/main/java/org/springframework/samples/mvc/messageconverters/MessageConvertersController.java index 67bb45436..388ee0cb9 100644 --- a/src/main/java/org/springframework/samples/mvc/messageconverters/MessageConvertersController.java +++ b/src/main/java/org/springframework/samples/mvc/messageconverters/MessageConvertersController.java @@ -2,9 +2,6 @@ import javax.validation.Valid; -import com.rometools.rome.feed.atom.Feed; -import com.rometools.rome.feed.rss.Channel; - import org.springframework.stereotype.Controller; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -14,91 +11,94 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import com.sun.syndication.feed.atom.Feed; +import com.sun.syndication.feed.rss.Channel; + @Controller -@RequestMapping("/messageconverters") +@RequestMapping("messageconverters/*") public class MessageConvertersController { - // StringHttpMessageConverter - - @RequestMapping(value="/string", method=RequestMethod.POST) - public @ResponseBody String readString(@RequestBody String string) { - return "Read string '" + string + "'"; - } - - @RequestMapping(value="/string", method=RequestMethod.GET) - public @ResponseBody String writeString() { - return "Wrote a string"; - } - - // Form encoded data (application/x-www-form-urlencoded) - - @RequestMapping(value="/form", method=RequestMethod.POST) - public @ResponseBody String readForm(@ModelAttribute JavaBean bean) { - return "Read x-www-form-urlencoded: " + bean; - } - - @RequestMapping(value="/form", method=RequestMethod.GET) - public @ResponseBody MultiValueMap writeForm() { - MultiValueMap map = new LinkedMultiValueMap(); - map.add("foo", "bar"); - map.add("fruit", "apple"); - return map; - } - - // Jaxb2RootElementHttpMessageConverter (requires JAXB2 on the classpath - useful for serving clients that expect to work with XML) - - @RequestMapping(value="/xml", method=RequestMethod.POST) - public @ResponseBody String readXml(@RequestBody JavaBean bean) { - return "Read from XML: " + bean; - } - - @RequestMapping(value="/xml", method=RequestMethod.GET) - public @ResponseBody JavaBean writeXml() { - return new JavaBean("bar", "apple"); - } - - // MappingJacksonHttpMessageConverter (requires Jackson on the classpath - particularly useful for serving JavaScript clients that expect to work with JSON) - - @RequestMapping(value="/json", method=RequestMethod.POST) - public @ResponseBody String readJson(@Valid @RequestBody JavaBean bean) { - return "Read from JSON: " + bean; - } - - @RequestMapping(value="/json", method=RequestMethod.GET) - public @ResponseBody JavaBean writeJson() { - return new JavaBean("bar", "apple"); - } - - // AtomFeedHttpMessageConverter (requires Rome on the classpath - useful for serving Atom feeds) - - @RequestMapping(value="/atom", method=RequestMethod.POST) - public @ResponseBody String readFeed(@RequestBody Feed feed) { - return "Read " + feed.getTitle(); - } - - @RequestMapping(value="/atom", method=RequestMethod.GET) - public @ResponseBody Feed writeFeed() { - Feed feed = new Feed(); - feed.setFeedType("atom_1.0"); - feed.setTitle("My Atom feed"); - return feed; - } - - // RssChannelHttpMessageConverter (requires Rome on the classpath - useful for serving RSS feeds) - - @RequestMapping(value="/rss", method=RequestMethod.POST) - public @ResponseBody String readChannel(@RequestBody Channel channel) { - return "Read " + channel.getTitle(); - } - - @RequestMapping(value="/rss", method=RequestMethod.GET) - public @ResponseBody Channel writeChannel() { - Channel channel = new Channel(); - channel.setFeedType("rss_2.0"); - channel.setTitle("My RSS feed"); - channel.setDescription("Description"); - channel.setLink("http://localhost:8080/mvc-showcase/rss"); - return channel; - } + // StringHttpMessageConverter + + @RequestMapping(value="/string", method=RequestMethod.POST) + public @ResponseBody String readString(@RequestBody String string) { + return "Read string '" + string + "'"; + } + + @RequestMapping(value="/string", method=RequestMethod.GET) + public @ResponseBody String writeString() { + return "Wrote a string"; + } + + // Form encoded data (application/x-www-form-urlencoded) + + @RequestMapping(value="/form", method=RequestMethod.POST) + public @ResponseBody String readForm(@ModelAttribute JavaBean bean) { + return "Read x-www-form-urlencoded: " + bean; + } + + @RequestMapping(value="/form", method=RequestMethod.GET) + public @ResponseBody MultiValueMap writeForm() { + MultiValueMap map = new LinkedMultiValueMap(); + map.add("foo", "bar"); + map.add("fruit", "apple"); + return map; + } + + // Jaxb2RootElementHttpMessageConverter (requires JAXB2 on the classpath - useful for serving clients that expect to work with XML) + + @RequestMapping(value="/xml", method=RequestMethod.POST) + public @ResponseBody String readXml(@RequestBody JavaBean bean) { + return "Read from XML: " + bean; + } + + @RequestMapping(value="/xml", method=RequestMethod.GET) + public @ResponseBody JavaBean writeXml() { + return new JavaBean("bar", "fruit"); + } + + // MappingJacksonHttpMessageConverter (requires Jackson on the classpath - particularly useful for serving JavaScript clients that expect to work with JSON) + + @RequestMapping(value="/json", method=RequestMethod.POST) + public @ResponseBody String readJson(@Valid @RequestBody JavaBean bean) { + return "Read from JSON: " + bean; + } + + @RequestMapping(value="/json", method=RequestMethod.GET) + public @ResponseBody JavaBean writeJson() { + return new JavaBean("bar", "fruit"); + } + + // AtomFeedHttpMessageConverter (requires Rome on the classpath - useful for serving Atom feeds) + + @RequestMapping(value="/atom", method=RequestMethod.POST) + public @ResponseBody String readFeed(@RequestBody Feed feed) { + return "Read " + feed.getTitle(); + } + + @RequestMapping(value="/atom", method=RequestMethod.GET) + public @ResponseBody Feed writeFeed() { + Feed feed = new Feed(); + feed.setFeedType("atom_1.0"); + feed.setTitle("My Atom feed"); + return feed; + } + + // RssChannelHttpMessageConverter (requires Rome on the classpath - useful for serving RSS feeds) + + @RequestMapping(value="/rss", method=RequestMethod.POST) + public @ResponseBody String readChannel(@RequestBody Channel channel) { + return "Read " + channel.getTitle(); + } + + @RequestMapping(value="/rss", method=RequestMethod.GET) + public @ResponseBody Channel writeChannel() { + Channel channel = new Channel(); + channel.setFeedType("rss_2.0"); + channel.setTitle("My RSS feed"); + channel.setDescription("Description"); + channel.setLink("http://localhost:8080/mvc-showcase/rss"); + return channel; + } } \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/decorators/main-layout.jsp b/src/main/webapp/WEB-INF/decorators/main-layout.jsp index 29b6d4a64..63f82c57c 100644 --- a/src/main/webapp/WEB-INF/decorators/main-layout.jsp +++ b/src/main/webapp/WEB-INF/decorators/main-layout.jsp @@ -9,10 +9,12 @@ - " rel="stylesheet" type="text/css" /> + + + <%} %> @@ -63,10 +68,11 @@ - - - + + + + diff --git a/src/main/webapp/WEB-INF/views/errors-validations.jsp b/src/main/webapp/WEB-INF/views/errors-validations.jsp index cec8e1418..e5f981462 100644 --- a/src/main/webapp/WEB-INF/views/errors-validations.jsp +++ b/src/main/webapp/WEB-INF/views/errors-validations.jsp @@ -8,7 +8,7 @@
diff --git a/src/main/webapp/WEB-INF/views/getstarted.jsp b/src/main/webapp/WEB-INF/views/getstarted.jsp index 8d5984cda..b2899bfe4 100644 --- a/src/main/webapp/WEB-INF/views/getstarted.jsp +++ b/src/main/webapp/WEB-INF/views/getstarted.jsp @@ -8,7 +8,7 @@
diff --git a/src/main/webapp/resources/js/active-first.js b/src/main/webapp/resources/js/active-first.js new file mode 100644 index 000000000..b5557df25 --- /dev/null +++ b/src/main/webapp/resources/js/active-first.js @@ -0,0 +1,8 @@ +/** + * + */ +$(function() { + var tab0 = $('#demo-tab > ul > li > a:eq(0)'); + if (tab0) + tab0.tab('show'); +});