安装eclipse过程4.8怎么安装velocity

修正思路:不让openfire的pluginServlet自动加载类springmvc的DispatcherServlet改成在插件初始化的时候手动将DispatcherServlet注册到PluginServlet中.
1.web-custom.xml不定义DispatcherServlet.
2.自定义一个CustomDispatcherServlet,继承DispatcherServlet,在其构造方法中指定springMvc的配置文件路径,并且修改 配置文件中velocityConfigurer节点下的 resourceLoaderPath值.
import java.io.F
import org.springframework.web.servlet.DispatcherS
import com.aomaisoft.openfire.plugin.usionmrg.web.tools.XMLE
* 自定义DispatcherServlet,指定context位置
* @author 20005
* @createDate
上午11:10:59
public class CustomDispatcherServlet extends DispatcherServlet {
private static final long serialVersionUID = 1313468L;
public CustomDispatcherServlet() {
String pluginDir =
Character fileSep = File.separatorC
String contextConfigLocation = pluginDir + fileSep + "java" + fileSep
+ "PluginServlet-servlet.xml";
// 更改模板目录
XMLEditor.alterXML(pluginDir, contextConfigLocation);
contextConfigLocation = "file:/" + contextConfigL
super.setContextConfigLocation(contextConfigLocation);
附上XMLEditor代码 ,依赖dom4j.jar,可以到 http://www.java2s.com/去下载
import java.io.F
import java.io.FileOutputS
import java.io.IOE
import java.util.HashM
import java.util.M
import org.dom4j.D
import org.dom4j.DocumentE
import org.dom4j.E
import org.dom4j.io.OutputF
import org.dom4j.io.SAXR
import org.dom4j.io.XMLW
* xml节点修改
* @author 20005
* @createDate
下午04:35:47
public class XMLEditor {
public static Document read(String fileName) {
SAXReader reader = new SAXReader();
Map&String, String& nsMap = new HashMap&String, String&();
nsMap.put("beans", "http://www.springframework.org/schema/beans");
reader.getDocumentFactory().setXPathNamespaceURIs(nsMap);
reader.setEncoding("UTF-8");
Document document =
document = reader.read(new File(fileName));
} catch (DocumentException e) {
e.printStackTrace();
public static void alterXML(String newValue, String url) {
OutputFormat format = new OutputFormat("\t", true);
format.setEncoding("UTF-8");
Document document = read(url);
Element node = ((Element) document
.selectSingleNode("//beans:property[@name='resourceLoaderPath']"))
.element("value");&span style="white-space:pre"&
&/span&//此处路径要做相应的修改,为你的模板路径
String string = "file:/%s\\web\\WEB-INF\\template";
string = String.format(string, newValue);
node.setText(string);
// 重新写入到XML文档
XMLWriter writer = new XMLWriter(new FileOutputStream(url), format);
writer.write(document);
writer.close();
} catch (IOException e) {
e.printStackTrace();
3.在插件初始化时手动注册到PluginServlet中
public void initializePlugin(PluginManager manager, File pluginDirectory) {
// 得到spring mvc配置文件路径,修改成你相应的路径,我是放在web-inf下的
File webXML = new File(pluginDirectory.toString() + File.separatorChar
+ "web" + File.separatorChar + "WEB-INF" + File.separatorChar
+ "springMVC.xml");
// 注册servlet
PluginServlet.registerServlets(manager, this, webXML);
4.完成,测试.
spring配置文件部分代码
&!-- 视图解析 --&
&bean id="viewResolver"
class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"&
&!-- 在src目录下新建文件夹template用来存在velocity模板文件 --&
&property name="prefix" value="/" /&
&property name="suffix" value=".html" /&
&property name="contentType" value="text/charset=utf-8"&&/property&
&bean id="velocityConfigurer"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"&
&property name="resourceLoaderPath"&
&value&&!-- 先不填,在程序中指定 --&
&/property&
&property name="velocityProperties"&
&prop key="input.encoding"&
&prop key="output.encoding"&
&/property&
没有更多推荐了,eclipse绑定sts下载
[问题点数:0分]
本版专家分:0
结帖率 47.09%
CSDN今日推荐
匿名用户不能发表回复!
其他相关推荐
Eclipse Mar 4.5.2版本安装Spring Tool Suite(STS)
可以采用直接普通在线安装或者离线安装(Help-&Install New Software)【试过,但是没有安装成功过,网上好像有人安装成功过】 不成功的话,可以选择使用Eclipse Marketplace(Help-&Eclipse Marketplace)【亲试成功!!!】
(1)在Eclipse中的He
使用Eclipse Neon安装Spring Tool Suite报错:
Cannot complete the install because one or more required items could not be found.
Software being installed: Spring IDE OSGi Extension (optional) 3.8.
sts是spring官方在eclipse基础上加了很多插件之后封装的开发工具。sts与eclipse完全一样,但是多了很多插件,比如maven,使用起来更加方便。如果使用eclipse自行安装maven插件会很麻烦,推荐以后都使用sts。sts各版本官方下载地址:https://spring.io/tools/sts/legacy。
sts最新版目前是3.7.3,这个版本要求jvm环境是1.8。
1. Spring Tool Suite(sts)简介Spring Tool Suite(sts)就是一个基于Eclipse的开发环境, 用于开发Spring应用程序.。它提供了一个现成的使用环境来实现, 调试, 运行, 和部署你的Spring应用程序。包括为关键的的服务器和云计算,Git, Maven, AspectJ, 和最新的Eclipse版本提供整合支持。换句话说, Spring Tool
原文地址:veloedit github 地址采用在线安装方式安装地址:
https://raw.githubusercontent.com/vaulttec/veloedit/updatesite/安装失败(可能网络原因),折腾半天终于安装成功。以下内容与veloedit安装无关接着安装以下插件:http://download.eclipse.org/eclipse/updates/4.5等待安
自己曾在学习spring时,在eclipse EE中安装springsource Tool Suite插件浪费了很多时间,不管是离线,在线还是在eclipse marketplace中安装,尝试了许多方法,结果要么是安装不成功,要么就是安装成功了,eclipse中自带的maven插件又无缘无故消失了。难道“鱼与熊掌,不可兼得”?我就怀疑难道eclipse EE中的maven插件和springsou
Cannot complete the install because one or more required items could not be found.
Software being installed: Spring IDE OSGi Extension (optional) 3.8.3.-RELEASE (org.springframework.ide.
最近重装系统,由于之前在安全盘中留档的eclipse和相关插件版本过旧,故而决定重新安装。mysql,tomcat部分插件的安装部分略过不表(应该有蛮多的资源可以参考,if真有问题的话),切入重点,即安装STS插件。
最新的eclipse java ee neon 版本为 4.6.1.XXXX,所以从http://spring.io/tools/sts/all直接下载updatesite
SVN插件 ADT插件下载 方便使用eclipse,STS的朋友
安装sts弄了好久一直加载失败,使用最新版的eclipse4.8安装sts一直失败,这个版本是4.7的,给大家分享下每日站长统计
&&IP:432 条
&&IP:109 条
&&IP:323 条
操作总数:943 条
运行天数:600 天
建站时间:
最后更新:
每日站长统计
&&IP:432 条
&&IP:109 条
&&IP:323 条
操作总数:943 条
运行天数:600 天
建站时间:
最后更新:
闹市重声(默认)
用户名或电子邮件地址}

我要回帖

更多关于 eclipse安装教程 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信