Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Struts-Tiles操作错误_Struts_Nullpointerexception_Tiles - Fatal编程技术网

Struts-Tiles操作错误

Struts-Tiles操作错误,struts,nullpointerexception,tiles,Struts,Nullpointerexception,Tiles,下午好,在我的时区 我正在使用Struts tiles框架构建一个Web应用程序,我面临一个非常奇怪的问题。 我没有时间完成这项工作,如果我不能解决这个问题,我将放弃在这个项目中使用瓷砖。 我的Tiles配置非常简单。 在我的struts-config.xml中插入以下代码: <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" /> <plug-in className="

下午好,在我的时区

我正在使用Struts tiles框架构建一个Web应用程序,我面临一个非常奇怪的问题。 我没有时间完成这项工作,如果我不能解决这个问题,我将放弃在这个项目中使用瓷砖。 我的Tiles配置非常简单。 在我的struts-config.xml中插入以下代码:

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />

   <plug-in className="org.apache.struts.tiles.TilesPlugin" >
        <set-property property="definitions-config" value="/WEB-INF/tilesdefs.xml" />
        <set-property property="moduleAware" value="true" />
   </plug-in>

在tilesdefs.xml中,我有以下简单代码:

<component-definitions>
    <definition name="programarRutasTile" path="/programarRutas.jsp">
        <put name="menu" value="menu.jsp"/>
        <put name="tab" type="String" value="2"/>
    </definition>
</component-definitions>

在jsp“programarRutas.jsp”中,我有三行代码:

<tiles:insert  name="menu">
    <tiles:put name="tabSelected"><tiles:getAsString name="tab"/></tiles:put>
</tiles:insert>

jsp是简单的html代码,它利用了在programarRutas.jsp中传递的tabSelected属性(上面的代码)。 我已经尝试运行所有的menu.jsp页面,并且错误仍然存在。 现在我们来解释一下错误: 当我运行应用程序且ActionForm validate方法未发现任何错误时,应用程序将正常运行,如果ActionForm validate方法发现错误并填充ActionErrors数组,则应用程序将引发以下异常:

org.apache.struts.tiles.taglib.InsertTag.processName上的java.lang.NullPointerException…

当应用程序发现错误时,我可以运行的唯一方法是在programarRutas.jsp中注释Tiles行代码

//<tiles:insert  name="menu">
//  <tiles:put name="tabSelected"><tiles:getAsString name="tab"/></tiles:put>
//</tiles:insert>
//
//  
//
这样就没有抛出异常。根据我描述的这些症状,看起来某些配置文件中可能存在问题,但我不确定。 有人能帮我吗??? 顺致敬意,
提前感谢

输入应该是tile def,而不是直接链接到JSP。

经过进一步研究,我怀疑这与struts config.xml中的action标记中的input属性有关。在input属性中,我重定向到programarRutas.jsp,我想我应该重定向到Tiles定义,但如果我输入Tiles定义名称,它会给我一个错误,我的怀疑是否正确???是的,但您需要提供版本信息——IIRC,该功能曾一度存在(尽管我试图回忆10年前)。是的,您走的是正确的道路。如果Struts转发给布局JSP而不是tile,那么布局JSP无法知道它必须插入什么。我已经发现了问题。我在上述评论中描述的怀疑是正确的。struts-config.xml中的action标记的input属性中缺少开关。我从programarRutas.jsp切换到programarRutasTile并开始工作。我希望这对将来有帮助。无论如何,感谢您阅读这篇文章,特别是感谢Deve和JB。顺致敬意,