struts2 晕死好像稍微改了下web.xml就出问题了郁闷死
TOMCAT提示如下
严重: Expression parameters.name is undefined on line 23, column 32 in template/simple/checkbox.ftl.
Expression parameters.name is undefined on line 23, column 32 in template/simple/checkbox.ftl.
The problematic instruction:
----------
==> ${parameters.name?html} [on line 23, column 30 in template/simple/checkbox.ftl]
in include "/${parameters.templateDir}/simple/checkbox.ftl" [on line 108, column 25 in template/xhtml/checkbox.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression parameters.name is undefined on line 23, column 32 in template/simple/checkbox.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.Expression.getStringValue(Expression.java:118)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.StringBuiltins$StringBuiltIn._getAsTemplateModel(StringBuiltins.java:71)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Environment.include(Environment.java:1483)
at freemarker.core.Include.accept(Include.java:169)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Environment.process(Environment.java:190)
at freemarker.template.Template.process(Template.java:237)
at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)
部分如上
-------------------------------我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
-----------------------------我的strruts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.i18n.encoding" value="GB18030"></constant>
<package name="default" extends="struts-default" namespace="/">
<!-- 定义拦截器 -->
<interceptors>
<interceptor name="instance" class="com.webhomework.util.InstanceInterceptor"></interceptor>
<interceptor-stack name="mystack">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="instance"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="mystack"></default-interceptor-ref>
<!-- 登入请求 -->
<action name="login" class="com.universalone.action.UniversaloneAction" method="checklogin">
<result name="success">index.jsp</result>
<result name="error">login.jsp</result>
</action>
</package>
</struts>
原本可以的 后来先是ognl明明taglib声明了 还是不能用 然后网上查了下方法 不知怎么来了下就这么悲剧了 求大神救救啊
[解决办法]
Expression parameters.name is undefined on line 23, column 32 in template/simple/checkbox.ftl.
在这个checkbox.ftl文件中23行,32列处引用的parameters未定义,也就是null,楼主应该把这个文件贴出来或者再仔细查下
[解决办法]
对了 好像checkbox.ftl有问题
[解决办法]
Expression parameters.name is undefined on line 23, column 32 in template/simple/checkbox.ftl.
[解决办法]
检查你的freemarker配置,你不用它干嘛要把写一个freemarker文件呢?你freemarker里的parameters未定义,或者parameters中没有name变量,或者parameters中的name没有setter、getter方法。