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

user3358472 picture user3358472 · Jun 1, 2014 · Viewed 13.1k times · Source

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.

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.

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.

In 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

In background.jsp

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

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

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

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

Answer

L Petre picture L Petre · Nov 20, 2014

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