*******  Intro11.jsp   *******
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form>
행 : <input type="text" name="rows"><p/>
열 : <input type="text" name="cols"><p/>
<input type="submit" value="확인"><p/>
</form>
<%
int rows =1, cols=1;
//만약 폼변수 rows과 cols가 null이 아니라면.
if(request.getParameter("rows") != null && request.getParameter("cols") != null)
{
 if(request.getParameter("rows") != "" && request.getParameter("cols") != "")
 {
  rows=(new Integer(request.getParameter("rows")).intValue());
  cols=Integer.parseInt(request.getParameter("cols"));
 }
}
%>
<table border="1" width="640">
<%
//반복할것 (1부터 rows까지)
for(int i=1;i<rows+1;i++)
{
 %>
 <tr>
 <%
 //반복할것 (1부터 cols까지)
 for(int j=1;j<cols+1;j++)
 {
 %>
  <td><%= i %>X<%= j %>=<%= i*j %></td>
 <%
 }
 %>
 </tr>
<%
}
%>
</table>

</body>
</html>



************    Intro17.jsp      *****************
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form method="post" action="Intro17pro.jsp">
행 : <input type="text" name="rows"><p/>
열 : <input type="text" name="cols"><p/>
<input type="submit" value="다음">
</form>
</body>
</html>

********   Intro17pro.jsp    **********
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.net.URLEncoder"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<% request.setCharacterEncoding("euc-kr"); %>
입력한 정보는 아래와 같습니다.
<% String params = "?rows="+ URLEncoder.encode(request.getParameter("rows"))+"&cols="+URLEncoder.encode(request.getParameter("cols")); %>
<form method="post" action="Intro11.jsp">
행 : <%=request.getParameter("rows") %><p>
열 : <%=request.getParameter("cols") %><p>
<input type="hidden" name="rows" value="<%=request.getParameter("rows") %>">
<input type="hidden" name="cols" value="<%=request.getParameter("cols") %>">
<input type="submit" value="다음"><p>
<!--<input type="button" value="location으로 자료전송" OnClick="location='Intro11.jsp?rows=<%= URLEncoder.encode(request.getParameter("rows"))%>&cols=<%= URLEncoder.encode(request.getParameter("cols"))%>';">
<input type="button" value="팝업" onClick="open('Intro11.jsp?rows=<%= URLEncoder.encode(request.getParameter("rows"))%>&cols=<%= URLEncoder.encode(request.getParameter("cols"))%>','intro11','width=640,height=480')">
-->
<input type="button" value="location으로 자료전송" OnClick="location='Intro11.jsp<%= params%>';">
<input type="button" value="팝업" onClick="open('Intro11.jsp<%= params%>','intro11','width=640,height=480')">
</form>
</body>
</html>

Posted by 말없제이
,

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- Intro15.jsp -->   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form action="Intro15pro.jsp" method="post">
id:<input type="text" name="id"><p>
이름:<input type="text" name="name"><p>
Email:<input type="text" name="email">
<input type="submit" value="Ok">
</form>
</body>
</html>


**********   Intro15pro.jsp    **********
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ page import="java.net.*" %>   
<!-- Intro15pro.jsp -->   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<% request.setCharacterEncoding("euc-kr"); %>
Intro15pro의 출력내용.
<form method="post" action="Intro16.jsp">
id:<%=request.getParameter("id") %><p/>
name:<%=request.getParameter("name") %><p/>
email:<%=request.getParameter("email") %><p/>
<!--
만일 중간에 경유하는 웹페이지가 지금처럼 폼을 사용하는 경우라면
값의 전달을 아래와 같이 히든을 두어 지속적으로 넘겨줄 수 있다.
-->
<input type="hidden" name="id" value="<%=request.getParameter("id") %>">
<input type="hidden" name="name" value="<%=request.getParameter("name") %>">
<input type="hidden" name="email" value="<%=request.getParameter("email") %>">
<input type="submit" value="확인">
</form>
</body>
</html>


**********  Intro16.jsp   **********
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<% request.setCharacterEncoding("euc-kr"); %>

