MapServer Java?

Norman Barker nbarker at ITTVIS.COM
Thu Jul 20 03:52:58 EDT 2006


Hi,

There have been a few replies to this thread, but if you use a servlet
then I find using the init method quite helpful

    public void init() throws ServletException {
        super.init();
        ServletConfig config = getServletConfig();
        mapfile = config.getInitParameter("mapfile");
    }

And in web.xml

<init-param>
	<param-name>mapfile</param-name>
	<param-value>/var/www/html/demo/bluemarble.map</param-value>
</init-param>

Just allows you to change the mapfile whenever you want and not have to
recompile.

Norman

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Umberto Nicoletti
Sent: Thursday, July 20, 2006 7:43 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] MapServer Java?

You could also use a jsp (which in fact is a special type of servlet).
The tutorial from Sun's java site will help you to get started with
both of them (and much more):

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/

Good luck,
Umberto

On 7/20/06, Ryan Ollerenshaw <ollerery at engr.orst.edu> wrote:
> I was able to create a java program which uses java mapscript, but now
how do i
> get that program to run on my server so clients can access it.  It
seems like a
> java Servlet is the way to go but i cant find any good tutorials on
how to get
> started.  I know what the code looks like for a servelt (example
below) but
> once i have that written where do i put it? do i need to install
anything else
> to get it to run?  I am running Apache on fedora core 5.
>
> Servelt code:
>
> import java.io.*;
> import javax.servlet.http.*;
> import javax.servlet.*;
>
> public class Servlet_test extends HttpServlet {
>   public void doGet (HttpServletRequest req,HttpServletResponse res)
>     throws ServletException, IOException
>   {
>     PrintWriter out = res.getWriter();
>
>     out.println("Hello, world!");
>     out.close();
>
>   }
> }
>



More information about the mapserver-users mailing list