JSP Tips

Áö³ª°¡´Ù¢â
2005-05-04 08:31:45.0
¾µ¸¸ÇÑ 2°³ÀÇ ¸Þ¼Òµå~

ÇÁ·ÎÁ§Æ® Çϸ鼭 »ç¿ëÇØ º¸´Ï ¾µ¸¸Çؼ­ ¿Ã·Áº¾´Ï´Ù. ^^

 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;                        
   
 } 

Tag
tag´Â °Ô½Ã¹°ÀÇ ¼º°ÝÀ» ³ªÅ¸³»´Â Ű¿öµå¸¦ ÀÔ·ÂÇÏ´Â °ø°£ÀÔ´Ï´Ù.
tag´Â ·Î±×ÀÎ ÈÄ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.
  • getRequest()´Â request¸¦ ¹Þ¾Æ¼­ HashMap¿¡ ³Ö¾îÁÝ´Ï´Ù. ¹è¿­Å¸ÀÔÀÇ request´Â Vector¿¡ ´ã¾ÆÁÖ°í¿ä
    getResult()´Â result°á°ú¸¦ HashMap¿¡ ´ãÀºÈÄ¿¡ ±×°É ´Ù½Ã º¤ÅÍ¿¡ ³Ö¾î¼­ ¹ÝÈ¯ÇØÁÝ´Ï´Ù.
  • Áö³ª°¡´Ù¢â
  • 2005-05-04 08:33:39
  • x
´ÙÀ½±Û [err]Keystore was tampered with, or password was incorrect
>> 2243 ¾µ¸¸ÇÑ 2°³ÀÇ ¸Þ¼Òµå~  [1] Áö³ª°¡´Ù. 4110 05-04 08:31
ÀÌÀü±Û [¼º´É] OScache¸¦ ÀÌ¿ëÇÑ JSP ÄÜÅÙÃ÷ ij½³