2010-12-13 2 views
0

基本的に、カスタムJavaコードの少しのブログを含むWebサイトを構築して、サーバー上でajax呼び出しを実行する必要があります。これはJavaでどのように行うのですか? (いくつかのJavaコールバックを持つブログ)

私の最初の考えは、wordpressやdr​​upalなどでブログを構築してから、非常に単純なJava Webアプリケーションを実行してajaxリクエストを受け取ることでした。しかし、Java Webアプリケーションの経験がないので、私はそのような単純なタスクのために作られたフレームワークについてはわかりません。また、私はwordpress/drupal/etcを使って、これらのJava ajax呼び出しをいかに簡単に統合できるかを知っていることもありません。

次に、私はdrupal、wordpressなどの代わりにJava CMSを実行する必要があるかもしれないと考えました。これは私のajaxフックを簡単に統合できるようにするはずです。しかし、もう一度、Java CMSのどれがうまくいくかを知る経験はありません。

いくつかのJavaウェブアプリケーションの経験がある人は、その推奨を与えることができますか?

+1

Java WebアプリケーションやJava CMSに関する経験がない場合、なぜJavaでこれを行う必要がありますか? – Thilo

答えて

0

2回目の投稿で2回目に私は同じリコメンド(!)をしましたが、Liferayポータルサーバの無料コミュニティ版を見てみてください。それはJava(簡単にはtomcat + mysql)上で動作し、ブログやCMSなどの機能が含まれています。また、カスタム動作を追加するためのソースコード(ライセンスの対象)を変更するオプションもあります。

0

WordpressやDrupalを使用していた場合、PHPで達成できなかったJavaで何をしようとしていますか?

Wordpressは設定が簡単です。 Webアプリケーションの経験があり、PHPの知識が少ない場合は、問題はないはずです。

Spring MVCは、かなり簡単なJava Webアプリケーションフレームワークです。比較的簡単にGoogle App Engine上で実行することができます。また、多くのオンラインドキュメント/サポートがあります。

あなたのAJAXコールは、CMSがあるドメインと同じドメインに作成する必要があります。 2つの別々のWebアプリケーションを作成する場合は、同じドメインに存在する必要があります。

あなたの特定の要件が何であるかを知らずに詳しいアドバイスをするのは少し難しいですが、少し助けてくださいました。

0

私はあなたがどのフレームワークも使うべきではないと思います。サーブレットを作成するだけです。なぜなら、フレームワークを使用していても、サーブレットが何であるかを理解する必要があるからです。これらのコードは、oracleのsiteのものです。doGetを修正して処理してください。または、doPostに変更することもできます。

import java.io.*; 

// Packages for Servlets 
import javax.servlet.*; 
import javax.servlet.http.*; 


public class HelloWorld extends HttpServlet { 

    /** 
    * Initializes the servlet. The method is called once, automatically, by the 
    * Java Web Server when it loads the servlet. The init() method should save 
    * ServletConfig object so that it can be returned by the getServletConfig() 
    * method. 
    */ 
    public void init(ServletConfig config) throws ServletException { 

    super.init(config); 
    } 

    /** 
    * Method to process HTTP GET requests. In this method a Simple HTML page 
    * displaying "Hello Oracle World" is built and presented to user. 
    * The parameters of doGet() method is 
    * 1) HttpServletRequest object, which encapsulates the data from the client 
    * 2) HttpServletResponse object, which encapsulates the response to the client 
    **/ 

    public void doGet(HttpServletRequest p_req, HttpServletResponse p_res) 
             throws ServletException, IOException { 

    // Sets the content type of the response 
    p_res.setContentType("text/html"); 

    // Create a ServletOutputStream to write the output 
    ServletOutputStream l_out = p_res.getOutputStream(); 

    // Use ServletOutputStream to print the Hello Oracle World String in 
    // the HTML page 

    l_out.println("<HTML><HEAD><TITLE>Hello Oracle World</TITLE></HEAD>"); 
    l_out.println("<BODY BGCOLOR =\"lightgrey\"><CENTER><BR><BR>"); 
    l_out.println("<TABLE BORDER=4 BGCOLOR =\"blue\">"); 
    l_out.println("<TR><TD align =\"center\" valign=\"center\" >"); 
    l_out.println("<FONT face=\"Arial,helvetica\" color =red size=5>"); 
    l_out.println("&nbsp; Hello Oracle World &nbsp;</FONT></TD></TR></TABLE>"); 
    l_out.println("</BODY></HTML>"); 

    l_out.close(); // Close the ServletOutputStream 
    } 

    /** 

    * Override the getServletInfo() method which is supposed to return information 
    * about the Servlet, e.g. the servlet name, version, author and copyright 
    * notice. This is not required for the function of the HelloWorld servlet but 
    * can provide valuable information to the user of a servlet who sees the 
    * returned text in the administration tool of the Web Server. 
    **/ 
    public String getServletInfo() { 
    return "Hello World servlet 1.0 by Reghu"; 
    } 

    public void destroy() { 
    super.destroy(); 
    } 
} 
関連する問題