당신이 입력한 값은 다음과 같습니다.<p/>
id:<%=request.getParameter("id") %><p>
name:<%=request.getParameter("name") %><p>
email:<%=request.getParameter("email") %><p>
</body>
</html>

Posted by 말없제이
,

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- Intro13.jsp -->   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form action="Intro13pro.jsp" method="get">
id:<input type="text" name="id"><p>
이름:<input type="text" name="name"><p>
Email:<input type="text" name="email">
<input type="submit" value="Ok">
</form>
</body>
</html>

***********  Intro13pro.jsp  ********
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ page import="java.net.*" %>   
<!-- Intro13pro.jsp -->   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<% request.setCharacterEncoding("euc-kr"); %>
id:<%=request.getParameter("id") %><p>
name:<%=request.getParameter("name") %><p>
email:<%=request.getParameter("email") %><p>
<!--
request영역은 휘발성입니다...
고로 해당영역이 끝나면 소멸된다...
따라서 휘발성인 폼변수의 값을 다음페이지에 넘겨주려면
하이퍼링크의 경우 자료의 전송기능이 없으므로
아래와 같이 폼변수를 Get방식으로 만들어 계속적으로 전달해야
사용이 가능하다...
 -->
 <%
 //폼을 경유하지 않는 Get방식의 자료전송의 경우
 //반드시 java.net.URLEncoder.encode(인코딩할 변수,"문자셋")
 //으로 변수를 Encoding하여야 한다...
 String id
 =URLEncoder.encode(request.getParameter("id"),"euc-kr");
 String name
 =URLEncoder.encode(request.getParameter("name"),"euc-kr");
 String email
 =URLEncoder.encode(request.getParameter("email"),"euc-kr");
 %>
<a href="Intro14.jsp?id=<%=id %>&name=<%=name %>&email=<%=email %>">Intro14.jsp</a>
<p><a href="#" OnClick="open('Intro14.jsp?id=<%=id %>&name=<%=name %>&email=<%=email %>','intro14','width=320,height=200')">Popup</a>

</body>
</html>

**********  Intro14.jsp   *********
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<% request.setCharacterEncoding("euc-kr"); %>
Intro14<p/>

id : <%= request.getParameter("id") %><p/>
name : <%= request.getParameter("name") %><p/>
email : <%= request.getParameter("email") %><p/>
<a href="Intro13.jsp">Intro13.jsp</a>
</body>
</html>

Posted by 말없제이
,
패티지 탐색에서 오른쪽마우스 > 내보내기
사용자 삽입 이미지
내보내기 하면 원래는 --.. WAR Export가 보여야 하는데..
안보이면.. 기타 > Web > WAR file
사용자 삽입 이미지
설치된 Tomcat폴더 \ webapps 경로가 실위치..
실제경로 예시)
사용자 삽입 이미지

목적지에는 tomcat이 실제 위치된 곳으로.
사용자 삽입 이미지
Posted by 말없제이
,
받아서 설치한 apach9-tomca 위치의 startup.bat 실행..
사용자 삽입 이미지
만약 실행시 아래와같이 애러가 난다면.. 경로가 안되어있는상태..
사용자 삽입 이미지
경로설정.
설정 > 제어판 > 시스템
사용자 삽입 이미지
고급 > 시스템 변수 > 새로만들기.
사용자 삽입 이미지

새 시스템 변수에다..
변수이름 : JAVA_HOME
변수 값 : JDK설치된 경로 설정.
사용자 삽입 이미지

