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:
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 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 Fang on November 03, 2011 21:11:55 Last update: November 03, 2011 21:11:55
Facelet tag library descriptors can be specified in one of two ways: In web.xml , as <context-param> :
<context-param> <param-name>javax.faces...where javax.faces.FACELETS_LIBRARIES is interpreted as a semicolon ( ; ) separated list of paths, starting with "/" (without quotes). Each entry in the list is a path relative to the web application root, and is interpreted as a facelet XML tag library descriptor. The parameter facelets.LIBRARIES is an alias to javax.faces.FACELETS_LIBRARIES for backwards compatibility reasons. Via auto-discovery, by placing the XML tag library descriptor within a jar on the web application classpath (for example, under the folder WEB-INF/lib ). The file should have a name suffix .taglib.xml , and be placed in the META-INF folder of the JAR file.
Created by freyo on April 01, 2011 14:29:25 Last update: June 29, 2011 13:58:27
Start the emulator ( create an AVD if none exists)
$ tools/emulator -avd Simple8Create new project
$ tools/android create project \ > --package co...where " --target 2 " identifies the target platform as displayed by " tools/android list targets ", which is stored in the properties file default.properties in the project root folder. cd HelloWorld and install debug package onto the running emulator:
$ ant install Buildfile: build.xml [set...Launch the Hello World application on the emulator. You'll see something like this: Edit res/values/string.xml , change the contents to:
<?xml version="1.0" encoding="utf-8"?> <resourc...Edit res/layout/main.xml , change the contents to:
<?xml version="1.0" encoding="utf-8"?> <LinearL...The contents of the text area now refer to a string defined in the resource file strings.xml , instead...
Created by freyo on May 11, 2011 12:30:45 Last update: May 11, 2011 12:32:06
Android application builds use Xpath to query AndroidManifest.xml attributes. This is a simple build.xml to demo how it is set up:
<?xml version="1.0" encoding="UTF-8"?> <project...
Created by freyo on April 18, 2011 15:08:21 Last update: April 18, 2011 15:12:20
Generate android project
$ ~/android-sdk-linux_86/tools/android create proj...Create XML file res/xml/books.xml :
<?xml version="1.0"?> <catalog> <book id=...Edit layout ( res/layout/main.xml ):
<?xml version="1.0" encoding="utf-8"?> <Lin...Edit code ( src/com/android/xmlres/XMLResource.java ):
package com.android.xmlres; import java.io....Change activity label from app_name to booklist ( AndroidManifest.xml ):
<?xml version="1.0" encoding="utf-8"?> <manifes...Add value for string resource ( res/values/string.xml ):
<?xml version="1.0" encoding="utf-8"?> <resourc...Deploy and test:
Created by Fang on August 16, 2010 20:42:56 Last update: August 16, 2010 20:47:24
Of course you'll need a datasource to run your SQL statements. It can be set in web.xml , or with the <sql:setDataSource> tag. In web.xml , the declaration is something like this:
<context-param> <param-name>javax.servl...where the parameter value is a relative JNDI path, or parameters for a JDBC connection. In the above example, the real JNDI name for the data source would be: java:comp/env/jdbc/myDataSource . You are out of luck if the JNDI path for the data source does not fall under the java:comp/env/ namespace. In the case of JDBC connection parameters, the expected format is:
url[, [driver] [, [user] [,password]]]For example: jdbc:mysql://localhost/,org.gjt.mm.mysql.Driver , where no user name or password is used. <sql:setDataSource> Exports a data source either as a scoped variable or...
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...