简体   繁体   English

Struts 1.x:不显示表单

[英]Struts 1.x: Form isn't shown

I have a form like this, in a .jsp page (using Struts + Tiles): 我在.jsp页面(使用Struts + Tiles)中具有这样的形式:

<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html:xhtml/>

<div id="content">

    <html:form action="action_newPost" method="post">
        <table>

            <tr>
                <td>Titulo (150 Caracteres Máximo)</td>
            </tr>
            <tr>
                <td><html:text property="titulo" size="45"/><br/>
                <html:errors property="tituloError"/></td>
            </tr>
            <tr>
                <td>Post (1000 Caracteres Máximo)</td>
            </tr>
            <tr>
                <td><html:textarea property="contenido" cols="80" rows="7"/><br/>
                <html:errors property="cuerpoError"/></td>
            </tr>
        </table>

        <input type="submit" value="Publicar"/>
    </html:form>

</div>

The problem is that the form isn't shown, unless I change the action to another (called action_EnviarMsg). 问题是除非我将动作更改为另一个动作(称为action_EnviarMsg),否则不会显示该表单。 Why could this be happening? 为什么会这样呢? If you need the rest of the code (struts-config, tiles-defs or something) tell me to put it here... 如果您需要其余代码(struts-config,tiles-defs或其他内容),请告诉我将其放在此处...

Thanks! 谢谢!

I think for what you are saying that there could be a problem with the forward of your action, you should make sure that the forward of your action points to your tile definition it would be something like this. 我认为您要说的是动作的前进可能有问题,您应该确保动作的前进指向您的图块定义,就像这样。

struts-config.xml struts-config.xml中

<action path="/somepath" type="yourpackage.YourAction"><br/>
    <forward name="YourForward" path="tiledefinition" /><br/>
</action>

tiles-def.xml 瓷砖,def.xml

<definition name="tiledefinition" ><br/>
    <put name="body" value="/jsp/your-form.jsp" /><br/>
</definition>

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM