Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/25.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
Struts2 freemarker未提交表单字段_Struts2_Freemarker - Fatal编程技术网

Struts2 freemarker未提交表单字段

Struts2 freemarker未提交表单字段,struts2,freemarker,Struts2,Freemarker,这太基本了,我简直不敢相信我已经花了整整一天的时间 好的,这是我的免费标记页面 bla bla bla <form name="message" action="[@s.url action="login"/]" onsubmit="return detectJavaScript();" method="post"> <fieldset> <legend>To begin, type your Graduation Report

这太基本了,我简直不敢相信我已经花了整整一天的时间

好的,这是我的免费标记页面

    bla bla bla
<form name="message" action="[@s.url action="login"/]" onsubmit="return detectJavaScript();" method="post">
    <fieldset>
        <legend>To begin, type your Graduation Report ID and password</legend>
        <ol>
            <li>
                [@requiredInstruction /]
                <label for="username" accesskey="U">
                    [@requiredField /] <strong>Graduation Report ID:</strong>
                </label>
                <input id="username" name="username" size="10" tabindex="1" type="text" value="${username!''}"
                    [@errorStyle show=(fieldErrors?exists && fieldErrors["username"]?exists)/] />
                [@showFieldError field="username" /]
            </li>
            <li>
                <label for="password" accesskey="P">
                    [@requiredField /] <strong>Password:</strong>
                </label>
                <input id="password" name="password" size="10" tabindex="2" type="password" value="${password!''}" 
                    [@errorStyle show=(fieldErrors?exists && fieldErrors["password"]?exists)/] />
                [@showFieldError field="password" /]
            </li>
bla bla bla
还有我的struts文件

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <!-- <include file="com/paritysys/util/struts.xml" /> -->

    <constant name="struts.url.includeParams" value="none" />
    <constant name="struts.action.extension" value="html,action" />

    <package name="public" extends="struts-default">
        <interceptors>
            <interceptor name="websiteOnline"
                class="parity.action.website.OnlineInterceptor" />
            <interceptor name="websiteLogin"
                class="parity.action.website.LoginInterceptor" />

            <interceptor-stack name="appStack">
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
                <interceptor-ref name="workflow"/>
                <interceptor-ref name="modelDriven"/>
                <!-- <interceptor-ref name="paritySessionStack"/> -->
                <interceptor-ref name="websiteOnline" />
                <interceptor-ref name="websiteLogin" />
            </interceptor-stack>
        </interceptors>

        <default-interceptor-ref name="appStack" />

        <global-results>
            <result name="login" type="redirectAction">
                <param name="actionName">index</param>
            </result>
            <result name="exception" type="freemarker">/public/error.html.ftl</result>
            <result name="error" type="freemarker">/public/error.html.ftl</result>
            <result type="freemarker" name="maintenance">/public/maintenance.html
            </result>
            <result type="freemarker" name="pre-offline">/public/pre-offline.html
            </result>
            <result type="freemarker" name="post-offline">/public/post-offline.html
            </result>
        </global-results>

        <action name="index" class="parity.action.website.LoginAction">
            <result type="freemarker" name="success">/public/index.html.ftl</result>
        </action>

        <action name="login" class="parity.action.website.SubmitLoginAction">
            <result type="freemarker" name="success">/public/questionnaire.html.ftl
            </result>
            <result type="freemarker" name="input">/public/index.html.ftl</result>
        </action>

        <action name="submit" class="parity.action.website.SubmitQuestionnaireAction">
            <result type="freemarker" name="success">/public/thanks.html.ftl
            </result>
            <result type="freemarker" name="input">/public/questionnaire.html.ftl
            </result>
        </action>

        <action name="whereIsMyId" class="parity.action.website.LoginAction">
            <result type="freemarker" name="success">/public/whereIsMyId.html.ftl
            </result>
        </action>

        <action name="loadCollegeFinder" class="parity.action.website.LoadCollegeFinderAction">
            <result type="freemarker" name="success">/public/college_finder.html.ftl
            </result>
        </action>

        <action name="findCollege" class="parity.action.website.FindCollegeAction">
            <result type="freemarker" name="success">/public/college_finder.html.ftl
            </result>
            <result type="freemarker" name="input">/public/college_finder.html.ftl
            </result>
        </action>
    </package>
