3级联

疯狂的扣子 2011-12-08

//引入js文件

<script

src="<%=request.getContextPath()%>/js/getchildren.js"type="text/javascript"charset="utf-8"></script>

ACTION

@SuppressWarnings("unchecked")

publicActionForwardgetProductNodeByAjax(ActionMappingmapping,

ActionFormform,HttpServletRequestaRequest,

HttpServletResponseaResponse)throwsException

{

//设置返回的编码

aResponse.setContentType("text/json;charset=UTF-8");

//得到session

HttpSessionsession=aRequest.getSession();

//得到语种

Stringnls=(String)session.getAttribute(SupportConstants.CFG_NLS);

//查询接口

DDServicedDService=DDFactory.getInstance().getCommonDD();

//取得查询条件

StringproductLine=aRequest.getParameter("productLine");

StringproductFamily=aRequest.getParameter("productFamily");

PrintWriterout=null;

//webservice调用后的json对象

JSONArrayjsonArray=newJSONArray();

try{

if(null!=productLine

&&!"".equals(productLine.trim())

&&(null==productFamily||"".equals(productFamily.trim())))

{

//级联出产品族

ArrayListdList_family=

dDService.getItemsListByName("PRODUCT_FAMILY",productLine,nls);

jsonArray=com.huawei.it.support.poapply.actions.JsonUtil.listToJSONArray(dList_family);

}elseif(null!=productLine&&!"".equals(productLine.trim())

&&null!=productFamily

&&!"".equals(productFamily.trim())){

//级联出产品

ArrayListdList_product=

dDService.getItemsListByName("PRODUCT",productFamily,nls);

jsonArray=com.huawei.it.support.poapply.actions.JsonUtil.listToJSONArray(dList_product);

}

out=aResponse.getWriter();

out.print(jsonArray);

out.flush();

}catch(Exceptione)

{

e.printStackTrace();

throwe;

}finally{

if(null!=out){

out.close();

}

}

returnnull;

}

相关推荐

libowen0 / 0评论 2019-06-27