Caused by the small notes springSide

2010-10-24  来源:本站原创  分类:Java  人气:148 

struts.convention.result.path="/WEB-INF/content/":  Stored in the root path of the results page, you must   "/"   Beginning  .
      struts.convention.action.suffix="Action": action  Get name"true":   Whether to convert to lowercase Action class"-":
      struts.convention.action.disableScanning="false":   Does not scan class  .
      struts.convention.default.parent.package="convention-default":  Set the default parent package  .
      struts.convention.package.locators="action,actions,struts,struts2":   To determine the path of the search package  .


Package naming conventions to specify the location of the naming convention to develop the results of Action (support JSP, FreeMarker, etc.) class name to the URL path to convert the agreed package name to the namespace (namespace) of the agreed conversion specification follows the SEO link address (ie: using my-action instead MyAction)
Action name based annotation annotation-based interceptor (Interceptor)

Annotation-based namespace (Nameespace)
XWork package based annotation and the default result of the default action (for example: / products will try to find com.example.actions.Products or com.example.actions.products.Index for processing)

struts2 zero configuration detail to see this

spring configuration file from an external load properties file

<!--   Definition of environmentally sensitive variables   -->
                <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
                <property name="ignoreResourceNotFound" value="true" />
                <property name="locations">
                                <!--   Standard   -->
                                <!--   Local development environment configuration   -->
                                <!--   Server production environment configuration   -->

Spring-based integrated development cxf webservice client technology is simple:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="" xmlns:xsi=""
        xmlns:jaxws="" xmlns:cxf=""

        <description>Apache CXF Web Service Client  Client Configuration  </description>

        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />

        <jaxws:client serviceClass="org.springside.examples."
                address="http://localhost:8080/mini-service/ws/userservice" />
</beans> <!--  This is the webservice class interface is off  -->

Developed using cxf webservice API itself is very simple:

String address = BASE_URL + "/ws/userservice";

                JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
            //UserWebService  Is an interface
                UserWebService userWebServiceCreated = (UserWebService) proxyFactory.create();

                //(  Optional  )  Reset  endpoint address.
                ((BindingProvider) userWebServiceCreated).getRequestContext()

Using velocity to explain the dynamic sql. Sql no longer need to fight headaches.

 *   Use Velocity Tools Generated Content  .
 * @author calvin
public class VelocityUtils {

