Next Previous Contents

4. Ektelwntas ena programma Java CGI

4.1 Empodia sto trejimo programmatwn Java katw apo to montelo CGI

Yparxoyn duo kuria problhmata sto trejimo enos programmatos Java apo enan diakomisth istou:

Den mporeite na trejete programmata Java opws ta kanonika ektelesima.

Xreiazetai na trejete ton diermhnea Java run-time kai na parexete thn arxikh klash (programma gia na trejete) sth grammh entolwn. Me mia forma HTML, den yparxei kamia frontida gia na stelnete mia grammh entolwn ston diakomisth istou.

H Java den exei genikh prosbash sto periballon.

Ka8e metablhth periballontos poy 8a xreiastei apo to programma Java prepei na perastei me safhneia. Den yparxei kamia me8odos paromoia me th leitoyrgia ths C, getenv() .

4.2 3epernwntas problhmata sto trejimo programmatwn Java CGI

Gia na antimetwpisete ayta ta empodia, egraca ena CGI programma kelufoys poy parexei tis plhrofories poy xreiazontai apo ton Java diermhnea.

To java.cgi script

Ayto to senario kelufoys diaxeirizetai thn allhlepidrash metaju toy HTTP daimona kai toy programmatos Java CGI poy epi8ymeite na xrhsimopoihsete. Ejagei to onoma toy programmatos poy 8elete na trejete apo ta dedomena poy parexontai apo to diakomisth. Syllegei ola ta dedomena periballontos se ena proswrino arxeio. Ustera, trexei ton Java run-time diermhnea me to onoma toy arxeioy apo tis plhrofories periballontos kai to onoma toy programmatos poy proste8hke sth grammh-entolwn.

To java.cgi script diamorfw8hke kai egkatasta8hke sto Apofasiste gia tis politikes topikwn diadromwn sas.

Kalwntas to java.cgi apo mia forma HTML

Oi formes moy poy xrhsimopoioun programmata Java CGI ka8orizoyn mia energeia formas opws akolou8ws:

<form action="/cgi-bin/java.cgi/CGI_Test" method="POST">
Opoy /cgi-bin/ einai o topikos sas CGI binary katalogos, java.cgi einai to Java front-end poy mas epitrepei na trexoyme programmata Java ston isto kai to CGI_Test einai ena paradeigma onomatos programmatos Java gia na trejete.


Next Previous Contents