在 Jsp 页面上,我正在检索基于先前列表选择的列表,用于使用 struts 2 url 和 struts dojo 标签 div
<s:url id="d_url" action="employDivisionAction"/>
<sx:div showLoadingText="false" id="details1" href="%{d_url}" theme="ajax" listenTopics="show_division" onchange="show_Department()" formId="frm_demo"/>
在js文件中调用了这个函数
function show_Department()
{
dojo.event.topic.publish("show_department");
}
一切正常我能够检索列表但是当我尝试使用时出现问题
<s:file/>
jsp中的标签。当我包含上述标签时,ajax 功能停止工作。任何想法为什么它不起作用任何指导都会有所帮助。
完整的jsp代码
<s:form name="employee" action="AddEmployee" method="POST" theme="css_xhtml" enctype="multipart/form-data" id="frm_demo" >
<table align="center" cellspacing="10px">
<tr>
<td align="left"> <s:text name="global.empno"/> </td>
<td align="left"> <s:textfield name="employeeNo" value="%{employee.employeeNo}" onkeypress="return inputLimiter(event,'NameCharactersAndNumbers')"/> </td>
<td align="left"> <s:text name="global.fnm"/> </td>
<td align="left"> <s:textfield name="firstName" value="%{employee.firstName}" onkeypress="return inputLimiter(event,'NameCharacters')"/> </td>
</tr>
<tr>
<td><s:file name="Image"/></td>
</tr>
<tr>
<td align="left"> <s:text name="Company"/> </td>
<td align="left"><s:select name="currentCompany" id="companyList" headerKey="" headerValue="Select" list="companyList" onchange="show_branch()"/></td>
<td align="left"> <s:text name="Branch"/> </td>
<td align="left">
<div ><s:fielderror fieldName="branchName" /></div>
<s:url id="d_url" action="employBranchAction"/>
<sx:div showLoadingText="false" name="branchDiv" id="details" href="%{d_url}" theme="ajax" listenTopics="show_branch" onchange="show_division()" formId="frm_demo"/>
</td>
</tr>
<tr>
<td align="left"> <s:text name="Division"/> </td>
<td align="left">
<div ><s:fielderror fieldName="divisionName" /></div>
<s:url id="d_url" action="employDivisionAction"/>
<sx:div showLoadingText="false" id="details1" href="%{d_url}" theme="ajax" listenTopics="show_division" onchange="show_Department()" formId="frm_demo"/>
</td>
<td align="left"> <s:text name="Department"/> </td>
<td align="left">
<div><s:fielderror fieldName="departmentName" /></div>
<s:url id="d_url" action="employDepartmentAction"/>
<sx:div showLoadingText="false" id="details2" href="%{d_url}" theme="ajax" listenTopics="show_department" onchange="show_Section()" formId="frm_demo"/>
</td>
</tr>
<tr>
<td align="left"> <s:text name="Section"/> </td>
<td align="left">
<div><s:fielderror fieldName="sectionName" /></div>
<s:url id="d_url" action="employSectionAction"/>
<sx:div showLoadingText="false" id="details3" href="%{d_url}" theme="ajax" listenTopics="show_section" onchange="show_Unit()" formId="frm_demo"/>
</td>
<td align="left"> <s:text name="Unit"/> </td>
<td align="left">
<div ><s:fielderror fieldName="unitName" /></div>
<s:url id="d_url" action="employUnitAction"/>
<sx:div showLoadingText="false" id="details4" href="%{d_url}" theme="ajax" listenTopics="show_unit" onchange="show_Position()" formId="frm_demo"/>
</td>
</tr>
<tr>
<td align="left"> <s:label value="Position"/> </td>
<td align="left">
<div><s:fielderror fieldName="positionName" /></div>
<s:url id="d_url" action="employPositionAction"/>
<sx:div showLoadingText="false" id="details5" href="%{d_url}" theme="ajax" listenTopics="show_position" formId="frm_demo"/>
</td>
</tr>
</table>
<s:set name="webFramework" value="%{employee.employeeID}"/>
<table align="center" cellspacing="20px">
<tr>
<s:if test="#webFramework==0">
<td align="left"> <s:submit value="Add" cssClass="buttonSmall" onclick="return validateEmployee();"/> </td>
</s:if>
<s:if test="#webFramework>0">
<td align="left"> <s:submit name="update" cssClass="buttonSmall" value="Update"/> </td>
</s:if>
</tr>
</table>
</s:form>