        static {
                try {
                } catch (Exception e) {
                        throw new RuntimeException("Exception occurs while initialize the velociy.", e);

         *   Render content  .
         * @param template   Template Content  .
         * @param model   Variable Map.
        public static String render(String template, Map<String, ?> model) {
                try {
                        VelocityContext velocityContext = new VelocityContext(model);
                        StringWriter result = new StringWriter();
                        Velocity.evaluate(velocityContext, result, "", template);
                        return result.toString();
                } catch (Exception e) {
                        throw new RuntimeException("Parse template failed.", e);


         *   Using Velocity to create dynamic  SQL.
        public List<User> searchUserByFreemarkerSqlTemplate(Map<String, ?> conditions) {
                String sql = VelocityUtils.render(searchUserSql, conditions);//searchUserSql  Injected by the spring
                return jdbcTemplate.query(sql, userMapper, conditions);
                <property name="searchUserSql">
                        SELECT id, name, login_name
                        FROM ss_user
                        WHERE 1=1

                        ## Dynamic Content
                        #if ($loginName)
                        AND login_name=:loginName
                        #if ($name)
                        AND name=:name

                        ORDER BY id

jdbcTeamplate named parameters use the form Bean

private static final String INSERT_USER = "insert into SS_USER(id, login_name, name) values(:id, :loginName, :name)";
//  Will use BeanPropertySqlParameterSource  User  Parameters for the named property mapping  .

        BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(user);
                jdbcTemplate.update(INSERT_USER, source);

webservice. Yi Chuan Chuan Association by mtom large files

 *   MTOM attachment agreement to transfer demo  Streaming DataHandler  Binary data transfer mode  .
 * @author calvin
@XmlType(name = "LargeImageResult", namespace = WsConstants.NS)
public class LargeImageResult extends WSResult {

        private static final long serialVersionUID = 8375875101365439245L;

        private DataHandler imageData;

        public DataHandler getImageData() {
                return imageData;

        public void setImageData(DataHandler imageData) {
                this.imageData = imageData;
@WebService(serviceName = "LargeImageService", portName = "LargeImageServicePort", endpointInterface = "", targetNamespace = WsConstants.NS)
public class LargeImageWebServiceImpl implements LargeImageWebService, ApplicationContextAware {

        private static Logger logger = LoggerFactory.getLogger(LargeImageWebServiceImpl.class);

        private ApplicationContext applicationContext;

         * @see LargeImageWebService#getImage()
        public LargeImageResult getImage() {

                try {
                        //  Get used applicationContext  Web  Application documents  .
                        File image = applicationContext.getResource("/img/logo.jpg").getFile();

                        //  By activation of  DataHandler  Streaming transmission achieved  .
                        DataSource dataSource = new FileDataSource(image);
                        DataHandler dataHandler = new DataHandler(dataSource);

                        LargeImageResult result = new LargeImageResult();
                        return result;
                } catch (IOException e) {
                        logger.error(e.getMessage(), e);
                        return WSResult.buildResult(LargeImageResult.class, WSResult.IMAGE_ERROR, "Image reading error.");


        public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
                this.applicationContext = applicationContext;

springside very powerful, the big mainstream party, it is not that we usually find the answer? Because a lot of useless technology, fast forget, the first being to make a small note. To be continued. .

  • Caused by the small notes springSide 2010-10-24

    struts.convention.result.path="/WEB-INF/content/": Stored in the root path of the results page, you must "/" Beginning . struts.convention.action.suffix="Action": action Get name"

  • SRS is caused by network problems Notes 2010-08-06

    SRS is not clear, previous versions of the code in there like this: // Delete is not an agent of the current account CP account , Demand uncertainty, temporarily remove the filter // filterCP(cpAccounts); There was no mention, not to identify the pro

  • JS JS caused by the wrong notes 2010-11-08

    JS function of a failure online, but is normal in the local debugging. After the exclusion of environmental issues, I began to think JS itself. The difference between the two JS: JS line is compressed, precisely, is purified, the local is the source.

  • Java Notes Annotations can really simplified J2EE development? 2009-04-07

    With the J2EE entered after 5.0 time, Java EE5.0's a lot of features have also been widely used in J2EE programs. The Java EE5.0 Notes (Annotations) characteristic is one of the most widely used characteristics of one. If a slight glance at the lates

  • JavaScript Memory Leak Detector (v2) 2010-04-09

    Introduction JavaScript Memory Leak Detector ( Download ) is a Debugging tool to detect and enforce best practices Memory leaks in JavaScript code when Working with version of Internet Explorer older than IE8. As described in Detail in this MSDN arti

  • CSS coding tips page layout order 2010-05-01

    1, ul tag in Mozilla, the default is padding value, only the margin in IE there is value. 2, with one class selector can be repeated in a document, while the id selector can only occur once; on a label at the same time using the CSS class and id for

  • JS out of memory, debugging tools introduced 2010-06-07

    javascript memory leak problem has not been everyone's attention because of the impact of user performance is not too realistic, perhaps developed rapidly in recent years memory. Script memory leak will not be much longer impact. Of course, as the fr

  • CSS: the background color of the Notes caused by improper format invalid 2010-06-06

    Difficult to find the problem CSS: IE and Firefox's CSS-compliant Daquan js test client is not prompted to download firefox then detaile

  • Hacker Attack and Defense Technology Collection - Notes 9.6 client for the attack - caused by loopholes in shared computer 2010-07-06

    Common vulnerabilities include: 1. Persistent Cookie 2. Cached page contains sensitive information WEB 3. Cache contains the history of access to sensitive information 4. Automatically To prevent the attacks: 1. Do not put sensitive data in the Cooki

  • And Spring2.5 profile Hibernate Annotation Notes 2009-08-07

    1. Web.xml configuration <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext.xml <!--classpath*:/spring-config/applicationContext.xml--> </param-value> </context-p

  • To springside a cardiac stimulant and re-ignite the enthusiasm of SSH framework 2 2010-02-17

    Connected to a <a href=""> to springside a cardiac stimulant and re-ignite the enthusiasm of SSH architecture 1 </ a> The following talk about the methods used. Using this system, we f

  • Optimization into a worry: String.split caused by "memory leak" 2010-03-29

    Has been praised Sun rigorous and elegant treatment technologies (bless Sun). Sun JDK source code in the Java libraries, even the notes are clear and regulatory norms Fan, javadoc comment use was also a meticulous reading comfortably familiar. Thus,

  • maven series of notes (to install. download the jar. structures, PW) 2010-03-24

    1, first of all to Maven download the appropriate version, I downloaded the Maven 2.0.9 (zip). 2, extract the files to the directory you want to install, I was F: \ apache-maven-2.0.9. 3, in the environment varia

  • Acrylic flower color caused by the reasons and solutions 2010-02-18

    Keywords: acrylic color flowers caused the causes and solutions recently visited clients in the process, found that some plant dyed acrylic dyeing process control properly, resulting in color spend. I dyed acrylic fiber plant in the work of many year

  • BlackBerry Enterprise Server Express Study Notes 2010-03-31

    BlackBerry Enterprise Server Express study notes (the notes to learn from instructions) RIM the company has finally released a free Enterprise Edition server software, BlackBerry Enterprise Server Express, which the software equivalent of a BlackBerr

  • Dive Into Python cn notes 2010-03-11

    Dive Into Python cn notes =========================== 2010,01,18 Dive Into Python version: 5.4b version of the woodpecker community translation 1. Tuple is no way. Can not change, suitable constants. Available to only traverse the list to use when hi

  • Ubuntu 10.04 to install 64-bit Oracle11gR2 Notes 2010-04-10

    This development environment for individual users, so the directory structure, user settings and so is not rigorous, more emphasis on convenience, if it is used in the production environment, refer to the official documentation oracle adjusted accord

  • AR / AP - debit notes and credit notice the difference 2010-05-28

    AR Credit Memo Credit notice, reduce receivables, washed the original invoice Actual use: customer returns, your company needs to reduce the receivable to open Credit Memo Debit Memo Debit note, an independent invoice, plus receivables AP Credit Memo

  • EJB personal study notes 2010-05-30

    Ejb3.0 Study Notes ( Run in Jobss Ejb) What is EJB? Full name is Enterprice JavaBeans is a standard for distributed business applications server component model . Prepared using Enterprice JavaBeans architecture is extensible applications , Transacti

  • EJB instance Tutorial Notes (1) 2010-07-04

    EJB instance Tutorial Notes (1) EJB3 tutorial e-book example of byLiHuoming.pdf Notes Chapter EJB knowledge and operating environment configuration EJB defines three types of enterprise Bean: Session Bean (Session Bean), Entity Bean (Entity Bean) and