今天写struts2的错误

  1. 第一个出现的错误是找不到struts.xml这个错误,具体报错的忘记复制下来了,这是一个很蠢的错误,后来找到原因我都要打自己了,浪费时间。一开始我以为是struts的包没有导进去,然后就检查,又重新导,结果没用,然后就开始检查struts.xml文件,看看有没有配置错误,找了好久也没发现错误,重写了好几次,然后又百度什么的。都没发现原因。最后我仔细看了看,我每次写这个代码的时候都会新建一个包,然后把action代码放进里面,但是这次忘记了,直接就新建了Class,直接下代码了,当然没在com包里面了,但是我在struts.xml文件里写的class=”com.UserAction”当然是错误的了,很难受!!
  2. 第二个是
    The following has evaluated to null or missing:
    ==> parameters.id [in template “template/simple/radiomap.ftl” at line 67, column 8]

Tip: It’s the step after the last dot that caused this error, not those before it.

Tip: If the failing expression is known to be legally refer to something that’s null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing

- Reached through: #include “/${parameters.templateDir}… [in template “template/xhtml/radiomap.ftl” at line 24, column 1]

Java stack trace (for programmers):

freemarker.core.InvalidReferenceException: [… Exception message was already printed; see it above …]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:116)
at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:346)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82)
at freemarker.core.BuiltInForString._eval(BuiltInForString.java:26)
at freemarker.core.Expression.eval(Expression.java:78)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82)
at freemarker.core.DollarVariable.accept(DollarVariable.java:40)
at freemarker.core.Environment.visit(Environment.java:312)
at freemarker.core.MixedContent.accept(MixedContent.java:62)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:333)
at freemarker.core.Environment.visitAndTransform(Environment.java:413)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:108)
at freemarker.core.Environment.visit(Environment.java:312)
at freemarker.core.MixedContent.accept(MixedContent.java:62)
at freemarker.core.Environment.visit(Environment.java:312)
at freemarker.core.Environment.include(Environment.java:2074)
at freemarker.core.Include.accept(Include.java:165)
at freemarker.core.Environment.visit(Environment.java:312)
at freemarker.core.MixedContent.accept(MixedContent.java:62)
at freemarker.core.Environment.visit(Environment.java:312)
at freemarker.core.Environment.process(Environment.java:290)
at freemarker.template.Template.process(Template.java:312)
这么大长的一串,其实就是struts2标签用错了,看错误提示,其实是radio的标签没有写name,加上name就好了!

总结:这两个错误贼蠢,是自己不小心弄的,浪费了好多时间,以后要注意!!!

猜你喜欢

转载自blog.csdn.net/lx127372/article/details/81409815