Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit, includes working version of plain JSP and custom tags
- Loading branch information
Mic
committed
Sep 11, 2012
0 parents
commit cdf6edc
Showing
17 changed files
with
372 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target/* | ||
.settings/* | ||
.classpath | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<projectDescription> | ||
<name>mvc-layout-samples</name> | ||
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment> | ||
<projects/> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.common.project.facet.core.builder</name> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.validation.validationbuilder</name> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.springframework.ide.eclipse.core.springbuilder</name> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.springframework.ide.eclipse.core.springnature</nature> | ||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> | ||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Before installing those samples please make sure that Maven and git have been installed and configured properly on your local system. | ||
|
||
You can do: | ||
|
||
git clone git@github.com:michaelisvy/ajax-samples.git | ||
cd ajax-samples | ||
mvn eclipse:eclipse | ||
|
||
Your project is now ready to be imported into Eclipse. | ||
File -> Import -> Existing project into Eclipse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<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>com.springsource.samples</groupId> | ||
<artifactId>mvc-layout-samples</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
|
||
<name>AjaxDemo</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<spring.framework.version>3.1.2.RELEASE</spring.framework.version> | ||
<tiles.version>2.2.2</tiles.version> | ||
<sl4j.version>1.7.0</sl4j.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-eclipse-plugin</artifactId> | ||
<version>2.8</version> | ||
<configuration> | ||
<downloadSources>true</downloadSources> | ||
<downloadJavadocs>true</downloadJavadocs> | ||
<wtpversion>2.0</wtpversion> | ||
<sourceIncludes> | ||
<sourceInclude>**/*.*</sourceInclude> | ||
</sourceIncludes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<!-- Web layer --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-webmvc</artifactId> | ||
<version>${spring.framework.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
<version>2.5</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>jstl</artifactId> | ||
<version>1.2</version> | ||
</dependency> | ||
|
||
<!-- Dependency Injection --> | ||
|
||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-tx</artifactId> | ||
<version>${spring.framework.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>commons-logging</groupId> | ||
<artifactId>commons-logging</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
|
||
|
||
|
||
|
||
<!-- Testing --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<version>${spring.framework.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.tiles</groupId> | ||
<artifactId>tiles-jsp</artifactId> | ||
<version>${tiles.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.10</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>jcl-over-slf4j</artifactId> | ||
<version>${sl4j.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${sl4j.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>${sl4j.version}</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>1.2.14</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
|
||
|
||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package controller; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import model.User; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
|
||
@Controller | ||
public class UserController { | ||
|
||
@RequestMapping(value="/users/all/jsp-plain",method=RequestMethod.GET) | ||
public String findUsersPlain(Model model){ | ||
buildUserList(model); | ||
return "01-plain/users"; | ||
} | ||
|
||
@RequestMapping(value="/users/all/custom-tags",method=RequestMethod.GET) | ||
public String findUsers(Model model){ | ||
buildUserList(model); | ||
return "02-custom-tags/users"; | ||
} | ||
|
||
private void buildUserList(Model model) { | ||
List<User> users = new ArrayList<User>(); | ||
users.add(new User("Paul", "Chapman")); | ||
users.add(new User("Mike", "Wiesner")); | ||
users.add(new User("Mark", "Secrist")); | ||
users.add(new User("Ken", "Krueger")); | ||
model.addAttribute("users", users); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package model; | ||
|
||
|
||
public class User { | ||
|
||
private String firstName; | ||
|
||
private String lastName; | ||
|
||
|
||
public User(String firstName, String lastName) { | ||
this.firstName = firstName; | ||
this.lastName = lastName; | ||
} | ||
|
||
public String getFirstName() { | ||
return firstName; | ||
} | ||
|
||
public String getLastName() { | ||
return lastName; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?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" | ||
xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
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.0.xsd"> | ||
|
||
|
||
<!-- Scans the classpath of this application for @Components to deploy as beans --> | ||
<context:component-scan base-package="controller" /> | ||
|
||
<!-- Configures the @Controller programming model --> | ||
<mvc:annotation-driven /> | ||
|
||
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory --> | ||
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> | ||
<property name="prefix" value="/WEB-INF/view/jsp/"/> | ||
<property name="suffix" value=".jsp"/> | ||
</bean> | ||
|
||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> | ||
<%@ attribute name="title" required="true" rtexprvalue="true" %> | ||
|
||
|
||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | ||
<title>${title}</title> | ||
<spring:url value="/style" var="styleUrl" /> | ||
<link href="${styleUrl}/app.css" rel="stylesheet"> | ||
</head> | ||
<body> | ||
|
||
<div class="container" style="padding-top: 50px;"> | ||
|
||
<jsp:include page="../menu.jsp"/> | ||
<jsp:doBody /> | ||
<jsp:include page="../footer.jsp"/> | ||
</div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div id="footer" class="clearfix"> | ||
<p>Copyright 2012 SpringSource, a division of VMware</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | ||
|
||
<c:url value="/users/all/jsp-plain.htm" var="usersPlain" /> | ||
<c:url value="/users/all/custom-tags.htm" var="usersCustomTags" /> | ||
<c:url value="/images/springsource_banner_green.png" var="headerImage" /> | ||
|
||
<div class="header well"> | ||
<img src="${headerImage}"> | ||
<div class="page-header"> | ||
<h1>MVC Layout Samples</h1> | ||
</div> | ||
<ul> | ||
<li><a href="${usersPlain}">No template</a></li> | ||
<li><a href="${usersCustomTags}">Custom tags</a></li> | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> | ||
<display-name>HelloWorldExampleWithSpring3MVCInEclipse</display-name> | ||
<servlet> | ||
<servlet-name>DispatcherServlet</servlet-name> | ||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | ||
<init-param> | ||
<param-name>contextConfigLocation</param-name> | ||
<param-value> | ||
/WEB-INF/app-config.xml | ||
</param-value> | ||
</init-param> | ||
<load-on-startup>1</load-on-startup> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>DispatcherServlet</servlet-name> | ||
<url-pattern>*.htm</url-pattern> | ||
</servlet-mapping> | ||
<servlet-mapping> | ||
<servlet-name>DispatcherServlet</servlet-name> | ||
<url-pattern>*.json</url-pattern> | ||
</servlet-mapping> | ||
<welcome-file-list> | ||
<welcome-file>index.jsp</welcome-file> | ||
</welcome-file-list> | ||
</web-app> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" | ||
pageEncoding="ISO-8859-1"%> | ||
|
||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | ||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> | ||
|
||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | ||
<title>Index</title> | ||
</head> | ||
<body> | ||
<jsp:include page="WEB-INF/view/jsp/menu.jsp"/> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
form fieldset { padding: 20px; } | ||
div.control-group { margin-bottom: 20px; } | ||
div.control-group label.control-label { width: 300px; } | ||
div.control-group div.controls { width: 400px; } | ||
div.controls span { color: red; font-size: 0.8em; } | ||
|
||
div.container { margin: 0 auto; width: 940px; } | ||
|
||
a { text-decoration: none; } | ||
a:hover { text-decoration: underline; } | ||
|
||
h1 { border-bottom: 1px solid #eee; padding-bottom: 13px; } | ||
h1 small { font-size: 0.6em; color: #ccc; } | ||
|
||
|
||
table {width: 300px;} | ||
tr:nth-child(odd) {background-color: #eee;} | ||
tr:nth-child(even) {background-color: #fff;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.error{ | ||
color: red; | ||
} | ||
|
||
.success{ | ||
color: green; | ||
} |