如果您想了解Expressionparameters.parseContentisundefinedonline45,column28intemplate/ajax/head.ftl.-C的知识,那么
如果您想了解Expression parameters.parseContent is undefined on line 45, column 28 in template/ajax/head.ftl. - C的知识,那么本篇文章将是您的不二之选。同时我们将深入剖析ajax 调用 .net core WebAPI,报错 400 (Bad Request) Unexpected character encountered while parsing value、An error happened during template parsing (template: "class path resource [templates/index.h...、Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in、com.xfltr.hapax.parser.TemplateParserException: Unexpected or malformed input的各个方面,并给出实际的案例分析,希望能帮助到您!
本文目录一览:- Expression parameters.parseContent is undefined on line 45, column 28 in template/ajax/head.ftl. - C
- ajax 调用 .net core WebAPI,报错 400 (Bad Request) Unexpected character encountered while parsing value
- An error happened during template parsing (template: "class path resource [templates/index.h...
- Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in
- com.xfltr.hapax.parser.TemplateParserException: Unexpected or malformed input
Expression parameters.parseContent is undefined on line 45, column 28 in template/ajax/head.ftl. - C
在struts-2.2.3.1中加入<s:head theme="ajax"/>这个标签,报错Expression parameters.parseContent is undefined on line 45,column 28 in template/ajax/head.ftl. - Class: freemarker.core.TemplateObject File: TemplateObject.java出错,后网上一查原因为出现此问题的原因:在jsp页面用到了struts提供的ajax主题,但是声明主题时出现问题,struts2.0到struts2.1有一个重要的改变就是对ajax支持的改变,struts2.0的ajax支持主要以DWR和dojo为主,并专门提供ajax主题,如:<s:head theme="ajax"/>,但是在struts2.1不在提供ajax主题,而将原来的ajax主题放入了dojo插件中,我们需要将dojo标签引入到jsp页面, 在改为<%@ taglib uri="/struts-tags" prefix="s" %><%@ taglib uri="/struts-dojo-tags" prefix="sd" %>后又出现异常Attribute theme invalid for tag head according to TLD
经过一下午的网上查询,终于找到答案了,至于异常原因也没明说,又将上面
页面上<sd:head theme="ajax" />改成下面这两行,其他的不用改:
<s:head theme="xhtml"/>
<sd:head parseContent="true"/>问题解决了。希望遇到同样问题的朋友对你有所帮助
ajax 调用 .net core WebAPI,报错 400 (Bad Request) Unexpected character encountered while parsing value
此文由博主前两天的提问及 dudu 的回答整理,地址:https://q.cnblogs.com/list/myquestion
情况说明
基于 .net core 写了一个 Web API,用 postman 测试时,能够 POST 返回数据,但是用 ajax 调用 API 时就会报错(400)。
前端 ajax 调用报错
postman 调用正常
服务端相关代码
[HttpPost]
public async Task<ActionResult<List<Flow>>> PostFlow([FromBody] PostParams data) // dynamic
{
return await _context.Set<Flow>().Where(s => data.Czid.Contains(s.Czid) && s.Rq >= data.Begin && s.Rq <= data.End).ToListAsync(); } public class PostParams { public DateTime Begin { get; set; } public DateTime End { get; set; } public int[] Czid { get; set; } }
前端 ajax
$.ajax({
type: "POST",
url: "http://localhost/rfapi/api/flow",
data: {"czid": ["1"], "begin": "2017-03-30 00:00:00", "end": "2017-03-31 00:00:00"}, contentType: "application/json", async: true, dataType: "json", success: function(data) { console.log(data.length); }, error: function(err) { console.log(err); } });
关于此 Web API 的搭建过程,可参考 .net core WebAPI 初探及连接 MySQL
解决方法
要用 JSON.stringify 将 js 对象转换为 json 字符串
data: JSON.stringify({"czid": ["1"], "begin": "2017-03-30 00:00:00", "end": "2017-03-31 00:00:00"})
感谢 dudu 的解惑。
An error happened during template parsing (template: "class path resource [templates/index.h...
转自 https://blog.csdn.net/qq_41426326/article/details/88837112
在开发 springboot 的时候,进行 modelAndView 视图层映射的时候,一直出现
An error happened during template parsing (template: "class path resource [templates/index.html]")
模板解析过程中发生错误 (模板:“类路径资源 [templates/index.html]”)
在向 index.html 映射的时候出现错误,小编在和其他程序员一样打开了百度开始搜索,有各种说法
1. 配置文件问题.(我重新看了一遍确定没有问题,但是还是错误)
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.encoding=utf-8
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.cache=false
spring.mvc.static-path-pattern=/**
spring.resources.static-locations=classpath:/static/
2. 说是 @Controller 和 @RestController 功能不一样,将 @Controller 修改为 @RestController 在加上 @ResponseBody (依然无效)、
3. 说在映射的时候实体类没有 get 方法,为变量加上 get 就可以了(结果我本来就有 get 方法的)
4. 还有说在 pom.xml 文件下的 build 配置 (都不是这个错误的解决方案)
<resources>
<resource>
<directory>sre/main/resources</directory>
</resource>
</resources>
最后小编早上智商最高峰的时候发现了这个小小小问题
在这附上小编 index.html 的文件开头,就是因为加了
https: xmlns:https="http://www.w3.org/1999/xhtml"
和
xmlns:th="http://www.thymeleaf.org"
导致调用的时候原本要调用第二句话的代码调用了第一句代码中的方法发生错误,把第一句代码删除就可以了
小编总结了一下,一般系统出现以下错误
An error happened during template parsing (template: "class path resource [templates/index.html]")
大家可以去看看视图层,并不是 java 代码出现错误.
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in
1、错误描述
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDeFinitionStoreException: Line 1 in XML document from file [E:\Eclipse\workspace\.Metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\sopss\WEB-INF\classes\spring\applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.doLoadBeanDeFinitions(XmlBeanDeFinitionReader.java:398) at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.loadBeanDeFinitions(XmlBeanDeFinitionReader.java:335) at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.loadBeanDeFinitions(XmlBeanDeFinitionReader.java:303) at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:180) at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:216) at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:187) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDeFinitions(XmlWebApplicationContext.java:125) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDeFinitions(XmlWebApplicationContext.java:94) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshbeanfactory(AbstractRefreshableApplicationContext.java:129) at org.springframework.context.support.AbstractApplicationContext.obtainFreshbeanfactory(AbstractApplicationContext.java:540) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextinitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$startChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$startChild.call(ContainerBase.java:1565) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. at org.apache.xerces.parsers.DOMParser.parse(UnkNown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(UnkNown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.doLoadDocument(XmlBeanDeFinitionReader.java:428) at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.doLoadBeanDeFinitions(XmlBeanDeFinitionReader.java:390) ... 22 more 四月 26,2015 10:10:18 下午 org.apache.catalina.core.StandardContext startInternal 严重: Error listenerStart 四月 26,2015 10:10:18 下午 org.apache.catalina.core.StandardContext startInternal 严重: Context [/sopss] startup Failed due to prevIoUs errors 四月 26,2015 10:10:18 下午 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 四月 26,2015 10:10:18 下午 org.apache.catalina.core.StandardContext listenerStop 严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.IllegalStateException: beanfactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefreshableApplicationContext.getbeanfactory(AbstractRefreshableApplicationContext.java:170) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:921) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:579) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5033) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5685) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160) at org.apache.catalina.core.ContainerBase$startChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$startChild.call(ContainerBase.java:1565) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 四月 26,2015 10:10:18 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-bio-8080"] 四月 26,2015 10:10:18 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-bio-8009"] 四月 26,2015 10:10:18 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in 25794 ms
2、错误原因
3、解决办法
com.xfltr.hapax.parser.TemplateParserException: Unexpected or malformed input
为什么我调用接口的时候会报这个错误呢,我检查了传入的值是没有问题的啊
今天的关于Expression parameters.parseContent is undefined on line 45, column 28 in template/ajax/head.ftl. - C的分享已经结束,谢谢您的关注,如果想了解更多关于ajax 调用 .net core WebAPI,报错 400 (Bad Request) Unexpected character encountered while parsing value、An error happened during template parsing (template: "class path resource [templates/index.h...、Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in、com.xfltr.hapax.parser.TemplateParserException: Unexpected or malformed input的相关知识,请在本站进行查询。
本文标签: