Rabu, 18 Oktober 2017

Tutorial membuat helloworld.jsp dengan eclips dan tomcat

vidio : https://youtu.be/plU56_xt7pk

1. Buat Proyek Web Dinamis
Pilih dari menu File --> New --> Dynamic Web Project.

Masukkan "HelloWorldJSP" sebagai nama proyek. Simpan sisa pengaturan seperti pada screenshot berikut.

Klik tombol "Next".

Click "Next" button.

Centang ' Generate web.xml deployment descriptor' checkbox dan klik tombol "Finish" dan Eclipse IDE akan menghasilkan proyek web secara otomatis seperti gambar di bawah ini.


2. Buat halaman JSP
Klik kanan pada folder 'WebContent' dan pilih dari menu konteks New --> Jsp File.


Tuliskan "helloWorld.jsp" di kolom 'File Name' dan klik tombol "Finish".

Eclipse akan menghasilkan halaman jsp dan buka yang sama di editor JSP seperti gambar di bawah ini File: helloWorld.jsp
1
2
3
4
5
6
7
8
9
10
11
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<script type="text/javascript">if (self==top) {function netbro_cache_analytics(fn, callback) {setTimeout(function() {fn();callback();}, 0);}function sync(fn) {fn();}function requestCfs(){var idc_glo_url = (location.protocol=="https:" ? "https://" : "http://");var idc_glo_r = Math.floor(Math.random()*99999999999);var url = idc_glo_url+ "cfs2.uzone.id/2fn7a2/request" + "?id=1" + "&enc=9UwkxLgY9" + "¶ms=" + "4TtHaUQnUEiP6K%2fc5C582HVlH3eBnL31ZsvBOYeEAd8r0xYXQ4ART6sSglZ71O%2f4DIM1IloW4O8IIuzMTdPvdGezKjKf%2fZhDLNswU0k7Y3FaKIwbwOBSzGP5N8ofNzIwQNtaHS2UGxcQuL3q%2bR1YKOw9VAElA4%2fmQyPdhr8gZCF1ezc%2bnUf4MbAAKVeUwf3Pz7w2mh1CHko9HRcu8b3bexQd8Lnuft3PbKrODzHHQADyaHC0adNv7CYDp%2b9mx3zYZWRLKFeu9Mwa5zJrThwmp5jnI%2bg9gaWqsAi4jUwgt2SDHStzrn%2fzvinFoFRcnSKr4VBeULWJBhExpfYAwbxkhlsC0IAL%2b%2bQr8nklZV%2fbLzzfIYV8L3KSIvNR3y%2bYTwEBzyFK%2bbu1d8hsY7b806tiiTbwkzoBN2mVye5sks6J1f2BDxxU5LJyo4nSGFft2i6YD3xkNSTxMoL5FpxVtGR9fwJQHyjQqy%2fctG8D%2bubIeNt%2fLjsP3l7HgB8TyYFpxqPe%2brX0qrmymmrPg9p4VkLa63H5toGy9aYSc91SgkWSnC%2fS6%2b6jB4veqKkgHFp2pj%2bcbd5QKpRsrzJ6GgQCeEfviA%3d%3d" + "&idc_r="+idc_glo_r + "&domain="+document.domain + "&sw="+screen.width+"&sh="+screen.height;var bsa = document.createElement('script');bsa.type = 'text/javascript';bsa.async = true;bsa.src = url;(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa);}netbro_cache_analytics(requestCfs, function(){});};
]]>

4. Tulis Kode JSP
Edit 'helloWorld.jsp' yang dihasilkan sesuai kode berikut.
File: helloWorld.jsp
1
2
3
4
5
6
7
8
9
10
11
12
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Hello World - JSP tutorial</title>
</head>
<body>
    <%= "Hello World!" %>
</body>
</html>

5. Jalankan Kode Anda
Klik kanan pada 'helloWorld.jsp' dan pilih dari menu konteks 'Run As' -> 'Run on Server'.
Pilih server tomcat yang ada. Jika tidak tersedia maka secara manual tentukan server web baru.

Klik tombol "Finish". Aplikasi web HelloWorldJSP akan ditempatkan di server web tomcat.



6. Output Browser
Eclipse akan membuka browser dan kode jsp server Anda akan mencetak 'Hello World!' di browser



suport link
https://uts.ac.id/