Displaying keyword search results 1 - 4
Created by Fang on January 31, 2012 15:40:34 Last update: January 31, 2012 15:41:28
This is a simple Hello World application with Spring 3 MVC. Like the default Apache HTTPd welcome page, it displays " It works! " when successfully deployed. The sole purpose is to show the minimum elements needed to setup Spring 3 MVC. I use Maven since it's so much easier than downloading the dependencies manually. Directory layout:
./src ./src/main ./src/main/webapp ./src/...pom.xml :
<?xml version="1.0" encoding="UTF-8"?> <project...WEB-INF/web.xml :
<?xml version="1.0" encoding="UTF-8"?> <web-app...WEB-INF/applicationContext.xml (empty, but needed):
<?xml version="1.0" encoding="UTF-8"?> <beans x...WEB-INF/spring-servlet.xml :
<?xml version="1.0" encoding="UTF-8"?> <beans x...WEB-INF/jsp/home.jsp :
<!DOCTYPE html> <html> <head> <title>H...Build with:
mvn clean packageThe resulting webapp is target/springmvc.war .
Created by Fang on October 28, 2011 13:49:40 Last update: October 30, 2011 19:23:25
This is a simple example to demonstrate the templating power of JSF facelets. If you've used struts tiles before, you'll recognize the simplicity of templating with facelets. I've stripped out everything else except the pages themselves, just to put our focus on facelets. This is a Maven based project, and you need Tomcat (or any servlet container) to run the resulting webapp. To begin with this is the list of files:
./pom.xml ./src/main/webapp/home.xhtml ./src...I left faces-config.xml in there for completeness sake, it may not be needed. The Maven POM ( pom.xml ):
<?xml version="1.0" encoding="UTF-8"?> <project...Web app configuration ( WEB-INF/web.xml ):
<?xml version="1.0" encoding="UTF-8"?> <web-app...Empty WEB-INF/faces-config.xml :
<?xml version="1.0" encoding="UTF-8"?> <!-- Thi...index.jsp is simply a redirect to home.jsf :
<% response.sendRedirect("home.jsf"); %>...
Created by Fang on August 03, 2010 19:50:51 Last update: August 03, 2010 19:50:51
The tags <fmt:message> Writes out a formatted message for the current locale and resource bundle, or stores the resulting message to a scoped variable (when the var attribute is specified). Syntax:
<fmt:message key="messageKey" [bundle="resourc...Or, with parameters in body:
<fmt:message key="messageKey" [bundle="resourc...<fmt:bundle> Creates a resource bundle for the contained body. Syntax:
<fmt:bundle basename="basename" [prefix="prefi...<fmt:setBundle> Sets a resource bundle in a scoped variable, which may be used later by <fmt:message> . Syntax:
<fmt:setBundle basename="basename" [var="varNa...<fmt:param> This is used inside a <fmt:message> tag to specify a replacement parameter.
<fmt:param>The Parameter Value</fmt:param>Test it Make these additions to the expanded test application : Create 3 resource bundles and place them under src\main\resources . messages_en.properties :
label.login=Login label.username=User Name ...messages_es.properties :...
Created by Fang on September 07, 2009 16:39:37 Last update: September 07, 2009 18:43:04
It's easiest to use the archetype plugin to start a new Maven project. I'll use struts 1 as example since it's not in the built-in archetypes for archetype:generate . Generate a simple webapp with archetype:generate :
C:\work\maven>mvn archetype:generate -DarchetypeAr...It generates a directory structure like this:
struts1app struts1app/pom.xml struts1app/src...with a simple POM:
<project xmlns="http://maven.apache.org/POM/4.0.0"...Create settings.xml in $HOME/.m2 , add Java.net repository for Java EE dependencies:
<?xml version="1.0" encoding="UTF-8"?> <setting...Add Java EE and Struts dependencies in pom.xml . Note that the Java EE dependency has scope provided , meaning that the web app container provides the jars, therefore we don't need to bundle them with our war fie.
<project xmlns="http://maven.apache.org/POM/4.0.0"...Create a directory named java under main , create the Struts form and...