Displaying keyword search results 1 - 10
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/MyController.java :
package com.example; import javax.servlet.S...
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 Fang on December 30, 2013 14:50:08 Last update: December 30, 2013 14:50:08
Starting with 3.1 M1 you can register HttpMessageConverters through a sub-element of mvc:annotation-driven .
<?xml version="1.0" encoding="UTF-8"?> <beans x...
Created by Fang on August 28, 2013 20:37:17 Last update: August 28, 2013 20:37:17
The default extension for JSF facelet files is .xhtml, which looks so out-of-date these days. I wanted to change the extension from .xhtml to .html, to make it look more modern, even though I still use JSF xhtml in reality. This didn't work ( web.xml ):
<servlet-mapping> <servlet-name>Faces Ser...Using the servlet-mapping config without the context-param works, given that the actual file extensions are still .xhtml . But the caveat is, if you request the .xhtml file directly, it will be sent to the browser unprocessed. This worked:
<servlet-mapping> <servlet-name>Faces Ser...I'm using myfaces 2.1.11.
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:
Created by Fang on January 04, 2013 09:02:44 Last update: January 04, 2013 09:02:44
This snippet sets system properties from Maven surefire test plugin. This is useful when you want to set logging (for example, log4j) properties based on Maven project properties. Example that sets system property testlog.dir :
<plugins> <plugin> <groupId>org.apach...Example log4j.xml that uses system property testlog.dir :
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYP...
Created by Fang on July 25, 2012 12:52:40 Last update: September 14, 2012 13:37:57
Summarized from official JAX-WS documentation : Sending and Receiving SOAP Headers To send a SOAP header:
HelloService helloService = new HelloService(); ...To receive a SOAP header:
List<Header> inboundHeaders = bp.getInboundHeaders...Message logging On the client side, set system property:
com.sun.xml.ws.transport.http.client.HttpTransport...On the server side, set system property:
com.sun.xml.ws.transport.http.HttpAdapter.dump=tru...Propagation of Server-side Stacktrace Propagation of Stack trace is on by default. The whole stacktrace (including nested exceptions) is propagated in the SOAP Fault and the complete exception stacktrace is visible to the client as cause of SOAPFaultException . To turn off stack trace propagation, set this system property on the server:
com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptu...Update: At least on the client side, the property name has been changed to:
com.sun.xml.internal.ws.transport.http.client.Http...The messages are dumped to stdout . For...
Created by Dr. Xi on April 19, 2012 10:10:08 Last update: April 19, 2012 10:11:06
The default servlet for Tomcat is declared in $CATALINA_HOME/conf/web.xml :
<servlet> <servlet-name>default</servle...Therefore, static content is rendered by the default configuration unless you override it with your own definitions. If you want to allow directory listing, just change the listing parameter to true :
<init-param> <param-name>listings</para...Change the welcome-file-list to display a default page in lieu of a directory listing:
<welcome-file-list> <welcome-file>home.xhtml</...Welcome pages are defined at the Web application level.
Created by Fang on February 23, 2012 14:25:57 Last update: March 01, 2012 13:53:59
Some example snippets for Spring message configuration and usage. To configure a message source in Spring context (basename=messages):
<bean id="messageSource" class="org.springf...Locale change interceptor can also be setup with:
<?xml version="1.0" encoding="UTF-8"?> <beans x...The messages file should be named messages.properties (or messages_en.properties , etc.) and located on CLASSPATH , for example: WEB-INF/classes . To use a message resource in JSP:
<%@ taglib prefix="spring" uri="http://www.springf...
Created by James on February 02, 2012 16:00:15 Last update: February 02, 2012 16:00:15
Video for Everybody seems to be a generic way to embed video in a web page, even without flash. This code snippet comes from that site.
<!-- first try HTML5 playback: if serving as XML, ...