정상시화면. 닫히지 않고 계속 유지됨.
eclipse 실행한상태에서 tomcat실행하면 에러난뒤 닫힘
즉. 닫고 실행하면 정상으로 뜸.
사용자 삽입 이미지
Posted by 말없제이
,
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%!
//%!영역은 선언문영역 : JSP가 서블릿으로 변환될때
//여기에 기술한 코딩은 자연스럽게 doService멤버변수밖으로
//영역에 기술된다.
//따라서 멤버변수의 선언 및 멤버함수의 정의를 둘 수 있다.
private String m;
public String sayHello()
{
 return m;
}
%>
<%
//서블릿은 jspService함수내에 들어가서
//실행문 영역 : % 와 % 사이의 구간
//%와 %사이의 구간은 서블릿으로 JSP로 변환될때
//doService멤버함수안의 영역으로 변환되며
//당연히 접근제어자나 함수의 정의를 쓰지 못한다.
this.m = "Hello";
out.print(this.sayHello());
%>
</body>
</html>
Posted by 말없제이
,

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form>
행 : <input type="text" name="rows"></p>
열 : <input type="text" name="cols"></p>
<input type="submit" value="확인"></p>
</form>
<%
int rows =1, cols=1;
//만약 폼변수 rows과 cols가 null이 아니라면.
if(request.getParameter("rows") != null && request.getParameter("cols") != null)
{
 if(request.getParameter("rows") != "" && request.getParameter("cols") != "")
 {
  rows=(new Integer(request.getParameter("rows")).intValue());
  cols=Integer.parseInt(request.getParameter("cols"));
 }
}
%>
<table border="1" width="640">
<%
//반복할것 (1부터 rows까지)
for(int i=1;i<rows+1;i++)
{
 %>
 <tr>
 <%
 //반복할것 (1부터 cols까지)
 for(int j=1;j<cols+1;j++)
 {
 %>
  <td><%= i %>X<%= j %>=<%= i*j %></td>
 <%
 }
 %>
 </tr>
<%
}
%>
</table>

</body>
</html>

Posted by 말없제이
,

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form>

분류 :

<select name="kind">

<option value="A" <% if(request.getParameter("kind")!=null) { if(request.getParameter("kind").equals("A") ) {%>selected<% } }%> >A항목</option>

<option value="B"<% if(request.getParameter("kind")!=null) { if(request.getParameter("kind").equals("B") ) {%>selected<% } }%>>B항목</option>

<option value="C"<% if(request.getParameter("kind")!=null) { if(request.getParameter("kind").equals("C") ) {%>selected<% } }%>>C항목</option>

</select>

<input type="submit" value="확인">

</form>


</body>
</html>

Posted by 말없제이
,
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<!--
포스트백 : 문서 자기자신에게 자료를 전송하는 형태를 일명 포스트백이라 부른다.
아래처럼 action속성에 문서자기자신의 이름을 지정하는 형태를 포스백이라 부른다.
form태그에서 method를 생략할 경우 기본값은 get이다.
form태그에서 action을 생략할 경우 기본값은 문서 자기자신.
-->
<% request.setCharacterEncoding("euc-kr"); %>
<form method="post" action="Intro09.jsp">
키워드 : <input type="text" name="keyword"  value="<% if(request.getParameter("keyword") != null ) { %><%=request.getParameter("keyword")%><% }  %>">
<input type="submit" value="확인">
</form>
입력한 값 :
<%//폼변수 keyword의 값을 출력
out.println(request.getParameter("keyword"));
%>
</body>
</html>
Posted by 말없제이
,
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!-- Intro07.jsp -->   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<!-- 스파게티코드: 시작과 끝이 전부 html요소에 의해 분리되므로
어지러워서 스파게티코드라 부릅니다...  -->
<table width="650" border="1">
<%
for (int i=1; i<=10; i++)
{
%>
 <tr <% if (i%2==0) {%>bgcolor="yellow"<%} %>>
  <td><%=i %>행</td>
 </tr>
<%
}
%>
</table>
</body>
</html>

*.구구단 연습.
**********   Intro08.jsp   *************
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<table border="1" width="650">
<%
 for (int i=1; i<=9; i++)
 {
%>  
<tr <% if (i%2==0) {%>bgcolor="green"<%} %>>
<%
  for (int j=1; j<=9; j++)
  {
%>  
   <td><%=i %>X<%=j %>=<%=(i*j) %></td>
<%
  }
%>
</tr>
<%
 }
%>
</table>
</body>
</html>
Posted by 말없제이
,