【问题标题】:Cannot find bean org.apache.struts.taglib.html.BEAN in any scope在任何范围内都找不到 bean org.apache.struts.taglib.html.BEAN
【发布时间】:2014-06-01 00:47:20
【问题描述】:

我有一个包含五个选项卡的表单。在其中一个选项卡(background.jsp)中更改复选框(选中或未选中)我试图将jsp中的(hasGenderChanged)标志设置为true并使用请求类型将其发送到我的java代码。

下面是代码结构。我收到一条错误消息:在edit_Education.jsp 的任何范围内都找不到bean org.apache.struts.taglib.html.BEAN。下面是代码结构。任何帮助将不胜感激。

Introduction.jsp 包含所有标题选项卡,并且在它的末尾有 单击此页面中的保存按钮时,如果在填写表格期间更改了复选框,我想发送。如果更改想要从 JSP 向 java 组件发送 true。

在edit_Education.jsp中:

<template: insert template='education/Introduction.jsp'>

    <logic:equal name="educationForm" property="selectedOption" value="0">
        <template:put name='content-area' content='education/background.jsp'/>
    </logic:equal>

    <logic:equal name="educationForm" property="selectedOption" value="1">
        <template:put name='content-area' content='education/eduqualification.jsp'/>
    </logic:equal>

    <logic:equal name="educationForm" property="selectedOption" value="2">
        <template:put name='content-area' content='education/workexperience.jsp'/>
    </logic:equal>
</template: insert

由于每个选项卡上的表单都很大,我只想在 background.jsp 中的复选框已成为复选框时触发操作

在后台.jsp中

在复选框的 html 标签内,这是我拥有的功能

<script>
function validate(){

    document.educationForm.hasGenderChanged.value="true";
}
<html:form action="/processEducationAction" target="CONTENT-AREA">
<html: hidden property="hasGenderChanged"/>
<input type="hidden" name="hasGenderChanged" value="" scope="request"/>


</script>

<TR>
    <html:checkbox property="selectOptions.selectGender" onchange="validate()"/>
    <bean:message key="education.selectedOptions.label.selectGender"/>
<TR>
</html:form>

在educationForm.java 我有一个布尔hasGenderChanged;用于此的变量以及 setter 和 getter。

我不确定如何在 edit_Education.jsp 中设置 background.jsp 中的 hasGenderChanged 值。

我是 Struts 的新手。在此先感谢您的帮助。

【问题讨论】:

    标签: java jsp struts-1


    【解决方案1】:

    也许您应该尝试将标签放在表单中

       <template: insert template='education/Introduction.jsp'>
    
          <html:form>
    
            <logic:equal name="educationForm" property="selectedOption" value="0">
                <template:put name='content-area' content='education/background.jsp'/>
            </logic:equal>
    
            <logic:equal name="educationForm" property="selectedOption" value="1">
                <template:put name='content-area' content='education/eduqualification.jsp'/>
            </logic:equal>
    
            <logic:equal name="educationForm" property="selectedOption" value="2">
                <template:put name='content-area' content='education/workexperience.jsp'/>
            </logic:equal>
    
          </html:form>  
    
        </template: insert>
    

    请注意两个&lt;html:form&gt; &lt;/html:form&gt; 标签

    【讨论】:

    • 再次我们可以立即看到一个关于在 html 表单标签中未指定动作属性的问题。每个表单标签都应该并且必须指定动作标签以克服编译错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-23
    • 2021-06-18
    • 2021-01-15
    • 1970-01-01
    相关资源
    最近更新 更多