好的,我几乎通过这种方式解决了大部分问题。
这是我的 JSP(这只是表格的一行,但其余的遵循相同的方案):'code
<form id="checkStatusForm" action="<%= model.getUri() %>" method="post" >
<input type="hidden" name="<%=FrameworkConstants.FRAMEWORK_COMMAND%>" value="checkstatus" />
<input type="hidden" name="<%=FrameworkConstants.FRAMEWORK_GUID%>" value="<%=model.getPageId()%>" />
<input type="hidden" name="regionID" id="regionID" value="" />
<input type="hidden" name="regionAction" id="regionAction" value="" />
<img src="<%=request.getContextPath() %>/images/up.jpg" alt="" name="modelUp" width="20" height="20" id="modelUp" onclick="CheckStatus.performRegionAction('model', 'up')" />
<img src="<%=request.getContextPath() %>/images/down.jpg" alt="" name="modelDown" width="20" height="20" id="modelDown" onclick="CheckStatus.performRegionAction('model', 'down')" />
<img src="<%=request.getContextPath() %>/images/refresh.png" alt="" name="modelRefresh" width="20" height="20" id="modelRefresh" onclick="CheckStatus.performRegionAction('model', 'refresh')" />
<button type="submit" style="margin-left: 2px; margin-top: 5px; margin-bottom: 0px;" >Commit Changes</button>
</form>
'
这是我的 jQuery/Javascript:'代码
performRegionAction : function(regionID, regionAction){
document.getElementById('regionID').value = regionID;
document.getElementById('regionAction').value = regionAction;
},'
最后是我的 Java:'
public void setRegionID(Field<String> regionID){
this.regionID = regionID;
}
public Field<String> getRegionID(){
return this.regionID;
}
public void setRegionAction(Field<String> regionAction){
this.regionAction = regionAction;
}
public Field<String> getRegionAction(){
return this.regionAction;
}
'