Welcome to Abdul Malik Ikhsan's Blog

Cara Compile Extends pada UseBean

Posted in Tutorial JSP by samsonasik on August 24, 2007

Saya kemarin baru ngoprek2 extends pada useBean, susahnya minta ampyunnn…., ternyata, setelah Googling… , saya coba lagi, dan akhirnya berhasil, nah, begini caranya :
pertama, kita buka dulu web-inf\classes kita, misal kita buat folder mahasiswa, kita buat file di dalamnya, Mhs.java
—————

Code:
package mahasiswa;
public class Mhs {
public String nama;
}

————-
Compile
————-
Sekarang, kita buat file extends-nya, kita balik lagi ke web-inf\classes , kita buat folder misalnya panggilmahasiswa, kita buat file panggil.java

Code:
package panggilmahasiswa;
import mahasiswa.Mhs;
public class panggil extends Mhs {
public void setnama(String nama){
String nama=nama;
}public String getnama(){
return nama;
}}

———-
Cara compile-nya sebagai berikut
/*
buka command prompt, masuk ke web-inf\classes\ (compile nama folder\namafile.java)
***********************************
D:\toms\webapps\ROOT\WEB-INF\classes>javac pangggilmahasiswa\panggil.java
***********************************

Kalau sudah, kita bisa panggil di file jsp kita, misal kita letakkan di webapps\root\tes.jsp

Code:
<jsp:useBean id=”x” class=”panggilmahasiswa.panggil”/>
<%
x.setnama(“samsonasik alias abdul malik ikhsan yang ganteng banget”);
out.print(x.getnama());
%>
 

2 Responses

Subscribe to comments with RSS.

  1. vina said, on July 10, 2008 at 7:13 am

    minta tlg dunx,,
    sy sdg bwt tgs kul (PI) =skripsi gt dech
    trz sy bwt game ular tangga pakai java
    pd programNy ud bnr smw
    tp pas compileNy eror.
    pdhl ud ngikutin cr compile yg ad di buku.
    Compileny: javac GameKu.java
    malah muncul tlsn :’javac’ is not recognized …(lp tlsnNy)
    kl ky gt knp y?
    trz spy progNy bs di compile gmn crNy??
    TLG y…
    Blz ke email sy : vina_vinouzz@yahoo.com
    Thx.

  2. samsonasik said, on July 10, 2008 at 10:41 am

    coba cek path dan classpathnya, vina set path nya di Drive:\programJava\bin; dan set classtpathnya di Drive:\programJava\lib;

    bisa baca tutorialnya di http://www.4shared.com/file/40546882/7d525ebc/modul_001_Java.html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: