0
我有一些隱藏的tr值。我如何將它傳遞給struts中的操作2.單擊供應商名稱時,我希望隱藏值可用。Struts 2-如何獲取操作類中隱藏的td值
我的JSP代碼是:
<s:iterator value="vendorDetailsListFE" var = "vendorDetail" status="incr">
<tr class= "ListRow0">
<td class="ListItem"><a href="addVendor.action?&action=update"><s:property value="#vendorDetail.vendorName" /></a> </td>
<td class="ListItem"><s:property value="#vendorDetail.vendorTypeDesc" /> </td>
<td><s:hidden name="hiddenVendorId" value="#vendorDetail.vendorId"></s:hidden>
</td>
</tr>
我的Java代碼:
public class VendorAction extends BaseAction {
private String hiddenVendorId;
public void setHiddenVendorId(String hiddenVendorId) {
this.hiddenVendorId = hiddenVendorId;
}
public String createOrUpdateVendor(){
LOGGER.info("entering createOrUpdateVendor method");
String actionReturn;
LOGGER.info("entering createOrUpdateVendor");
String action = getServletRequest().getParameter("action");
LOGGER.info("action"+action);
vendorTypeDetailsDomainList = adminManager.findAllVendorType();
LOGGER.info(vendorTypeDetailsDomainList.length + "vendorTypeDetailsDomainList.size");
for(VendorDetails vendorDetailsBean : vendorTypeDetailsDomainList){
Vendor vendorType = new Vendor();
vendorType.setVendorTypeId(vendorDetailsBean.getVendorTypeId());
vendorType.setVendorTypeDesc(vendorDetailsBean.getVendorTypeDesc());
vendorTypeDetailsListFE.add(vendorType);
}
if(action.equalsIgnoreCase("create")){
vendor = new Vendor();
vendor.setActiveFlag("true");
//actionReturn = "createVendor"
} else {
LOGGER.info("action"+action);
vendor = new Vendor();
LOGGER.info(getHiddenVendorId()+"VENDOR ID");
}
return "success";
}
}
我越來越隱蔽一個空值。請建議如何在java中獲取td的隱藏值。
如果隱藏值爲空,則應該將其作爲字符串獲取。 –