页面显示问题(怎么把查询的数据库存入Map里呢???),谁指导下,代码如下!谢谢!
public Map getProxy(String host , String pyID) {
PoolConnection pConn = DbConnectionPoolManager.getInstance( "slave ").getPoolConnection();
Map map = new HashMap();
if (pConn == null)
return map;
Statement stmt = null;
ResultSet rs = null;
try {
stmt = pConn.getStatement();
rs = stmt.executeQuery( "select * from Proxy where PROXYID = ' " + pyID + " ' " );
int flag=0;
while (rs.next()) {
BaseProxy bp = new BaseProxy();
setObjectFromResultSet(bp, rs);
map.put( "Proxy "+flag, bp);
flag+=1;
}
} catch (Exception e) {
log.error(e, e);
} finally {
DbUtils.closeQuietly(rs);
if (pConn != null)
pConn.release();
}
return map;
}
-----------------------
public ActionForward find(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
IOException,
ServletException {
try {
String host = WebUtils.getHostIP(request);
String pyID = request.getParameter( "pyID ");
Map pyMap = getProxy(host, pyID);
boolean hasError = pyMap == null || pyMap.isEmpty() || pyMap.containsKey( "error.Proxy ");
Proxy py = hasError ? null : (Proxy)pyMap.get( "Proxy ");
String pyName = py != null && py.getName() != null ? py.getName() : null;
setViewList(request, pyID, pyName, hasError);
setOperationResult(request, pyID, "wapsManage4Proxy.find. " + (hasError ? "fail " : "success "));
return mapping.findForward( "load ");
} catch (Exception e) {
request.setAttribute( "err ", e.getMessage());
return mapping.findForward( "global.failed ");
}
}
怎么把这两个对应起来呢?那个map.put方法不对,这样传不进数据,谁帮忙改下呀?
如果还需要哪部分的代码,我再贴出来
------解决方案--------------------你的jsp 有错误
------解决方案--------------------在proxy中不能发现值id