ÇÁ·ÎÁ§Æ® ÇÏ¸é¼ »ç¿ëÇØ º¸´Ï ¾µ¸¸Çؼ ¿Ã·Áº¾´Ï´Ù. ^^
public static HashMap getRequest(HttpServletRequest p_req) {
HashMap map = new HashMap();
Enumeration enum = p_req.getParameterNames();
while(enum.hasMoreElements()) {
String key = (String)enum.nextElement();
String []value = p_req.getParameterValues(key);
if (value.length == 1) {
map.put(key, p_req.getParameter(key));
} else if (value.length > 1) {
Vector v = new Vector();
for (int i=0; i<value.length; i++) {
v.add(v.size(), value[i]);
}
map.put(key, v);
}
}
return map;
}
public static void toString(HashMap map) {
Set key = map.keySet();
Object[] keys = key.toArray();
for (int i=0; i<keys.length; i++) {
System.out.println("KEY = [" + keys[i] + "]\nVALUE = " + map.get(keys[i]) + "\n");
if ( map.get(keys[i]) instanceof Vector) {
// System.out.println(" Keys : -> " + keys[i] + " Vector");
}
}
}
public static Vector getResult( ResultSet p_rset ) throws LException {
Vector voList = new Vector();
try{
ResultSetMetaData rsetmeta = p_rset.getMetaData();
int colcnt = rsetmeta.getColumnCount(); // Ä÷³ Ä«¿îÆ®..
String colName = null; // Ä÷³ ¸í
String colType = null; // Ä÷³ ŸÀÔ..
while(p_rset.next()) {
HashMap vo = new HashMap();
for (int j = 1; j <= colcnt; j++) {
colName = rsetmeta.getColumnName(j); // Ä÷³¸í...
colType = rsetmeta.getColumnTypeName(j); // Ä÷³ ŸÀÔ DB Type
if (p_rset.getObject(j) != null){
vo.put(colName, p_rset.getString(j));
} else {
vo.put(colName, "");
}
}
voList.add(voList.size(), vo);
}
}catch (SQLException sqle) {
System.out.println(sqle.getMessage());
} catch (Exception e) {
System.out.println(e.getMessage());
}
return voList;
}