Recent Notes

Displaying keyword search results 1 - 5
Created by Fang on January 10, 2014 14:07:20    Last update: January 10, 2014 14:07:20
An example project with Spring MVC and Apache Tiles. List of files: ./pom.xml ./src/main/webapp/WEB-INF/web.xml... ./pom.xml : <?xml version="1.0" encoding="UTF-8"?> <pro... ./src/main/webapp/WEB-INF/web.xml : <?xml version="1.0" encoding="UTF-8"?> <web-app... ./src/main/webapp/WEB-INF/applicationContext.xml : <?xml version="1.0" encoding="UTF-8"?> <beans x... ./src/main/webapp/WEB-INF/spring-servlet.xml : <?xml version="1.0" encoding="UTF-8"?> <beans x... ./src/main/webapp/WEB-INF/tiles-definitions.xml : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYP... ./src/main/webapp/WEB-INF/jsp/template.jsp : <!DOCTYPE html> <%@ page pageEncoding="UTF-8" %... ./src/main/java/com/example/ : package com.example; import javax.servlet.S...
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 package The resulting webapp is target/springmvc.war .
Created by Fang on March 03, 2010 05:16:40    Last update: October 31, 2011 10:22:51
Implicit variables are always available to JSTL - you don't need to set them before using them. Page context: pageContext pageContext properties: Name Type Description page javax.servlet.Servlet The current servlet request request javax.servlet.ServletRequest The current servlet request response javax.servlet.ServletResponse The current servlet response servletConfig javax.servlet.ServletConfig The servlet config servletContext javax.servlet.ServletContext The application session javax.servlet.http.HttpSession The current HTTP session Note: request , response etc., is not directly available, you access them with pageContext.request , pageContext.response , etc. Scope variables: pageScope, requestScope, sessionScope, applicationScope Name Type Description pageScope java.util.Map Name-value pair of page scoped variables requestScope java.util.Map Name-value pair of request scoped variables sessionScope java.util.Map Name-value pair of session scoped variables applicationScope java.util.Map Name-value pair of application scoped variables Parameters, HTTP headers and cookies: param, paramValues, header,...
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 value="theParameterValue"/> or <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 . : label.login=Login label.username=User Name ... :...
Created by Dr. Xi on April 30, 2009 23:26:13    Last update: May 01, 2009 17:08:49 contains these keys: test.key.1 = Test Key One test.key.2 = Test Key... Struts (struts-el): <%@ page contentType="text/html;charset=UTF-8" lan... JSTL <%@ page contentType="text/html;charset=UTF-8" lan... However, the values for one and two must be passed in from pageScope , requestScope , sessionScope , etc. Values defined by struts bean:define are not interpreted. Important: JSTL tags work with servlet spec 2.4 only. So your web.xml must start with this: <?xml version = '1.0' encoding = 'windows-1252'?> ... Not this: <?xml version = '1.0' encoding = 'windows-1252'?> ... However, the latter does work with struts-el tags.