IT/JAVA

[공유] html, jsp파일에서 애플릿으로 데이터 전달방법

news-wiki 2018. 12. 27. 22:26
728x90


출처 안녕! 넌 내 친구야 | 김지혜

원문 https://blog.naver.com/hijihey/120029801919

[html 파일 ]


 


<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=MS949">

<title>

HTML  Page

</title>

</head>

<body>

<br>

<applet

  codebase = "."

  code     = "outapplet.outApplet.class"

  archive  = "outApplet.jar"

  name     = "TestApplet"

  width    = "600"

  height   = "400"

  hspace   = "0"

  vspace   = "0"

  align    = "middle"

>

<PARAM NAME = "ReckeyList" VALUE = "30">

</applet>

</body>

</html>


 


 


[jsp 파일]


 


<%@ page contentType="text/html; charset=euc-kr" %>

<%@ page language = "java" %>

<%@ page import = "javax.servlet.http.*, java.util.*" %>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=MS949">

<title>

HTML  Page

</title>

</head>

<body>

<% 


  String Reckey =  request.getParameter("ReckeyList"); 


  %>

<applet

  codebase = "."

  code     = "outapplet.outApplet.class"

  archive  = "outApplet.jar"

  name     = "TestApplet"

  width    = "700"

  height   = "400"

  hspace   = "0"

  vspace   = "0"

  align    = "middle"

>

<PARAM NAME = "ReckeyList" VALUE = "<%=Reckey%>" >

</applet>

</body>

</html>


 


 


[applet 파일]


.


.


.


public void init() {

        try {

            jbInit();

          String ReckeyList = getParameter("ReckeyList");

            sendTest.setText(ReckeyList + "_________________");


        } catch (Exception e) {

            e.printStackTrace();

        }

    }


 


.


.


.


 


 


* 전달받은 ReckeyList의 값 30은 int형이 아닌 String 형으로 받는다.

728x90