java web application template

Andreas Wuest AndreasWuest at gmx.de
Sun Oct 13 01:22:12 BST 2002


Hi, 

i have created a small template for a java web application that 
can be used with Apache Tomcat, Bea WebLogic, IBM WebSphere, whatever. 

The necessary template files that are required you will find attached 
to this mail. It would be really cool if you could add the template 
to the cvs for the next version. The template is not yet perfect and 
may still contain some bugs but i think it is a good starting point. 

Back to the files : 

for template i created the directory 
template-javawebapp 
which contains the following files : 

HelloWorld.jsp 
HelloWorldServlet.java (attached filename is HelloWorldServlet.xxxx, you
just have to rename it. sorry for that but the evolution mail client
always segfaults when i try to attach a java file).
app.kdevelop 
build.xml 
index.html 
javawebapp.png  (not yet correct) 
script 
subdirs 
web.xml 


The only problems that i was not able to solve, due to a lack 
of documentation, were the following ones : 

- after creating java web application project you get the 
   following message : 
   THis poject does not conatin any files yet. Populate it with all 
   C/c++/java files below the project directory. 
   (this is obviously a app.kdevelop misconfiguration) 

- building the web app does work with the F8 key (build project) 
   you can also select the build target defined in the build.xml file 
   properly (build, javadoc, warfile). Compiling the individual 
   java source file does not work since the app tries to compile 
   the file with ant, which of course cannot find a build.xml file 
   in the source directory that contains the java source file. 
   i have no idea how i can fix that. For compiling i would like to 
   use the javac compiler, not ant. is that possible ?? 
   (probably another app.kdevelop misconfiguration by myself). 

Thats all for now. 

Bye and thanks, 

Andreas 


btw. gideon is really, really beautiful. keep up the great work. 


-- 
The difference between theory and practice, is that in theory, 
there is no difference between theory and practice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20021013/42faaaa7/attachment.html>
-------------- next part --------------

// The demo hello world servlet
import javax.servlet.ServletException;

import java.io.IOException;
import java.io.PrintWriter;

//import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;



/**
 * A small sample Hello World Servlet
 *
 */
public class HelloWorldServlet extends HttpServlet
{
  /**
   * Sample get Method implementation
   */
  public void doGet (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
  {
    res.setContentType ("text/html");
    PrintWriter out = res.getWriter ();
    out.println ("<HTML><BODY>");
    out.println ("<B>Hello World Servlet (get method)</B>");
    out.println ("</BODY></HTML>");
  }

  /**
   * Sample post Method implementation
   */
  public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
  {
    res.setContentType ("text/html");
    PrintWriter out = res.getWriter ();
    out.println ("<HTML><BODY>");
    out.println ("<B>Hello World Servlet (post method)</B>");
    out.println ("</BODY></HTML>");
  }

}
-------------- next part --------------
<?xml version="1.0"?>
<kdevelop>
 <general>
  <author>$AUTHOR$</author>
  <email>$EMAIL$</email>
  <projectmanagement>KDevCustomProject</projectmanagement>
  <primarylanguage>Java</primarylanguage>
  <ignoreparts>
   <part>KDevDebugger</part>
  </ignoreparts>
  <keywords>
   <keyword>Java</keyword>
   <keyword>Code</keyword>
  </keywords>
 </general>
 <kdevcustomproject>
  <build>
   <buildtool>ant</buildtool>
  </build>
 </kdevcustomproject>
 <kdevfileview>
  <groups>
   <group pattern="*.java" name="Sources" />
   <group pattern="*.ui" name="User Interface" />
   <group pattern="*.png" name="Icons" />
   <group pattern="*.po;*.ts" name="Translations" />
   <group pattern="*" name="Others" />
  </groups>
 </kdevfileview>
 <kdevdebugger>
  <general>
  </general>
 </kdevdebugger>
</kdevelop>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.xml
Type: text/xml
Size: 2367 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20021013/42faaaa7/attachment.xml>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20021013/42faaaa7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: javawebapp.png
Type: image/png
Size: 5063 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20021013/42faaaa7/attachment.png>
-------------- next part --------------
#!perl -I/usr/local/kde/share/apps/kdevappwizard/template-common

use gideon;

initGideon();
installFileTemplate();

print "Installing project file\n";
install( "${src}/template-javawebapp/app.kdevelop",          "${dest}/${APPNAMELC}.kdevelop" );

print "Installing application framework\n";
mkdir( "${dest}/WEB-INF", 0777 );
mkdir( "${dest}/WEB-INF/lib", 0777 );
mkdir( "${dest}/WEB-INF/classes", 0777 );
mkdir( "${dest}/WEB-INF/src", 0777 );

print "Installing application sources\n";

install( "${src}/template-javawebapp/build.xml",              "${dest}/build.xml" );
install( "${src}/template-javawebapp/index.html",             "${dest}/index.html" );
install( "${src}/template-javawebapp/HelloWorld.jsp",         "${dest}/HelloWorld.jsp" );
install( "${src}/template-javawebapp/web.xml",                "${dest}/WEB-INF/web.xml" );
install( "${src}/template-javawebapp/HelloWorldServlet.java", "${dest}/WEB-INF/src/HelloWorldServlet.java" );

print "Finished\n";
-------------- next part --------------
WEB-INF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: web.xml
Type: text/xml
Size: 640 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20021013/42faaaa7/attachment-0001.xml>


More information about the KDevelop mailing list