JSP QnA

ÁÖ¿î
2007-12-25 21:52:58.0
ÆË¾÷â¿¡¼­ ºÎ¸ðâ ¸®·Îµå ÇÏ´Â ¹®Á¦ÀÔ´Ï´Ù.

test1.jsp¿¡¼­ pop¹öưÀ» ´©·ç¸é test2.jspÆË¾÷âÀÌ¿­¸®±¸¿ä.

±×â¿¡¼­ ¹öưÀ» Ŭ¸¯Çϸé test2¿¡¼­ ¼³Á¤ÇѰªÀÌ test1À¸·Î °¡¸é¼­

ÀÚ±âÀÚ½ÅÀÌ ¸®·ÎµåµÇ¾ßÇϰŵç¿ä. ¿©±â¼­ Áß¿äÇÑ°Ô test1ÀÇ aa_h°¡

null¿¡¼­ Á¦°¡ ÁöÁ¤ÇØÁØ ÀÓÀÇÀÇ °ªÀ¸·Î ¹Ù²î¾î¾ß Çϴµ¥

request.getParameter·Î ¹Þ¾Æ¼­ Âï¾îº¸´Ï ±×°ÍÀº ³Î¸¸ ¶å´Ï´Ù.

Á¦°¡¿øÇϴ°ÍÀº submit()À¸·Î ÀÚ±âÀÚ½ÅÀ¸·Î µÇµ¹¾Æ¿ÔÀ»¶§ È÷µçÀ¸·Îó¸®ÇÑ

aa_hÀÇ ³»¿ëÀÌ Á¦°¡ ÁöÁ¤ÇÑ °ªÀ¸·Î ÂïÇô¾ß Çϴµ¥ null¸¸ ÂïÈü´Ï´Ù.

¸Õ°¡ ¹æ¹ýÀÌ ¾øÀ»±î¿ä. ?? ¤Ð¤Ð ±×·³ Á¶¾ðºÎʵ右´Ï´Ù..

test1.jsp

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
 
 String aa = request.getParameter("aa");
 String bb = request.getParameter("bb");
 String cc = request.getParameter("cc");
 String dd = request.getParameter("dd");
 String aa_h = request.getParameter("aa_h");

%>
<html>
<head>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<script>

 function go(){
 
    document.te1.target = '_self';
        document.te1.action = 'test1.jsp';
        document.te1.submit();
  
 }
 function pop(){
 
   win = window.open('','pop','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left=0,copyhistory=0,width=430,height=430');
        win.focus();
        document.te1.target = 'pop';
        document.te1.action = 'test2.jsp';
        document.te1.submit();
 }
</script>
</head>
<body>
  <%if(!(aa == null && bb == null && cc == null && dd ==null) ) {%>
  aaa
  <%} %>
  <%if(!(aa == "" && bb == "" && cc == "" && dd =="") ) {%>
  
  <%} %>
 
 <form name="te1" method="post" action="test1.jsp">
  <table width="500">
  <tr>
   <td>
    <input type="text" name="aa" value="<%=aa %>" >
    <input type="hidden" name="aa_h" value="<%=aa_h %>">
   </td>
  </tr>
  <tr>
   <td>
    <input type="text" name="bb" value="<%=bb %>">
   </td>
  </tr>
  <tr><td>
  dddd : <%=aa_h %>
  </td></tr>
  <tr>
   <td>
    <input type="text" name="cc" value="<%=cc %>">
   </td>
  </tr>
  <tr>
   <td>
    <input type="text" name="dd" value="<%= dd%>">
   </td>
  </tr>
  <input type="button" value="popup" onClick="javascript:pop()">
  <input type="submit" value="send" name="send" onClick="javascript:go()">
  </table>
 </form>

</body>
</html>

 

 

 

test2.jsp

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>

</head>
<script language="javascript">

  function pop(){
  
  var f=parent.opener.document.te1;
  
  f.aa.value="aa";
  f.bb.value="bb";
  f.cc.value="cc";
  f.dd.value="dd";
  f.aa_h.value="aa_h";
  

  opener.te1.submit();
  
  window.top.close();
  }
</script>
<body>
<form name="tt" method="post">
<input type="button" name="ttttt" value="dddd" onClick="pop()">
<tr><td align="center"><br><a href="javascript:this.close();">´Ý±â</a><tr></td>
</form>
</body>
</html>

Tag
tag´Â °Ô½Ã¹°ÀÇ ¼º°ÝÀ» ³ªÅ¸³»´Â Ű¿öµå¸¦ ÀÔ·ÂÇÏ´Â °ø°£ÀÔ´Ï´Ù.
tag´Â ·Î±×ÀÎ ÈÄ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.
  • ¸ð´ÞâÀ» ÀÌ¿ëÇϽô°͵µ ±¦ÂúÀ» ÅÙµ¥¿ä..^^
  • zpzgsk
  • 2007-12-26 10:03:29
  • x
´ÙÀ½±Û ¾Ë¹ÙƼ½º¸¦ ÀÌ¿ëÇØ¼­ ¿À¶óŬÀÇ clob ŸÀÔÀ» °¡Á®¿Ã¶§¿ä..
>> 44340 ÆË¾÷â¿¡¼­ ºÎ¸ðâ ¸®·Îµå ÇÏ´Â ¹®Á¦ÀÔ´Ï´Ù.  [1] ÁÖ¿î 846 12-25 21:52
ÀÌÀü±Û ¾î³ëÅ×ÀÌ¼Ç ±âÃÊ Áú¹®