</struts>

输入、返回、取消、浏览
指数
/public/error.html.ftl
/public/error.html.ftl
/public/maintenance.html
/public/pre-offline.html
/public/post-offline.html
/public/index.html.ftl
/public/inventory.html.ftl
/public/index.html.ftl
/public/thank.html.ftl
/public/inventory.html.ftl
/public/whereIsMyId.html.ftl
/public/college_finder.html.ftl
/public/college_finder.html.ftl
/public/college_finder.html.ftl
无论我做什么,它都会为用户返回null并传递。我试过用能手和二传手,没有,似乎什么都不起作用


我原以为这是struts的一个开箱即用的东西。

是的,但你已经把它从盒子里拿出来,并把它的部分重新排列了一遍

您已经从默认拦截器堆栈中删除了“params”拦截器。“params”拦截器用于设置操作的参数。我在信中提到了这一点

(同时无需继续键入“freemarker”。)


(顺便说一句,我真的不推荐公共属性,尽管它会起作用,这取决于你的Struts版本——IIRC OGNL版本的一个颠簸改变了这一点。)

是的,我重新阅读了那篇文章,意识到我做了什么。我重组了拦截器,并将strutsdefault添加到拦截器中。这让我甚至都不知道的作品重新上线了。其实很有趣。这是对现有项目的修改,因此我必须遵循与先前供应商相同的设计风格。我迫不及待地想摆脱这个东西并彻底检查后端。@scphantm是的,拦截器中包含了很多(大部分)功能——我很早就学会了先检查它们,以确保我在做我认为我在做的事情:/
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <!-- <include file="com/paritysys/util/struts.xml" /> -->

    <constant name="struts.url.includeParams" value="none" />
    <constant name="struts.action.extension" value="html,action" />

    <package name="public" extends="struts-default">
        <interceptors>
            <interceptor name="websiteOnline"
                class="parity.action.website.OnlineInterceptor" />
            <interceptor name="websiteLogin"
                class="parity.action.website.LoginInterceptor" />

            <interceptor-stack name="appStack">
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
                <interceptor-ref name="workflow"/>
                <interceptor-ref name="modelDriven"/>
                <!-- <interceptor-ref name="paritySessionStack"/> -->
                <interceptor-ref name="websiteOnline" />
                <interceptor-ref name="websiteLogin" />
            </interceptor-stack>
        </interceptors>

        <default-interceptor-ref name="appStack" />

        <global-results>
            <result name="login" type="redirectAction">
                <param name="actionName">index</param>
            </result>
            <result name="exception" type="freemarker">/public/error.html.ftl</result>
            <result name="error" type="freemarker">/public/error.html.ftl</result>
            <result type="freemarker" name="maintenance">/public/maintenance.html
            </result>
            <result type="freemarker" name="pre-offline">/public/pre-offline.html
            </result>
            <result type="freemarker" name="post-offline">/public/post-offline.html
            </result>
        </global-results>

        <action name="index" class="parity.action.website.LoginAction">
            <result type="freemarker" name="success">/public/index.html.ftl</result>
        </action>

        <action name="login" class="parity.action.website.SubmitLoginAction">
            <result type="freemarker" name="success">/public/questionnaire.html.ftl
            </result>
            <result type="freemarker" name="input">/public/index.html.ftl</result>
        </action>

        <action name="submit" class="parity.action.website.SubmitQuestionnaireAction">
            <result type="freemarker" name="success">/public/thanks.html.ftl
            </result>
            <result type="freemarker" name="input">/public/questionnaire.html.ftl
            </result>
        </action>

        <action name="whereIsMyId" class="parity.action.website.LoginAction">
            <result type="freemarker" name="success">/public/whereIsMyId.html.ftl
            </result>
        </action>

        <action name="loadCollegeFinder" class="parity.action.website.LoadCollegeFinderAction">
            <result type="freemarker" name="success">/public/college_finder.html.ftl
            </result>
        </action>

        <action name="findCollege" class="parity.action.website.FindCollegeAction">
            <result type="freemarker" name="success">/public/college_finder.html.ftl
            </result>
            <result type="freemarker" name="input">/public/college_finder.html.ftl
            </result>
        </action>
    </package>
</struts>