Integration of Httl to Struts2 in eclipse

Source: Internet
Author: User

What is Httl?

HTTL (hyper-text template Language) is a high-performance, open-source Java template engine for Dynamic HTML page output that can replace JSP pages with instructions similar to velocity.


HTTL Official website:

http://httl.github.io/zh/


The background presented here is based on STRUTS2 and Httl development of a simple example of a Java EE: where the background logic code with STRUTS2, the foreground dynamic display page with Httl (JS library arbitrary selection).


Anyway

Integrating HTTL into your project requires:

1, now to the HTTL official website Download two jar package:

(1) Httl core package Httl-1.0.11.jar, version can be downloaded according to their own needs.

(2) Struts Integration Pack Http-struts-1.0.11.jar.

You need to explain here. Do not think that only download a Http-struts-1.0.11.jar integration into the project, in fact, the content of the Http-struts-1.0.11.jar is very simple, contains only one struts result type =httl's template explains the engine and a struts-plugin.xml. In fact, the package only defines and implements a STRUTS2 result type, which does not contain the HTTL core package.


2. Place the Httl attribute file httl.properties in the Web-inf directory.

The contents of my properties file are as follows:

import.packages+=domaintemplate.directory=message.basename=/web-inf/messagesinput.encoding= Utf-8output.encoding=utf-8
What needs to be described here is the need to configure the Import.packages property, which is interpreted as "Domain Model Package Import", which is the package where the various Java beans are located.


Report:

1. Eclipse Integration Struts2: see article http://blog.csdn.net/tterminator/article/details/45423003

2. When integrating HTTL related packages into the project, a binary package is required instead of the source code package, which is the jar package containing the *.class, not the *. Java's jar package.

3. When the Httl core package is not introduced, no exception will occur to start the Tomcat deployment file, but exception java.lang.ClassNotFoundException:httl.web.WebEngine may occur on access:

Critical: Servlet.service () for Servlet default threw Exceptionjava.lang.ClassNotFoundException:httl.web.WebEngineat Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1680) at Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1526) at Httl.web.struts.HttlResult.doExecute (httlresult.java:46) at Org.apache.struts2.dispatcher.StrutsResultSupport.execute (strutsresultsupport.java:188) at Com.opensymphony.xwork2.DefaultActionInvocation.executeResult (defaultactioninvocation.java:369) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (defaultactioninvocation.java:273) at Org.apache.struts2.interceptor.DeprecationInterceptor.intercept (deprecationinterceptor.java:41) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (defaultactioninvocation.java:244) at Org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept (debugginginterceptor.java:256) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept ( defaultworkflowinterceptor.java:167) at Com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept ( methodfilterinterceptor.java:98) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke ( defaultactioninvocation.java:244) at Com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept ( validationinterceptor.java:265) at Org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept ( annotationvalidationinterceptor.java:76) at Com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (methodfilterinterceptor.java:98) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept (conversionerrorinterceptor.java:138) ...... 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Integration of Httl to Struts2 in eclipse

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.