Recent Notes

Displaying keyword search results 1 - 10
Created by Fang on January 06, 2014 12:22:17    Last update: January 06, 2014 12:22:17
Add <mvc:default-servlet-handler/> to the spring servlet config ( spring-servlet.xml ?) so that static files can be handled by the default servlet handler. This is a full configuration file for example: <?xml version="1.0" encoding="UTF-8"?> <beans x...
Created by Dr. Xi on March 21, 2013 19:47:46    Last update: March 22, 2013 12:30:27
It's normal practice to import types from an external xsd file in WSDL like this: <wsdl:types> <xsd:schema xmlns:xsd="htt... When you use <dynamic-wsdl> and have Commons XMLSchema on the class path, Spring-WS inlines the xsd in the wsdl. But that doesn't happen when you use <static-wsdl> . You can define a SimpleXsdSchema bean to expose the xsd: <?xml version="1.0" encoding="UTF-8"?> <beans x... where the bean id "hello" should match the schemaLocation attribute in the WSDL (without the .xsd suffix). But note that the SimpleXsdSchema does not inline the xsd. It only makes the xsd available via an HTTP URL. Alternatively, you can simply put the xsd file under the content directory of the webapp (just link any CSS or JavaScript). Anyway, that's a lot of manual...
Created by Fang on April 16, 2012 13:32:10    Last update: April 16, 2012 13:32:10
There are two steps to create a custom function for JSP: Declare the function in the TLD: <?xml version="1.0" encoding="UTF-8" ?> <taglib... Implement the function (must be static): package com.example; public class UrlTransl... To use the function: <%@ taglib uri="http://www.example.com/jsp/tags" p...
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 zhidao on January 25, 2012 16:07:29    Last update: January 25, 2012 16:07:29
A JSON response is auto-magically returned when you add the @ResponseBody annotation to the return value of a @RequestMapping annotated method: import org.springframework.stereotype.Controller; ... For magic to happen, you must: Add annotation-driven to the org.springframework.web.servlet.DispatcherServlet config xml: <?xml version="1.0" encoding="UTF-8"?> <beans x... Put Jackson jar files on CLASSPATH (i.e., under WEB-INF/lib ), which includes jackson-core-asl-1.6.4.jar and jackson-mapper-asl-1.6.4.jar .
Created by Dr. Xi on April 27, 2011 11:57:36    Last update: April 27, 2011 11:58:35
This is a sample struts-config.xml file for Struts 1.x . <?xml version="1.0" encoding="UTF-8"?> <!DO...
Created by voodoo on July 11, 2009 15:14:55    Last update: July 29, 2010 22:45:48
cURL is a command line tool for transferring files with URL syntax. The main purpose and use for cURL is to automate unattended file transfers or sequences of operations. It's really easy to see HTTP headers with curl: C:\>curl --head http://www.google.com HTTP/1.0 ... or, headers and page together (dump headers to stdout): $ curl --dump-header - http://www.google.com HTTP/... Download openssl from openssl.org: curl http://www.openssl.org/source/openssl-0.9.6m.... C:\>curl --help Usage: curl [options...] <url> ...
Created by Fang on April 02, 2010 21:45:47    Last update: July 17, 2010 02:55:06
This is built upon the simple test application for JSTL , which contained a single servlet and a single JSP page. If I want to use it to test all available JSTL tags, the servlet and JSP page would be too complicated. Instead, I want to group the JSTL tags into separate JSP pages and display each group based on the requested URL. For example, if the URL ends with /CoreBasic , I'll display a page that contains the basic core tags; if the URL ends with /I18N , I'll display a page that contains the internationalization tags (e.g., <fmt:message> ). Furthermore, I want to delegate the handling of each group of tags to separate Java classes. This is the application I'll use for the...
Created by nogeek on April 25, 2010 05:09:14    Last update: April 25, 2010 05:10:46
Oracle Web Cache version used: Oracle Application Server Web Cache 10.1.2.3.0 ... The test page is a simple Struts action sending a URL redirect: public ActionForward execute(ActionMapping map... Web Cache setup Origin server Host Name Port oas.host 7777 Site Host Name Port URL Path Prefix webcache.host 80 Test results Request directly to the OC4J (Oracle Application Server): C:\work\testAppWebApp2>curl --dump-header - http:/... Request to Oracle Web Cache: C:\work\testAppWebApp2>curl --dump-header - http:/... Notice that Oracle Web Cache correctly translated the host name in the header and HTML page. However, the port number remained that of the Oracle App Server.
Created by Fang on April 01, 2010 22:24:58    Last update: April 02, 2010 02:49:38
In this note I'll show you how to create and package a JSP custom tag. The purpose of this tag is to display a random splash image for a home page, among a set of images. We should be able to add or delete candidate splash images from the WAR archive without the need to change the JSP. This is the intended use of the tag: <%@ taglib uri="http://custom.tag.com/demo" prefix... In the above example you provide a set of images named splash*.png (e.g., splash1.png, spalsh2.png, ...), and the tag will pick a random one to display when the JSP is rendered. Let's get started. I'll use Maven for this purpose. Create the standard Maven directory structure ./pom.xml ./src ./src/main ./src/main/jav... pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... SplashTag.java package tagdemo; import java.util.ArrayList......
Previous  1 2 Next