Java 在任何范围内都找不到 bean org.apache.struts.taglib.html.BEAN

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23975804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 09:29:20  来源:igfitidea点击:

Cannot find bean org.apache.struts.taglib.html.BEAN in any scope

javajspstruts-1

提问by user3358472

I have a form which has five tabs. In one of the tabs(background.jsp) on change of a checkbox(be in checked or unchecked) I am trying to set the flag of (hasGenderChanged) in jsp to true and use a request type to send it to my java code.

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

Below is the code structure. I am getting an error which reads: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope in edit_Education.jsp. Below is the code structure. Any help will be greatly appreciated.

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

Introduction.jsp has all the header tabs and at the end of it has On click of save button in this page I want to send if a check box has been changed during filling up a form. If changed want to send true to java component from JSP.

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

In edit_Education.jsp:

在 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

Since the forms on each tab are huge I want to trigger an action only if a checkbox has been checkbox in background.jsp

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

In background.jsp

在后台.jsp

Inside the html tags of a checkbox this is the function I have

在复选框的 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>

In educationForm.java I have a boolean hasGenderChanged; variable and setters and getters for this.

在educationForm.java 我有一个布尔值hasGenderChanged;变量和setter 和getter 为此。

I am not sure how this value, hasGenderChanged in background.jsp can be made accessable to in edit_Education.jsp.

我不确定如何在edit_Education.jsp 中访问background.jsp 中的hasGenderChanged 这个值。

I am a newbie in Struts.Thanks in advance for the help.

我是 Struts 的新手。提前感谢您的帮助。

回答by L Petre

perhaps you should try to place your tags inside a form

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

   <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>

please notice the two <html:form> </html:form>tags

请注意这两个<html:form> </html:form>标签