AngularJS与Velocity一起发生奇怪的错误(挖坑)

前端之家收集整理的这篇文章主要介绍了AngularJS与Velocity一起发生奇怪的错误(挖坑)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
AngularJS与Velocity整合,发生错误
HTTP ERROR 500

Problem accessing /code. Reason:

    Lexical error,Encountered: "(" (40),after : "" at code.html[line 142,column 61]

Caused by:

org.apache.velocity.exception.ParseErrorException: Lexical error,column 61]
	at org.apache.velocity.Template.process(Template.java:151)
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:437)
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
	at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
	at org.springframework.web.servlet.view.velocity.VelocityView.getTemplate(VelocityView.java:501)
	at org.springframework.web.servlet.view.velocity.VelocityView.getTemplate(VelocityView.java:484)
	at org.springframework.web.servlet.view.velocity.VelocityView.doRender(VelocityView.java:462)
	at org.springframework.web.servlet.view.velocity.VelocityView.renderMergedTemplateModel(VelocityView.java:292)
	at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
html页面相关的代码
<script>
	$(function(){
		$('#fullpage').fullpage({
			sectionsColor: ['#1bbc9b','#4BBFC3','#7BAABE','#f90'],//背景颜色
			anchors: ['page1','page2','page3','page4'],//			navigation: true,//显示导航 默认右侧
//			navigationTooltips: ['fullPage.js','Powerful','Amazing','Simple'],loopBottom: true,//滑道底部回到顶部
			scrollOverflow: true,//一屏超出范围显示滚动条
		});
	});
	var app = angular.module('resultApp',[]);
	app.controller('myResult',function($scope,$http) {
		alert("myResult");
		$http.post("/compile_java").success(function(){
					alert("cccc");
			$scope.result = "Doe";
		});
	});
</script>
$http.post("/compile_java")没问题,可以请求到后台的资源,但是如果跟上.success就会报错,可能是velocity与angular不兼容吧,具体原因不明。 原文链接:https://www.f2er.com/angularjs/149171.html

猜你在找的Angularjs相关文章