好的,這是當天最簡單的問題。這是我第一次嘗試Java和JSP。Java to JSP - 如何將Java應用程序集成到JSP網頁中?
我剛剛使用Eclipse寫了一個小小的Java應用程序。現在我想把這個小應用程序放到網頁中。我需要弄清楚Java應用程序和網頁之間的聯繫。
這裏是我的應用程序:
public class PhraseOMatic {
public static void main(String[] args) {
// CREATE WORD ARRAYS
String[] wordListOne = {"24/7", "Multi-tier", "30,000 foot", "B-to-B", "win-win", "front-end", "back-end", "web-based"};
String[] wordListTwo = {"empowered", "sticky", "concentric", "distributed", "leveraged", "shared", "accelerated", "aligned"};
String[] wordListThree = {"process", "tipping point", "mindshare", "mission", "space", "paradigm", "portal", "vision"};
// CALCULATE ARRAY LENGTHS
int oneLength = wordListOne.length;
int twoLength = wordListTwo.length;
int threeLength = wordListThree.length;
// PRINT OUT THE PHRASE
int i = 1;
while (i < 10) {
// GENERATE RANDOM NUMBERS
int rand1 = (int) (Math.random() * oneLength);
int rand2 = (int) (Math.random() * twoLength);
int rand3 = (int) (Math.random() * threeLength);
// BUILD A PHRASE
String phrase = wordListOne[rand1] + " " + wordListTwo[rand2] + " " + wordListThree[rand3];
// PRINT OUT PHRASE
System.out.println("What we need is a " + phrase + ".");
i = i + 1;
}
}
}
如何我得到的編譯的應用程序呈現爲網頁?接下來我需要採取哪些步驟?
謝謝!
我認爲你需要的是一個基於網絡的分佈式過程。 – Pindatjuh
您確定我不需要B-to-B槓桿門戶嗎? –
缺少的鏈接是servlet:http://stackoverflow.com/tags/servlets/info – BalusC