Re: JSP Escape character problem - PLEASE HELP

2002-01-10 Thread Micael Padraig Og mac Grene

At 05:27 PM 1/10/02 +0100, you wrote:
Hi,

Exactly this code works perfectly fine in JRun! It seems like the parser 
could not handle the escaped quotation mark in the document.write() 
method. Could anybody help? I am currently working with Tomcat 4.0.1. I 
have downloaded the binaries only (for M$ Windows).

Many thanks!!

Thomas


Well, the code should not work in JRun.  Try compiling:
public class Test {
 public static void main(String [] params) {
 System.out.println(document.write(\SCRIPT 
LANGUAGE='JavaScript1.2' 
SRC='/Echnaton/Scripts/hierArrays_Admin.js'\/SCRIPT\););
 }
}

and you will see what is wrong with \/ before SCRIPT.  The character / is 
not a valid escape character.  Cannot understand why JRun would compile it.

-- micael



Re: Vectors? Why does this not work?

2002-01-10 Thread Micael Padraig Og mac Grene

At 03:49 PM 1/10/02 -0500, you wrote:
Why does this simple example not work?
I am using Tomcat 3.3 and JDK 1.3.1_01 and Redhat Linux 7.2

Thanks,

==

// SimpleClass.java
// A Simple Class
public class SimpleClass extends Object{
private static String last_name;
private static String first_name;
private static String middle_name;


Must be a trick school assignment.  The member variables are static.

Take the static out of the first name only and you will get something 
like this.  Easy.  lol.

Garbage In
0: Washington, George
1: Adams, John
2: Jefferson, Thomas
3: Madison, James
4: Monroe, James
5: Adams, John
6: Jackson, Andrew
7: Buren, Martin
8: Harrison, William
9: Tyler, John
10: Polk, James
11: Taylor, Zachary
12: Filmore, Millard
13: Pierce, Franklin
14: Buchanan, James
Garbage Out
0: Buchanan, George
1: Buchanan, John
2: Buchanan, Thomas
3: Buchanan, James
4: Buchanan, James
5: Buchanan, John
6: Buchanan, Andrew
7: Buchanan, Martin
8: Buchanan, William
9: Buchanan, John
10: Buchanan, James
11: Buchanan, Zachary
12: Buchanan, Millard
13: Buchanan, Franklin
14: Buchanan, James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Extending Standard Context

2002-01-03 Thread Micael Padraig Og mac Grene

At 04:41 PM 1/3/02 -0400, you wrote:
I can suggest something for the second question:

1) Define a java bean (a class) that implements runnable inside
WEB-INF\classes
2) Add this bean to every JSP  Servlet that you want it to include so, the
first will start() the process and also put the scope=application

By that way I guess you aren't violating the Servlet Spec and I guess also
is better than redefine your own context class. Don't you think ?

Regards,

Guido.


Cool, Guido. 


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Servlet running twice at the same moment.

2002-01-02 Thread Micael Padraig Og mac Grene

At 12:00 PM 1/2/02 -0700, you wrote:
Hello,

I don't know why this is happening, but... It seems like whenever I run a
single servlet, there are times it will run twice.  As in, this...
...Robin

Robin, there is no way to have any clue why this is happening without 
seeing the code. Micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: JDBC for mySQL

2002-01-01 Thread Micael Padraig Og mac Grene

At 01:05 PM 1/1/02 -0600, you wrote:
yep!
http://jdbc.postgresql.org/

http://sourceforge.net/project/showfiles.php?group_id=15923

both work with tomcat!
have fun.
B

-Original Message-
From: Simon [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 01, 2002 12:44 PM
To: Tomcat Users List
Subject: JDBC for mySQL


Sorry, this goes a little out of topic.

Are there JDBC driver for MySQL and postgres? Any these drivers work with
tomcat?

Simon.


There is a list of drivers in java.sun.com.  Also, you need to know if you 
are going to be using the java.sql.jdbc or the javax.sql.jdbc.  I recommend 
the latter.  Whatever will work with your jdk will work with tomcat or any 
other Java platform.


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: cloning an Enumeration - how?

2001-12-30 Thread Micael Padraig Og mac Grene

At 03:41 PM 12/30/01 +0200, you wrote:
Hi all,

Forgive what may be a stupid question:

I am trying to retrieve all the locales from the Accept-Language header
in a request. To do this I use the following call:

Enumeration locales = pageContext.getRequest().getLocales();

My problem is that once I have enumerated through this variable locales,
there is no way I can see to reset it so I can enumerate through it
again.

I also cannot seems to find a way to clone this object, as Enumeration
is not a child of java.lang.Object, but an interface.

Can anyone shed some light on the correct way to enumerate through an
Enumeration more than once?

Regards,
Graham

Take a look at the Enumeration interface, which has only the following 
methods:

 boolean hasMoreElements();
 Object nextElement();

Each component that wishes to use this interface can do so as it 
pleases.  Note that Vector uses an anonymous inner class in its elements() 
method as follows:
public Enumeration elements() {
return new Enumeration() {
   int count = 0;

   public boolean hasMoreElements() {
   return count  elementCount;
   }

   public Object nextElement() {
   synchronized (Vector.this) {
if (count  elementCount) {
return elementData[count++];
}
}
throw new NoSuchElementException(Vector Enumeration);
}
};
}

So, what you have to do, if you are using Vector, to use the Enumeration 
again is to call elements() again.  You could roll your own, if you want 
more functionality.  Usually I do the opposite, e.g., roll my own to get 
less functionality.

Hope this helps.


Re: cloning an Enumeration - how?

2001-12-30 Thread Micael Padraig Og mac Grene

At 03:41 PM 12/30/01 +0200, you wrote:
Hi all,

Forgive what may be a stupid question:

I am trying to retrieve all the locales from the Accept-Language header
in a request. To do this I use the following call:

Enumeration locales = pageContext.getRequest().getLocales();

My problem is that once I have enumerated through this variable locales,
there is no way I can see to reset it so I can enumerate through it
again.

I also cannot seems to find a way to clone this object, as Enumeration
is not a child of java.lang.Object, but an interface.

Can anyone shed some light on the correct way to enumerate through an
Enumeration more than once?

Regards,
Graham

By the way, Graham, I have no idea whether you can or cannot clone the 
object you get, but the object you get is not an instance of Enumeration 
(even though it has the type of Enumeration) but is an instance of an 
anonymous inner-subclass of Enumeration.  So, your reason for not cloning 
it are not valid.  Maybe it is cloneable.  Have you tried?  Cannot see 
right off why it would not be cloneable.  Maybe you cannot because it 
cannot be casted.  However, did I not read something about there being a 
way around casting in j2sdk1.4.0-beta3?

Why don't you wrap the class and stick in your own inner class with a 
method giving an Enumeration that allows you to reset the cursor on the 
array so that you can reuse the Enumeration object?

Micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: can't access PostgreSQL from Servlet

2001-12-27 Thread Micael Padraig Og mac Grene

At 09:55 PM 12/27/01 -0800, you wrote:
  When servlet is executed ResultSet
returns null when it shoud return result of SQL query.


I don't know where the problem could be but it seems
that Java code or some type of permission is
incorrect.  Here is my Servlet code that compiles but
gives ResultSet as null.

I good idea is to first make sure it has something to do with the 
servlet.  Try a manual run of the sql statement and see what you get.  If 
you do not get a null result, then you can look at the servlet.  My 
experience is that it almost always is the sql statement, and, as you 
say,  permissions.  So, it is good stuff to check those first.

- micael



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Please Help

2001-12-20 Thread Micael Padraig Og mac Grene

At 01:13 PM 12/20/01 +0530, you wrote:
Hi To All,

What is TC Stand alone Servlet Contairs

Please help

Vikas


Cannot imagine what the fire is, but I assume that you mean Tomcat for TC 
and by stand alone using the Tomcat server without a J2EE application?


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




McClanahan Hints

2001-12-19 Thread Micael Padraig Og mac Grene

At 06:31 PM 12/19/01 -0800, you wrote:


Craig McClanahan


--

Craig have you thought of putting together a compilation of your 
answers?  I think it would be a very helpful addition to the jakarta suite.


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Tomcat 3.3 vs. 4.0: TELL US NOVICES WHAT IS GOING ON

2001-12-18 Thread Micael Padraig Og mac Grene

At 01:13 PM 12/18/01 -0800, you wrote:
Unfortunately, Tomcat 4.x doesn't support load-balancing, yet -- even with
mod_jk. So, if you need it, you should stick with 3.3.

Thanks,
--jeff


What is going on with 3.3 and 4.0?  Are there two camps in Tomcat?  Is 
there a battle to see which is going to win?  Why is 4.0 an extension of 
3.2 and what is 3.3 all about?  I need to know what the plans are in order 
to make some significant decisions.  Can someone tell me what is happening, 
or direct me to a place to find out?  Thanks.

Micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: How to get webapp name

2001-12-16 Thread Micael Padraig Og mac Grene

At 02:29 PM 12/16/01 -0600, you wrote:
Hello:

Is there a way to get the webapp name in a JSP page?

Thanks,
 Neil.


Hi, Neil,

Cannot tell what ou want here.  Try stating it differently.  What do you 
mean by webapp?

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Is Tomcat considered to be a J2EE implementation?

2001-12-15 Thread Micael Padraig Og mac Grene

At 11:48 AM 12/15/01 -0500, you wrote:
Thanks,

I've been using JServ to create servlets for a while, and I thought that the
difference between simply using servlets and J2EE was that the latter has an
EJB container. If this is true, then does Tomcat come with an EJB container?
Or maybe a better question is, can you program EJBs with Tomcat?

Thanks again,
Michael


Try looking at, for example, JBoss.  That is a j2ee enterprise application 
container that uses Tomcat (and Jetty, if you want) as the web 
container.  The previous answer gave you everything you need to know.

The answer was and is that Tomcat is not a j2ee container.  Tomcat is a web 
container that handles  jsp/servlet functionality.

Normally, the j2ee functionality is not web client to server, but is server 
to server and various underlying APIs (as pointed out to you in the 
previous answer) to assist.  In short, the last guy gave you a correct 
answer.  Read it carefully and start checking out enterprise application 
servers, such as JBoss, etc.

Hope this helps, but it really does not and need not add anything to what 
you already have been told.  What you already have been told is the whole 
answer.  Tomcat has no deployer for enterprise java beans.

Bye,

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Application Design: initialization

2001-12-15 Thread Micael Padraig Og mac Grene

At 10:05 AM 12/15/01 -0800, you wrote:
Hey All,

I am a bit confused in J2EE (and tomcat) concerning the best spot to do a 
bunch of initializations, and other startup code.

Now, in Coldfusion you have the Application.cfm file which gets run on 
every request, thus you can load up the application scope (if
its unitialized) or recycle it periodically with data/objects (which is 
great for cache queues).

In jsp, I would like to have a  jsp file run on initialization so that I 
can offer that file as a jsp based application
initialization file (using custom tags to load up the application scope 
and even session and other goodies like internationalization
bundles etc).

It seems the best spot would be a ServletContext listener that would, on 
startup, fire a request to the Application.jsp file ... but
this does not seem possible given the ServletContextListener interface (or 
is it)?

In general, I haven't found much info on best practices for setting up the 
initial state of an application.  If I wanted load up
some JNDI entries on startup, where is the best place to do this (in a 
ServletContextListener perhaps?) ?  And for some application
attributes, same question.  And to initialize the session for a user?

I really like the Coldfusion concept of the Application.cfm file since you 
can do all your state checks there, and then all your
scripts/servlets can expect the web application state to be well 
managed.  Its also a great spot for loading in internationalization
resource bundles.

It would be even better to have a more fine grained Application.jsp file 
that would fire on initialization and vice versa, and for a
few other significant application events.  I don't particularly like 
putting a lot of params in the web.xml file since this can
complicate migrations and makes it a bit un-programmatic.  I also like 
having simple custom tags loading the application and session
scope so that you can glance at one script for the app and see what is in 
those scopes by default, rather than having servlets doing
their own thing and promoting decentralized scope processes.

Any ideas?

Thanks,
John.

Hi, John,

I actually cannot tell what you are talking about.  You are not making 
sense to me.  But, here is a stab of helping.

Well, I don't know about ColdFusion, but the idea of a startup JSP file 
application initialization makes no sense in Java.  You could set 
application values with a JSP, but that is not what you want.

If when you startup a JSP/servlet container you want application parameters 
set, then you need to set them at the outset with a startup servlet.  Such 
servlets are commonly called StartupServlet.class.  I have no idea why 
you don't like using web.xml to set the values of your initialization.  The 
idea of the web.xml is to promote migrations and programmatic 
behavior.  Why you think it is unsuccessful is less than clear to me.

Perhaps you would prefer to go further and use JNDI for 
initialization?  Application wide parameters can be set whenever you want 
to do so.

I suspect, but am not sure, that you have not looked at what JSP/servlets 
have to offer as yet.  If you have and I am missing the point, please 
accept my apologies and know that at least I am trying to help you.

Why do you think web.xml is such a bad idea?  That is not clear at all.

- micael




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: JNDI DataSource Question

2001-12-14 Thread Micael Padraig Og mac Grene

At 01:34 PM 12/14/01 +, you wrote:
Hi,

I had posted this question some time back and am posting just in case some 
one may have just missed it.

I am trying to get a JNDI connection to a datasource. For this I defined 
my datasource exactly as it is described in the Tomcat docs - define a 
resource in WEB.XML and in SERVER.XML

When I try to connect, my context keeps returning me a NULL DataSource. I 
read thru all of the mails in the list, I could not get any definite pointers.

Can someone who has solved the problem, please point me in the right 
direction.

Thankyou for the time,
Krishna.


Your problem inevitably has to be that your code is referencing something 
that is not being found.  That leaves two potential problems: (1) you don't 
have your data source from your service provider in the right place; (2) 
you don't have a reference as required to where you have the 
datasource.  If you have the data source in the right place, there should 
be a default reference, so (1) is probably it.  Where do you have the data 
source sitting?

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: JNDI DataSource Question

2001-12-14 Thread Micael Padraig Og mac Grene

At 07:07 PM 12/14/01 +, you wrote:
Hi,

Thankyou for the mail.

my datasource is sitting on the local computer and I can connect with a 
normal JDBC Connection. The same driver properties I use to create a 
datasource in server.xml and it fails.

I thought it can be a problem like Tomcat failing if we have the 
servlet.jar in java/lib/ext, so I cleaned it out.

Any pointers?

Krishna.


I hate to ask silly questions, but because you provide no details, I have 
to guess.  You are using javax, right?

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: DataSource and Pooled Connection

2001-12-13 Thread Micael Padraig Og mac Grene

At 03:20 PM 12/13/01 -0500, you wrote:
At 09:07 PM 12/13/2001 +0100, you wrote:
 I have a stupid question ?
 
 in the JNDI tomcat how to, it says :
 
 The J2EE Platform Specification requires J2EE Application Servers to make
available a DataSource implementation (that is, a connection pool for JDBC
connections) for this purpose. Tomcat 4 offers exactly the same support
 
 
 Do I understand right ?
 A DataSource retrieve by JNDI in tomcat 4.0.1 is a Pooled Connection ?
 
 Christophe
 

I've been messing with pooled connections and JNDI this week.  Unless
Tomcat is different somehow, JNDI won't give you a pooled connection via
DataSource.  You'll need to get a PooledConnection using a
ConnectionPoolDataSource as I understand it, and according to the various
information I've been researching.  See here for info from Sun:

http://developer.java.sun.com/developer/technicalArticles/J2EE/pooling


If you have a combined application server and Tomcat, it will return a 
pooled connection, with JNDI from mere connections.  That is the situation 
that was discussed.  They use RAR with JBoss, I believe it is called, which 
is how I get a pool and JNDI from the connection noted in the code.  My 
remarks were a bit of a screw up, really a lot of a screw up, and Mark is 
absolutely right.

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Micael mac Grene: DataSource and Pooled Connection

2001-12-13 Thread Micael Padraig Og mac Grene

At 02:13 PM 12/13/01 -0800, you wrote:


On Thu, 13 Dec 2001, christophe marcourt wrote:

  Date: Thu, 13 Dec 2001 21:07:47 +0100
  From: christophe marcourt [EMAIL PROTECTED]
  Reply-To: Tomcat Users List [EMAIL PROTECTED]
  To: Tomcat Users List [EMAIL PROTECTED]
  Subject: DataSource and Pooled Connection
 
  I have a stupid question ?
 
  in the JNDI tomcat how to, it says :  The J2EE Platform Specification
  requires J2EE Application Servers to make available a DataSource
  implementation (that is, a connection pool for JDBC connections) for
  this purpose. Tomcat 4 offers exactly the same support 
 
  Do I understand right ?
  A DataSource retrieve by JNDI in tomcat 4.0.1 is a Pooled Connection ?
 

It's actually a javax.sql.DataSource implementation.

  Christophe
 

Craig



First, I think I speak for thousands in thanking you for your 
contributions.  Despite the flame wars, I hope you guys and gals know how 
much we appreciate your efforts.  Second, could you expand on what Tomcat 
puts into a pooled connection for javax.sql.DataSource?

I have been using Postgresql and getting a pooled connection with JBoss and 
Tomcat and really do not understand what the hay is going on.  Is that 
from JBoss?  I am not getting a pooled connection from Postgresql, even 
though I though I was.  I so far have just been using Tomcat 3.2.3, I think 
it is, and JBoss and am using a standalone application thus far with 
Tomcat.  But, I definely am getting a pooled connection according to ps 
aux on my box.  I am getting an initial pool of five conncetions, I 
think.  Maybe six.

Thanx,

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Micael mac Grene: DataSource and Pooled Connection

2001-12-13 Thread Micael Padraig Og mac Grene

At 01:39 PM 12/14/01 +1100, you wrote:
I am not 100% sure, but I am pretty sure that the PostgreSQL (7.1.2) JDBC
driver does not yet support Pooled DataSource connections.

That is what they have said on the PgSql JDBC list, but please correct me if
I am wrong as we would love to use pooled datasource connections..

I believe Postgres 7.2 ( JDBC driver) might support it...

Amit

Yah, my mistake.  I thought they did because I was getting a pool with 
Tomcat 3.2.3 and JBoss.

mea culpa, mea maxima culpa.

- micael



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: charset problem in java beans

2001-12-12 Thread Micael Padraig Og mac Grene

At 07:23 PM 12/12/01 +0800, you wrote:
thanks Craig,

Craig wrote :
 
  It sounds like you might be working too hard :-).

how did you understand? :)

 

Sounds as it fhe problem is either related to Geary's new book on taglibs 
or something similar.  I don't know the history, but his critical 
application in chapter eleven of his book had to be changed for Tomcat 
3.2.  I had to move %@ page contentType='text/html; charset=UTF-8' % to 
the top of each one of his page.jsp files.  Just tossing this in, since the 
mention of hashtables made me think the problem was similar.

-- micael



Re: Why do i have to keep on restarting Tomcat?

2001-12-11 Thread Micael Padraig Og mac Grene

At 10:39 AM 12/11/01 +, you wrote:
I am currently using Tomcat to serve my JSP's, i know nothing of the way
JSPs work, my problem is everyday i am having to go onto these live servers
and physically restart Tomcat because the website is throwing back error
500s, once restarted however it is fine (for a while at least), the coders
are saying the code is flawless.

info: jsp forms, using an oracle database to store information from these
forms.

any ideas?? a general pointer in the right direction would be a great help!

thanks in advance.

Muhammad

There can be lots of reasons, depending on what the parameters are.  Are 
you talking about a production or a development environment, for example?

-- micael



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Why do i have to keep on restarting Tomcat?

2001-12-11 Thread Micael Padraig Og mac Grene

At 01:00 PM 12/11/01 +, you wrote:
Does anybody know where i can get a connection pool called DbBroker from
www.javaexchange.com, as it appears as though javaexchange no longer exists


Just wondering if you know that you get a pool automatically when you go to 
javax.sql.*.

-micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Why do i have to keep on restarting Tomcat?

2001-12-11 Thread Micael Padraig Og mac Grene

At 02:40 PM 12/11/01 +, you wrote:
I believe DbBroker is more a connection pool manager

Muhammad

Every connection pool inherently has a pool manager.  Otherwise it would 
not work.  Are you familiar with DataSource classes?  Just trying to be 
helpful.  I think you are probably headed the wrong direction.

-- micael






--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Page encoding problem

2001-12-11 Thread Micael Padraig Og mac Grene

At 08:57 PM 12/3/01 +0100, you wrote:
Hi all. I'm having a bit of an page encoding problem. I'm trying to use 
ISO-8859-2 (a.k.a. Latin-2) page encoding and something is going wrong.

I have a page that wascreated first as HTML, with ISO-8859-2 encoding. 
This page displays OK under Dreamweaver 4 and web browsers.

It is impossible to say what you are doing wrong if you do not include your 
code.  I use full internationalization on all my jsp pages with no 
problem.  But, I don't know what your encoding code is.

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Change an include file requires re-compiling all JSP that include it (?)

2001-12-11 Thread Micael Padraig Og mac Grene

At 12:04 PM 12/11/01 -0800, you wrote:
  1) Where do they go?  I don't see them anywhere under my webapp's folder
(I
  thought they go in WEB-INF/classes but they're not there)
 
  2) Blech, that's what I do now.  If I have 100 JSP files all including the
  same header file I'm doomed!

Under Unix, it would be simply touch *.jsp, no need to do them
individually


Look under /whatever/tomcat/work/

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Servlets and memory usage.

2001-12-11 Thread Micael Padraig Og mac Grene

At 02:05 PM 12/11/01 -0700, you wrote:
Hello everyone.

I've run into a big problem with memory usage in servlets, and I want to
get some opinnions on this.
Here is the scenerio:



Has anyone run
into a similar issue like this?  Is there a way to schedule servlet
memory to be garbage collected sooner?

Hope this isn't too silly a question.

Thanks in advance,
-Scott

Sounds as if you think that Java cleans up all garbage.  It does not.  You 
have to take care of cleaning up resources that the garbage collector could 
care less about.  There are many ways to do this, and they are covered in 
any good book on Java.  Try, for example, Thinking in Java, which covers 
that fairly well.

-- micael



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: What causes a segmentation fault with Apache? (redirecting to tomcat via mod_jk)

2001-12-11 Thread Micael Padraig Og mac Grene

At 06:17 PM 12/11/01 -0600, you wrote:
I am trying to redirect a .jsp page to tomcat from apache via mod_jk.  I
finally got apache to start up (thanks to a compiled mod_jk from someone
else), but now when I try to access a jsp file, I get a can't find server,
no error in mod_jk.log, and this error in the apache error_log

[Wed Dec 12 08:13:57 2001] [notice] child pid 6489 exit signal Segmentation
fault (11)

does anyone know the cause of this?


Brandon Cruz


Probably a null pointer.

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Why do i have to keep on restarting Tomcat?

2001-12-11 Thread Micael Padraig Og mac Grene

At 12:17 PM 12/12/01 +1100, you wrote:
Not every database API supports connection pooling... Take Postgres for
example... The JDBC driver for 7.1.2/7.2 does not support connection
pooling...


Just wondering if you know that you get a pool automatically when you go to
javax.sql.*.

-micael



The new PostgreSQL driver supports this.  I know, I use it.

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Why do i have to keep on restarting Tomcat?

2001-12-11 Thread Micael Padraig Og mac Grene

At 12:17 PM 12/12/01 +1100, you wrote:
Not every database API supports connection pooling... Take Postgres for
example... The JDBC driver for 7.1.2/7.2 does not support connection
pooling...


As I previously said, the new PostgreSQL driver does support 
pooling.  Also, I think that any driver that implements the contract within 
javax.sql.* must do so.  You did notice that the package mentioned is NOT 
java.sql.*, didn't you?

I find my use of PostgreSQL 7.1.3 does a great job of handling pools and I 
never have to code a lick.  Kinda peoed me off, because I made some of the 
best old database pools seen around these here parts.  Now things are so 
easy for the kids.  ;-)

I did not know 7.2 was available, but 7.13 does the job.  Good luck, and 
you might want to check this out in a bit more detail.  I am not sure what 
the trouble you are having is, but I suspect you don't realize that 
java.sql.* is the starter kit and javax.sql.* is the grown-up table.I 
hope you don't take this way of expressing the difference wrong.  I am 
merely trying to drive the point home (no pun intended) so you don't keep 
running in circles.

Following is the code I use to get a pool, believe it or not.  Isn't it 
AMAZING?
public class PostgresqlConnection {
 private Connection conn;
 private String user;
 private String password;

 public Connection getConnection(String user, String password) throws 
ClassNotFoundException, SQLException {
 Class.forName(org.postgresql.Driver);
 PostgresqlDataSource dataSource = new PostgresqlDataSource();
 conn = dataSource.getConnection(user, password);
 return conn;
 }
}

So, anyway, you can see there is a PostgresqlDataSource object after 
all.  Otherwise, I am the biggest joker on this list.  Night all.  I've 
copied a couple of pals who might be interested in this code.

-- micael




RE: Why do i have to keep on restarting Tomcat?

2001-12-11 Thread Micael Padraig Og mac Grene

At 10:20 PM 12/11/01 -0800, you wrote:
At 12:17 PM 12/12/01 +1100, you wrote:
Not every database API supports connection pooling... Take Postgres for
example... The JDBC driver for 7.1.2/7.2 does not support connection
pooling...


I will get this all right yet.  I don't think there is a 7.2, is there?  I 
cannot see one on the PostgreSQL mirrors.  Is there a beta out there 
somewhere I don't have access to?

You have to make sure you get your driver from javax.sql.*.  There is also 
a driver for java.sql.*, of course.  Don't use that one, if you want a 
DataSource dirver.

If you don't see the pooling in my prior code, that is the magic.  That is 
taken care of.  All you have to do is call a connection.  When you do, you 
will magically see a pool appear with ps aux in Linux.

The DataSource object takes care of everything, including JNDI access.

I cannot wait until JDO is fully developed.  These are the golden days!

-- micael



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Unable to include *.sum files (Again)

2001-12-10 Thread Micael Padraig Og mac Grene

At 08:14 AM 12/10/01 +0200, you wrote:
Hi all,

Thanks for all the responses(including the debate) to this question! It made
some real interesting reading material after the SHORT weekend! To get back
to August's suggestion: we've tried it but our problem is that the file
content is generated by a VB program and
contains some funny characters e.g. CPI rather than CPI. When we
translate these to a string it either comes out as ?CPI? or as illustrated
in the attached image(This is also how
it displays in JBuilder).

Regarding the debate I tend to agree with Jeff. If you want to display the
pure contents of a file you should be able to include the file using
jsp:include without having to define a mime type. I mean what happens if
you want to include a code example, for example a code snippet that
illustrates how to code something in C,C++,Java etc. If you define the mime
type it will try to translate it, which is not what we want in this case...
You could define it as type text but now you need to maintain two mime types
for one extension? Just doesn't sound right to me. The other thing that
bothers me is the fact that it works for the %@ include...% directive but
not for the jsp:include.../ surely they should perform similar actions
simply using a different syntax?

Thanks again,
Jonathan

I still don't see, Jonathan, why you don't just use code in your include 
which catches the mime types and deals with them?  Why is the include 
important to you in the first instance?  I think the people in this list 
might be able to help you, if we knew what the facets of the problem 
are.  This sounds like a problem that can be solved, but I am not sure what 
the situation is.

Micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Unable to include *.sum files (Again)

2001-12-08 Thread Micael Padraig Og mac Grene

At 08:22 PM 12/7/01 -0800, you wrote:
Yeah, see my last post. Since JSP output is written with a PrintWriter, the
Catalina code is restricting it to only being able to output known text/*
MIME types. This just doesn't feel right to me.

Thanks,
--jeff

Well, jeff, then it is not a bug.  At best it is a difference of 
opinion.  That makes all the sense in the world to me.  If you want to 
bring in something other than the known 'text/* MIME types, just include 
the proper code in your include?  We have differing intuitions here.  I 
think what Catalina is doing is proper and makes sense.  But, at worst for 
you, it is an inconvenience.  Right?

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Unable to include *.sum files (Again)

2001-12-08 Thread Micael Padraig Og mac Grene

At 01:27 PM 12/8/01 -0800, you wrote:
I'm not so sure. The JSP spec doesn't say anything about having to register
the MIME type of a file before using it in a jsp:include directive. Consider
how difficult that would be if you were generating dynamic filenames with
extensions like .001, .002, .003, etc... You could potentially have to
register several hundred (even thousand) meaningless MIME types. Also, think
about what webservers do when they encounter an unknown MIME type -- they
default back to text/html (or whatever you have set as your default...). Why
should a JSP be more strict than this with it's include directive? The file
you are including is required to be a valid URL -- which means it could be
accessed via the webserver anyway.

Remember, Tomcat is the RI and should implement the spec as closely as
possible. I've gone back and looked through my books on JSP, and every one
of them says that you can use any file extension with the jsp:include
directive. However, none of them say you have to register that extension as
a valid MIME type first. At the very least, it's confusing for someone who
expects it to work when it doesn't -- especially when there's no
documentation on it.

Thanks,
--jeff

- Original Message -
From: Micael Padraig Og mac Grene [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Saturday, December 08, 2001 10:12 AM
Subject: Re: Unable to include *.sum files (Again)


  At 08:22 PM 12/7/01 -0800, you wrote:
  Yeah, see my last post. Since JSP output is written with a PrintWriter,
the
  Catalina code is restricting it to only being able to output known text/*
  MIME types. This just doesn't feel right to me.
  
  Thanks,
  --jeff
 

The JSP specification does tie the use of include to the requirements of 
the out JspWriter ?
--- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Unable to include *.sum files (Again)

2001-12-08 Thread Micael Padraig Og mac Grene

At 02:51 PM 12/8/01 -0800, you wrote:
I don't think the spec is that detailed -- I mean, it doesn't come out and
say the page attribute of jsp:include has to follow the requirements of
the JspWriter. So, I don't know the answer to that.

Remember though, we're talking about included files -- by their very nature,
they don't necessarily represent *entire* files. They may only be pieces of
a bigger file that is ultimately displayed to the surfer. I can understand
that the file sent to the browser must have a sensible MIME type, but must
all the pieces that the file is built from also have registered MIME types?
I'm not sure that makes sense.

Also, I always thought MIME types, in this context, were available so the
browser could decipher what kind of file was being retrieved and display
that file correctly. I never thought MIME types would be used to limit my
flexibility with JSPs in this way.

Thanks,
--jeff

I understand what you are saying, Jeff.  But the bottom line is that the 
JspWriter is the source of the out implicit object in this 
instance.  Apparently your bottom line is that you want to use the 
extension to pass information, instead of an extension in any true 
sense.  I think it is a little harsh to have them expect that use.  That 
said, and I may be wrong, why not toss the 'dynamic values in prior to 
the extension and trick the JspWriter, e.g. instead of com.site.123 us 
com.site.123.txt or com.site.123.jsp.  You are going to have to have a 
class read the url in any event.  The other way is to put your dynamic 
information inside the included tidbit.  That seems more intuitive to me 
than using an extension for information anyway.  Just a thought.

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Unable to include *.sum files (Again)

2001-12-08 Thread Micael Padraig Og mac Grene

At 03:53 PM 12/8/01 -0800, you wrote:
If it does use PrintWriter to write the output, then it makes sense for
it to only output text. See this from the PrintWriter javadoc:

Print formatted representations of objects to a text-output stream.
This class implements all of the print methods found in PrintStream. It
does not contain methods for writing raw bytes, for which a program
should use unencoded byte streams.

If you want to include files of non-text types (or types that are text,
but not included in your MIME types list), why not just write a utility
method that opens a file, reads it and returns its contents as a
String?

-August

Yah, August, we all agree on that.  Jeff is thinking that the 
specifications are not clear enough.  Just a difference of style I 
suppose.  Thanks for your input.


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Unable to include *.sum files (Again)

2001-12-08 Thread Micael Padraig Og mac Grene

At 06:10 PM 12/8/01 -0800, you wrote:
I agree that there are workarounds -- there are always workarounds -- but
Tomcat is the RI, so this is the place where we're supposed to figure this
stuff out.

I guess my argument is that Tomcat is being more restrictive than the spec
requires it to be. Whether that's acceptable or not is ultimately up to the
tomcat dev team.

Thanks,
--jeff


My last offering, Jeff, is that I think that the specs are pretty clear 
that the writing is done by JspWriter which has the upshot you face.  I 
don't consider the solutions to be workarounds.  Actually, as a design 
matter, I find your first instincts to be what I would consider to be a 
work around.  But, in design there are different strokes for different folks.

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Unable to include *.sum files (Again)

2001-12-07 Thread Micael Padraig Og mac Grene

At 01:31 PM 12/7/01 -0800, you wrote:
Nope. I tried it with *.doc files, too, and it still doesn't work. *.doc is
defined in web.xml.

Besides, it doesn't really make sense for MIME types to affect included
files, does it?

--jeff

I may be out to lunch here, Jeff, but it seems to me that it makes all the 
sense in the world for an included file to be affected by its MIME type.

-- micael


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Unable to include *.sum files (Again)

2001-12-07 Thread Micael Padraig Og mac Grene



At 02:21 PM 12/7/01 -0800, you wrote:
Hi Micael,

Let's make sure we're talking about the same thing. If I include a file
like:

jsp:include page=./testTxt.sum flush=true /

Why does it matter what the file extension of the included file is? Isn't
the container just supposed to open the file and output it's contents at
that particular spot in my JSP? Now, I agree that the contents of the
included file will be affected by the MIME type of the response -- how the
browser views those contents. If you include a file that doesn't match the
MIME type of your response, it may not appear correctly in your browser. But
that's not the point.

The JSP spec says the page attribute must evaluate to a String that is a
relative URL specification. When I pull up the testTxt.sum file in my
browser, it displays correctly (it's only one line of text...). So, I should
be able to include it in my JSP with the jsp:include directive. When I
change the extension to .txt, .html, or .jsp it works. Anything else, even
other registered MIME types like .doc, and it doesn't. (ok, I didn't try
them ALL...  :)

I think this is a bug. The old Java Web Server used to have a similar bug
where it would only include .htm and .html files.

--jeff

Before I look further, have you looked at the source code to see why this 
is happening?


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Tomcat 3.3, server.xml and a lot of fun

2001-12-03 Thread Micael Padraig Og mac Grene

You said:

rant
 I ... I  I  I  I   I  I   I  I  I   I
 I   I I know I can do it, but I  I  I .  I . I 
I  /rant
Best regards,

 [EMAIL PROTECTED]


Pretty personal stuff for a brilliant software engineer and a Yahoo fella.
You miss the big picture about Java.  I would expect you might want to
change your moniker to aspdesigner rather than javadesigner or, with all
your brilliance, get onto the Java developer list rather than this list.
They would get more humour out of it than this list.

Nice to learn so much about you, but you might want to post this on the me
users list. This is supposed to be about Tomcat, not you.

Thanks,

Best regards to you too.


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

I use postgresql.jar, so I put that in /usr/local/java/tomcat/lib/ext/ and
/usr/local/java/j2se13/jre/lib/ext/ and /usr/local/java/j2se13/lib/ext/.
Those directories are automatically found and do not need to be specified in
CLASSPATH.


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver .jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark


At 10:17 AM 11/29/2001 -0800, you wrote:
Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.  If
not, you should.  I don't want to bother talking about the kiddy version,
which is well-covered in Sun tutorials.  If I seem to talk about the kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the
rest
should be somewhat obvious.  There is nothing really tricky or special
about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as
you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include
your
jar or classes for a driver just like you do any classes or jars.  Jars
are
jars and classes are classes and they all are found in the same way.  I
also
use Tomcat in the context of an application server, running in the same
JVM,
so I have not shown a lot I do in relation to JMX specifications and
MBeans
and MLET classes which pop all I show here into a JNDI context.  But, that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need to
do
some scouting and reading on this, if you are not already up to speed.
When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest in
seeing how you progress with all this, because we all have to train people
new at things.

Micael, again

///;-)



///

public class PostgresqlConnection {
private Connection conn;
private String user;
private String password;

public Connection getConnection(String user, String password) throws
ClassNotFoundException, SQLException {
Class.forName(org.postgresql.Driver);
PostgresqlDataSource dataSource = new PostgresqlDataSource();
  conn = dataSource.getConnection(user, password);
return conn;
}
}

//

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
http://java.sun.com/j2ee/dtds/web-app_2.2.dtd;

web-app
  servlet
   servlet-nameauthenticate/servlet-name
   servlet-classAppAuthenticateServlet/servlet-class
  /servlet

  servlet
   

Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

You have to get a driver for the database you are using.  You have to get a
whole mydatabase.jar of files from them, implementing the jdbc interfaces.
Then you put those into /lib/ext/ in Tomcat and  j2ee and /jre/lib/ext/ in
j2se.  These do not need to be specified in CLASSPATH.

-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver .jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

Did you get my messages?
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver .jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark


At 10:17 AM 11/29/2001 -0800, you wrote:
Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.  If
not, you should.  I don't want to bother talking about the kiddy version,
which is well-covered in Sun tutorials.  If I seem to talk about the kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the
rest
should be somewhat obvious.  There is nothing really tricky or special
about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as
you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include
your
jar or classes for a driver just like you do any classes or jars.  Jars
are
jars and classes are classes and they all are found in the same way.  I
also
use Tomcat in the context of an application server, running in the same
JVM,
so I have not shown a lot I do in relation to JMX specifications and
MBeans
and MLET classes which pop all I show here into a JNDI context.  But, that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need to
do
some scouting and reading on this, if you are not already up to speed.
When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest in
seeing how you progress with all this, because we all have to train people
new at things.

Micael, again

///;-)



///

public class PostgresqlConnection {
private Connection conn;
private String user;
private String password;

public Connection getConnection(String user, String password) throws
ClassNotFoundException, SQLException {
Class.forName(org.postgresql.Driver);
PostgresqlDataSource dataSource = new PostgresqlDataSource();
  conn = dataSource.getConnection(user, password);
return conn;
}
}

//

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
http://java.sun.com/j2ee/dtds/web-app_2.2.dtd;

web-app
  servlet
   servlet-nameauthenticate/servlet-name
   servlet-classAppAuthenticateServlet/servlet-class
  /servlet

  servlet
   servlet-nameaction/servlet-name
   servlet-classActionServlet/servlet-class
   init-param
 param-nameaction-mappings/param-name
 param-valueactions/param-value
   /init-param
  /servlet

  servlet
   

Re: Auto load a servlet

2001-11-30 Thread Micael Padraig Og mac Grene

I missed the early part of this exchange.  Are you merely trying to direct
different clients to different files?


-Original Message-
From: Bret Farris [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Friday, November 30, 2001 8:44 AM
Subject: Re: Auto load a servlet


Thanks for the response.  However, this is what I'm doing now.
Unfortunately, using localhost in the redirected url does not work when
the client browser is on another computer.  I can use the host computers IP
address instead, but defeats the purpose of what I'm trying to do, which
I'll explain more.

We make equipment that monitors clean rooms for companies, as well as the
software that can monitor all the equipment at one time.  We have created a
servlet that will allow anyone in the company to monitor limited portions
of
the software without having to install the software on lots of machines.
So
we will be including Tomcat 4 with our software.  I don't want to have to
create a customized index.html file for each customer.  So I'm searching
for
a different solution.

I'm researching using javascript to automatically find the IP address of
the
hostcomputer and redirect to the IP+webstation/servlet/WebStation.  But
have come up empty on that front so far.

Any other suggestions would be greatly appreciated.

Thanks,
Bret

- Original Message -
From: James Chuang [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, November 29, 2001 15:04
Subject: Re: Auto load a servlet


 Create a real simple index.html, and have it do a onLoad like this...

 HTML
 SCRIPT language=JavaScript
 function redirect() {
 window.location.href =
http://localhost:8080/webstation/servlet/WebStation;
 }
 /SCRIPT
 BODY onLoad=redirect() 
 Redirecting ...
 /BODY
 /HTML

 Then setup your web server to serve up index.html by default.


 - Original Message -
 From: Bret Farris [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Thursday, November 29, 2001 1:32 PM
 Subject: Auto load a servlet


 I have a servlet that can be loaded by going to
 http://localhost:8080/webstation/servlet/WebStation
 The servlet, WebStation.class, is in the directory:
 webstation\WEB-INF\classes.  WebStation.class calls two other servlets,
 BtmFrame.class and TopFrame.class, which in turn load and display in a
 browser html files from the webstation directory.

 What I want to do is have the user enter http://localhost:8080 into their
 browser, and run the above servlet, as if they entered the link above.
Is
 there a way to do this?  I have tried to use mapping with as many
different
 combinations as I can think of, but nothing has worked.

 Thanks,
 Bret



 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Auto load a servlet

2001-11-30 Thread Micael Padraig Og mac Grene

Why don't you just use a mapping in your web.xml file?
-Original Message-
From: Bret Farris [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Friday, November 30, 2001 10:23 AM
Subject: Re: Auto load a servlet


Actually, I want a client to be able to type into their browser
http://ipaddress instead of http://ipaddress/webstation/servlet/WebStation
and allow the servlet to automatically load.  I would rather avoid using a
redirect in an index.html file to accomlish this.  I have tried several
mapping scenarios, and nothing seems to work.

- Original Message -
From: Micael Padraig Og mac Grene [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, November 30, 2001 11:05
Subject: Re: Auto load a servlet


 I missed the early part of this exchange.  Are you merely trying to
direct
 different clients to different files?


 -Original Message-
 From: Bret Farris [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Date: Friday, November 30, 2001 8:44 AM
 Subject: Re: Auto load a servlet


 Thanks for the response.  However, this is what I'm doing now.
 Unfortunately, using localhost in the redirected url does not work
when
 the client browser is on another computer.  I can use the host computers
IP
 address instead, but defeats the purpose of what I'm trying to do, which
 I'll explain more.
 
 We make equipment that monitors clean rooms for companies, as well as
the
 software that can monitor all the equipment at one time.  We have
created
a
 servlet that will allow anyone in the company to monitor limited
portions
 of
 the software without having to install the software on lots of machines.
 So
 we will be including Tomcat 4 with our software.  I don't want to have
to
 create a customized index.html file for each customer.  So I'm searching
 for
 a different solution.
 
 I'm researching using javascript to automatically find the IP address of
 the
 hostcomputer and redirect to the IP+webstation/servlet/WebStation.
But
 have come up empty on that front so far.
 
 Any other suggestions would be greatly appreciated.
 
 Thanks,
 Bret
 
 - Original Message -
 From: James Chuang [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Thursday, November 29, 2001 15:04
 Subject: Re: Auto load a servlet
 
 
  Create a real simple index.html, and have it do a onLoad like this...
 
  HTML
  SCRIPT language=JavaScript
  function redirect() {
  window.location.href =
 http://localhost:8080/webstation/servlet/WebStation;
  }
  /SCRIPT
  BODY onLoad=redirect() 
  Redirecting ...
  /BODY
  /HTML
 
  Then setup your web server to serve up index.html by default.
 
 
  - Original Message -
  From: Bret Farris [EMAIL PROTECTED]
  To: Tomcat Users List [EMAIL PROTECTED]
  Sent: Thursday, November 29, 2001 1:32 PM
  Subject: Auto load a servlet
 
 
  I have a servlet that can be loaded by going to
  http://localhost:8080/webstation/servlet/WebStation
  The servlet, WebStation.class, is in the directory:
  webstation\WEB-INF\classes.  WebStation.class calls two other
servlets,
  BtmFrame.class and TopFrame.class, which in turn load and display in a
  browser html files from the webstation directory.
 
  What I want to do is have the user enter http://localhost:8080 into
their
  browser, and run the above servlet, as if they entered the link above.
 Is
  there a way to do this?  I have tried to use mapping with as many
 different
  combinations as I can think of, but nothing has worked.
 
  Thanks,
  Bret
 
 
 
  --
  To unsubscribe:   mailto:[EMAIL PROTECTED]
  For additional commands: mailto:[EMAIL PROTECTED]
  Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 
 
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-30 Thread Micael Padraig Og mac Grene

Yah, you've moved along alright.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Friday, November 30, 2001 10:03 AM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


Yes, I saw your replies about the db jar files.  The company I work for
uses various databases, and it seems unusual (to me) to have to copy each
vendor's JDBC .jar files to other directories vs. being able to directly to
them in their respective production install directories (eg.
../oracle/jdbc/lib/classes12.jar).  That's a subjective opinion though.  In
any case, I moved on to JSP taglibs with Tomcat and had absolutely no
problems.

I'm ramping up for a J2EE development project and very pleased with the
progress I've made with Tomcat this week (after getting over my initial
servlet mapping problems/ignorance).

Next... I'll make my first attempt at using the Sun RI of Java Data
Objects.  Anyone used JDO in conjuction with Tomcat?



At 09:20 AM 11/30/2001 -0800, you wrote:
Did you get my messages?
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 2:20 PM
Subject: Re: OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat
4.0/JDBC driver configuration?


To answer your question, yes I understand what a servlet's init() method
is
and when it's called.   You've provided valuable information and I
basically understand it, providing jdbc setup info through init-params in
web.xml.  I'll definitely plan on looking closer at javax.jdbc - I've
only
used the (as you put it) 'kiddy' jdbc stuff in the past.

However, my question is about the physical location of the jdbc driver
.jar
file.  In other environments I've worked with, including the location of
the .jar in the CLASSPATH was sufficient.  With Tomcat, does one have to
copy the driver to ../common/lib?  If so, that doesn't seem like a very
good situation to be in especially in a production environment.  I tried
to
modify CLASSPATH in the startup scripts to see if that'd work, but
everything went haywire after that under Win2k - *nothing* worked even
after backing out the simple change (even had to reboot to get things in
working order again).

I suspect I'm again missing/not understanding something.

Thanks again for your help...
Mark


At 10:17 AM 11/29/2001 -0800, you wrote:
Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First
is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.
If
not, you should.  I don't want to bother talking about the kiddy
version,
which is well-covered in Sun tutorials.  If I seem to talk about the
kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the
rest
should be somewhat obvious.  There is nothing really tricky or special
about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as
you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask
if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and
ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include
your
jar or classes for a driver just like you do any classes or jars.  Jars
are
jars and classes are classes and they all are found in the same way.  I
also
use Tomcat in the context of an application server, running in the same
JVM,
so I have not shown a lot I do in relation to JMX specifications and
MBeans
and MLET classes which pop all I show here into a JNDI context.  But,
that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need
to
do
some scouting and reading on this, if you are not already up to speed.
When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or
Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest
in
seeing how you progress with all this, because we all have to train
people
new at things.

Micael, again

///;-)




OKAY: HERE GOES. THIS IS GETTING INTERESTING. Re: Tomcat 4.0/JDBC driver configuration?

2001-11-29 Thread Micael Padraig Og mac Grene

Hi, Mark,

Moving on, I see.  Great!  Here is a bunch of junk to look at and maybe
learn from.  (I don't mind ending sentences prepositions with.)  First is
this little way to get a connection from a PostgreSQL driver using
DataSource.  I assume you will be using DataSource and not the kiddies
version of jdbc, i.e. you will be using the jdbc extension, I assume.  If
not, you should.  I don't want to bother talking about the kiddy version,
which is well-covered in Sun tutorials.  If I seem to talk about the kiddy
version with disdain, that is the correct impression. ///;-)

Once you have the industrial strength jdbc set up with DataSource, the rest
should be somewhat obvious.  There is nothing really tricky or special about
Tomcat in this regard.

What I definitely like to do is to get all the database parameters as you
say established with start up in Tomcat, so I put it all in a StartUp
servlet that has an init() method.  Before I go on, I will stop and ask if
you know what an init() method with a servlet does?


NOTICE THAT THE jdbcURL, etc. used in the start up servlet come from the
web.xml specification that is for the start up servlet and ServletConfig,
i.e. are for init() parameters in web.xml.

Also note the resource reference in the web.xml at the bottom.  You are
beginning to get into a bit more complicated area.  You have to include your
jar or classes for a driver just like you do any classes or jars.  Jars are
jars and classes are classes and they all are found in the same way.  I also
use Tomcat in the context of an application server, running in the same JVM,
so I have not shown a lot I do in relation to JMX specifications and MBeans
and MLET classes which pop all I show here into a JNDI context.  But, that
should not be a problem.

Please do not fail to stop and learn the DataSource and jdbc extension
stuff.  You have to get an advanced driver when you do this.  The kiddy
drivers do not work with or have DataSource implementations.  You need to do
some scouting and reading on this, if you are not already up to speed.  When
I find out how much you know about this, then I can point you better.

Micael

Below are:

   1.  A little made up class to get a DataSource connection or Connection
object.

2.   A more developed web.xml than I have shown you before.

3.  A StartUp servlet which is fairly sophisticated.

Have fun and let me know how it goes, if you would.  I have an interest in
seeing how you progress with all this, because we all have to train people
new at things.

Micael, again

///;-)



///

public class PostgresqlConnection {
private Connection conn;
private String user;
private String password;

public Connection getConnection(String user, String password) throws
ClassNotFoundException, SQLException {
Class.forName(org.postgresql.Driver);
PostgresqlDataSource dataSource = new PostgresqlDataSource();
  conn = dataSource.getConnection(user, password);
return conn;
}
}

//

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
http://java.sun.com/j2ee/dtds/web-app_2.2.dtd;

web-app
  servlet
   servlet-nameauthenticate/servlet-name
   servlet-classAppAuthenticateServlet/servlet-class
  /servlet

  servlet
   servlet-nameaction/servlet-name
   servlet-classActionServlet/servlet-class
   init-param
 param-nameaction-mappings/param-name
 param-valueactions/param-value
   /init-param
  /servlet

  servlet
   servlet-namesetup/servlet-name
   servlet-classSetupServlet/servlet-class
   init-param
 param-namejdbcDriver/param-name
param-valueorg.postgresql.Driver/param-value
   /init-param

   init-param
param-namejdbcURL/param-name
param-value
 jdbc:postgresql://localhost:5432/db
/param-value
   /init-param

   init-param
param-namejdbcUser/param-name
param-valuedb/param-value
   /init-param

   init-param
param-namejdbcPwd/param-name
param-valueyobyor/param-value
   /init-param

   load-on-startup/
 /servlet

 servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
 /servlet-mapping

 servlet-mapping
servlet-nameauthenticate/servlet-name
url-pattern/authenticate/url-pattern
 /servlet-mapping

welcome-file-list
welcome-fileindex.jsp/welcome-file
/welcome-file-list

taglib
taglib-uriutilities/taglib-uri
taglib-location/WEB-INF/tlds/utilities.tld/taglib-location
/taglib

taglib
taglib-uriapplication/taglib-uri
taglib-location/WEB-INF/tlds/app.tld/taglib-location
/taglib

taglib
taglib-urii18n/taglib-uri
taglib-location/WEB-INF/tlds/i18n.tld/taglib-location
/taglib

taglib
taglib-urisecurity/taglib-uri

Re: Tomcat 4.0/JDBC driver configuration?

2001-11-29 Thread Micael Padraig Og mac Grene

You probably already figured out from what I sent that kiddy stuff is in
java.sql.* but grownups are in javax.sql.*.  ///;-)


-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Thursday, November 29, 2001 8:58 AM
Subject: Tomcat 4.0/JDBC driver configuration?


Can someone point me in the right direction or provide an example of
configuring an application to use JDBC under Tomcat 4.0?  I was able to use
both thin and OCI Oracle JDCB drover connections by copying the
classes12.zip to $CATALINA_HOME/common/lib directory and renaming it to
classes12.jar, but that's not a good long term solution.  I found having
the driver in the CLASSPATH doesn't work.

I suspect web.xml and/or server.xml is the place to configure the
deployment details.  Any examples or references to examples would be
greatly appreciated.

Mark


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: .gif images not displaying with JSPs

2001-11-28 Thread Micael Padraig Og mac Grene

Congraduations.  A little work and now you are a Tomcat killer!
Interesting, Mark.  I am not using Tomcat 4.0, but 3.* and my examples is:

Host name=127.0.0.1 
   Context path=
docBase=webapps/examples /
   Context path=/examples
docBase=webapps/ROOT /

Your does not have webapps?   Micael


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Wednesday, November 28, 2001 6:03 AM
Subject: Re: .gif images not displaying with JSPs


After my initial message, I created an images directory (eg.
../myapp/images), so using %=request.getContextPath()%/images/image1.gif
results in:

/myapp/images/image1.gif

In server.xml, I'm set up as:

Context path=/myapp docBase=myapp debug=0 reloadable=true
Logger className=org.apache.catalina.logger.FileLogger
prefix=myapp. suffix=.txt
timestamp=true/
/Context

I noticed the difference between us is in docBase, where you prepend
'webapps/'. I simply followed the examples when I updated server.xml for my
app.  I'm just happy to say it now works 100% under Tomcat!

Mark


At 10:03 PM 11/27/2001 -0800, you wrote:
At any rate, Mark, I would be interested in what the path you get is.
Just
put %= request.getContextPath() % before
 img src='%= request.getContextPath() %/blah/blah.gif'/

-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 11:03 AM
Subject: RE: .gif images not displaying with JSPs


Yes, that fixed the problem - thank you!

Takes care of my problem with Tomcat, but it introduces a problem with
the
same app under VAJ - request.getContextPath() isn't in the IBM
HttpServletRequest interface.  Yet another place where VAJ isn't fully
compliant with the Sun APIs...

Thanks again for the help Carsten!

Mark


At 12:50 PM 11/27/2001 -0500, you wrote:
I've run into problems with images showing on JSPs in the past as well,
and
I found that using request.getContextPath() solves the problem to give
you
an absolute path within the context.

example:
img
src='%=request.getContextPath()%/graphics/flags/german_flag.gif'//a
/
tr


Hope that helps!

Carsten

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 12:36 PM
To: Tomcat Users List
Subject: Re: .gif images not displaying with JSPs


Can you display images from a JSP?  My straight html pages display
images
with no problems using Tomcat.  What's odd is if I take the html source
generated by the JSP (ie, 'view source from the browser'), save it as an
html file and re-display it, it's fine.  So the html generated by the
JSP
seems ok - it's only when it's being pushed to the browser from the JSP
servlet where the images don't display.

I don't understand odd classloader error messages that refer to the
images.
 Since the servlet .java/.class are being dealt with in the ../work
directory, could this have something to do with it?

Frustration mounting again...

Mark


At 08:27 AM 11/27/2001 -0800, you wrote:
I have a directory called graphics on the same level as WEB-INF, i.e.
root_directory/webapps/myapp/graphics/flags/ and
root_directory/webapps/myapp/WEB-INF/, and I use
 img src='graphics/flags/german_flag.gif'//a/tr
without dificulty, if that helps.  This may have to do with my settings
in
server.xml, which is:

 Context path=/myapp
  docBase=webapps/myapp
  debug=0
  reloadable=true 
 /Context

Hope this helps.  Again, inside and outside WEB-INF is a big deal.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 5:54 AM
Subject: .gif images not displaying with JSPs


My servlet/JSP/JavaBean app is working under TC 4.0.1, except for
images
not displaying in JSPs. The various .gifs live in the root context for
the
application, ie. the same directory as the html and JSP files.  The
JSP
has
simple embedded html statements such as:

aimg src=image1.gif align=left/a

For each img tag, the application log has an associated set of errors:

   2001-11-27 08:24:34
StandardWrapper[/myapp:org.apache.catalina.INVOKER.image1.gif]:
   Marking servlet org.apache.catalina.INVOKER.image1.gif as
unavailable
   2001-11-27 08:24:34 invoker: Cannot allocate servlet instance for
path
   /myapp/servlet/image1.gif
   javax.servlet.ServletException: Wrapper cannot find servlet class
image1.gif or a
   class it depends on
   ...

   - Root Cause -
   java.lang.ClassNotFoundException: image1.gif

The generated Java code (in ../work directory) looks like the
following:

out.write(  \r\n\r\naimg src=\image1.gif\
align=\left\/a\r\na
  img src=\image2.gif\ align=\left\/a\r\n);


The page displays except for the images, and the resulting html pushed
to
the browser has the img tags. The JSPs work under other environments
(eg.
VAJ, Sun SDK, etc). What 

Re: .gif images not displaying with JSPs

2001-11-27 Thread Micael Padraig Og mac Grene

I have a directory called graphics on the same level as WEB-INF, i.e.
root_directory/webapps/myapp/graphics/flags/ and
root_directory/webapps/myapp/WEB-INF/, and I use
 img src='graphics/flags/german_flag.gif'//a/tr
without dificulty, if that helps.  This may have to do with my settings in
server.xml, which is:

 Context path=/myapp
  docBase=webapps/myapp
  debug=0
  reloadable=true 
 /Context

Hope this helps.  Again, inside and outside WEB-INF is a big deal.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 5:54 AM
Subject: .gif images not displaying with JSPs


My servlet/JSP/JavaBean app is working under TC 4.0.1, except for images
not displaying in JSPs. The various .gifs live in the root context for the
application, ie. the same directory as the html and JSP files.  The JSP has
simple embedded html statements such as:

aimg src=image1.gif align=left/a

For each img tag, the application log has an associated set of errors:

   2001-11-27 08:24:34
StandardWrapper[/myapp:org.apache.catalina.INVOKER.image1.gif]:
   Marking servlet org.apache.catalina.INVOKER.image1.gif as unavailable
   2001-11-27 08:24:34 invoker: Cannot allocate servlet instance for path
   /myapp/servlet/image1.gif
   javax.servlet.ServletException: Wrapper cannot find servlet class
image1.gif or a
   class it depends on
   ...

   - Root Cause -
   java.lang.ClassNotFoundException: image1.gif

The generated Java code (in ../work directory) looks like the following:

out.write(  \r\n\r\naimg src=\image1.gif\
align=\left\/a\r\na
  img src=\image2.gif\ align=\left\/a\r\n);


The page displays except for the images, and the resulting html pushed to
the browser has the img tags. The JSPs work under other environments (eg.
VAJ, Sun SDK, etc). What am I doing wrong this time under Tomcat?

Thanks
Mark











--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: .gif images not displaying with JSPs

2001-11-27 Thread Micael Padraig Og mac Grene

Well, then, Mark, just get whatever the value of request.getContextPath() is
and hard code it.  ???  What do you think, Micael.


From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 11:03 AM
Subject: RE: .gif images not displaying with JSPs


Yes, that fixed the problem - thank you!

Takes care of my problem with Tomcat, but it introduces a problem with the
same app under VAJ - request.getContextPath() isn't in the IBM
HttpServletRequest interface.  Yet another place where VAJ isn't fully
compliant with the Sun APIs...

Thanks again for the help Carsten!

Mark


At 12:50 PM 11/27/2001 -0500, you wrote:
I've run into problems with images showing on JSPs in the past as well,
and
I found that using request.getContextPath() solves the problem to give you
an absolute path within the context.

example:
img
src='%=request.getContextPath()%/graphics/flags/german_flag.gif'//a/
tr


Hope that helps!

Carsten

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 12:36 PM
To: Tomcat Users List
Subject: Re: .gif images not displaying with JSPs


Can you display images from a JSP?  My straight html pages display images
with no problems using Tomcat.  What's odd is if I take the html source
generated by the JSP (ie, 'view source from the browser'), save it as an
html file and re-display it, it's fine.  So the html generated by the JSP
seems ok - it's only when it's being pushed to the browser from the JSP
servlet where the images don't display.

I don't understand odd classloader error messages that refer to the
images.
 Since the servlet .java/.class are being dealt with in the ../work
directory, could this have something to do with it?

Frustration mounting again...

Mark


At 08:27 AM 11/27/2001 -0800, you wrote:
I have a directory called graphics on the same level as WEB-INF, i.e.
root_directory/webapps/myapp/graphics/flags/ and
root_directory/webapps/myapp/WEB-INF/, and I use
 img src='graphics/flags/german_flag.gif'//a/tr
without dificulty, if that helps.  This may have to do with my settings
in
server.xml, which is:

 Context path=/myapp
  docBase=webapps/myapp
  debug=0
  reloadable=true 
 /Context

Hope this helps.  Again, inside and outside WEB-INF is a big deal.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 5:54 AM
Subject: .gif images not displaying with JSPs


My servlet/JSP/JavaBean app is working under TC 4.0.1, except for images
not displaying in JSPs. The various .gifs live in the root context for
the
application, ie. the same directory as the html and JSP files.  The JSP
has
simple embedded html statements such as:

aimg src=image1.gif align=left/a

For each img tag, the application log has an associated set of errors:

   2001-11-27 08:24:34
StandardWrapper[/myapp:org.apache.catalina.INVOKER.image1.gif]:
   Marking servlet org.apache.catalina.INVOKER.image1.gif as unavailable
   2001-11-27 08:24:34 invoker: Cannot allocate servlet instance for
path
   /myapp/servlet/image1.gif
   javax.servlet.ServletException: Wrapper cannot find servlet class
image1.gif or a
   class it depends on
   ...

   - Root Cause -
   java.lang.ClassNotFoundException: image1.gif

The generated Java code (in ../work directory) looks like the following:

out.write(  \r\n\r\naimg src=\image1.gif\
align=\left\/a\r\na
  img src=\image2.gif\ align=\left\/a\r\n);


The page displays except for the images, and the resulting html pushed
to
the browser has the img tags. The JSPs work under other environments
(eg.
VAJ, Sun SDK, etc). What am I doing wrong this time under Tomcat?

Thanks
Mark











--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: .gif images not displaying with JSPs

2001-11-27 Thread Micael Padraig Og mac Grene

Just a suggestion, Mark: if you actually showed the directories rather than
saying things like the root context or the same directory as the html and
JSP files it would be easier, because the relative paths are not the only
issues.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 5:54 AM
Subject: .gif images not displaying with JSPs


My servlet/JSP/JavaBean app is working under TC 4.0.1, except for images
not displaying in JSPs. The various .gifs live in the root context for the
application, ie. the same directory as the html and JSP files.  The JSP has
simple embedded html statements such as:

aimg src=image1.gif align=left/a

For each img tag, the application log has an associated set of errors:

   2001-11-27 08:24:34
StandardWrapper[/myapp:org.apache.catalina.INVOKER.image1.gif]:
   Marking servlet org.apache.catalina.INVOKER.image1.gif as unavailable
   2001-11-27 08:24:34 invoker: Cannot allocate servlet instance for path
   /myapp/servlet/image1.gif
   javax.servlet.ServletException: Wrapper cannot find servlet class
image1.gif or a
   class it depends on
   ...

   - Root Cause -
   java.lang.ClassNotFoundException: image1.gif

The generated Java code (in ../work directory) looks like the following:

out.write(  \r\n\r\naimg src=\image1.gif\
align=\left\/a\r\na
  img src=\image2.gif\ align=\left\/a\r\n);


The page displays except for the images, and the resulting html pushed to
the browser has the img tags. The JSPs work under other environments (eg.
VAJ, Sun SDK, etc). What am I doing wrong this time under Tomcat?

Thanks
Mark











--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: .gif images not displaying with JSPs

2001-11-27 Thread Micael Padraig Og mac Grene

At any rate, Mark, I would be interested in what the path you get is.  Just
put %= request.getContextPath() % before
 img src='%= request.getContextPath() %/blah/blah.gif'/
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 11:03 AM
Subject: RE: .gif images not displaying with JSPs


Yes, that fixed the problem - thank you!

Takes care of my problem with Tomcat, but it introduces a problem with the
same app under VAJ - request.getContextPath() isn't in the IBM
HttpServletRequest interface.  Yet another place where VAJ isn't fully
compliant with the Sun APIs...

Thanks again for the help Carsten!

Mark


At 12:50 PM 11/27/2001 -0500, you wrote:
I've run into problems with images showing on JSPs in the past as well,
and
I found that using request.getContextPath() solves the problem to give you
an absolute path within the context.

example:
img
src='%=request.getContextPath()%/graphics/flags/german_flag.gif'//a/
tr


Hope that helps!

Carsten

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 12:36 PM
To: Tomcat Users List
Subject: Re: .gif images not displaying with JSPs


Can you display images from a JSP?  My straight html pages display images
with no problems using Tomcat.  What's odd is if I take the html source
generated by the JSP (ie, 'view source from the browser'), save it as an
html file and re-display it, it's fine.  So the html generated by the JSP
seems ok - it's only when it's being pushed to the browser from the JSP
servlet where the images don't display.

I don't understand odd classloader error messages that refer to the
images.
 Since the servlet .java/.class are being dealt with in the ../work
directory, could this have something to do with it?

Frustration mounting again...

Mark


At 08:27 AM 11/27/2001 -0800, you wrote:
I have a directory called graphics on the same level as WEB-INF, i.e.
root_directory/webapps/myapp/graphics/flags/ and
root_directory/webapps/myapp/WEB-INF/, and I use
 img src='graphics/flags/german_flag.gif'//a/tr
without dificulty, if that helps.  This may have to do with my settings
in
server.xml, which is:

 Context path=/myapp
  docBase=webapps/myapp
  debug=0
  reloadable=true 
 /Context

Hope this helps.  Again, inside and outside WEB-INF is a big deal.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, November 27, 2001 5:54 AM
Subject: .gif images not displaying with JSPs


My servlet/JSP/JavaBean app is working under TC 4.0.1, except for images
not displaying in JSPs. The various .gifs live in the root context for
the
application, ie. the same directory as the html and JSP files.  The JSP
has
simple embedded html statements such as:

aimg src=image1.gif align=left/a

For each img tag, the application log has an associated set of errors:

   2001-11-27 08:24:34
StandardWrapper[/myapp:org.apache.catalina.INVOKER.image1.gif]:
   Marking servlet org.apache.catalina.INVOKER.image1.gif as unavailable
   2001-11-27 08:24:34 invoker: Cannot allocate servlet instance for
path
   /myapp/servlet/image1.gif
   javax.servlet.ServletException: Wrapper cannot find servlet class
image1.gif or a
   class it depends on
   ...

   - Root Cause -
   java.lang.ClassNotFoundException: image1.gif

The generated Java code (in ../work directory) looks like the following:

out.write(  \r\n\r\naimg src=\image1.gif\
align=\left\/a\r\na
  img src=\image2.gif\ align=\left\/a\r\n);


The page displays except for the images, and the resulting html pushed
to
the browser has the img tags. The JSPs work under other environments
(eg.
VAJ, Sun SDK, etc). What am I doing wrong this time under Tomcat?

Thanks
Mark











--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: TC 4.0 newbie - servlet app won't run

2001-11-26 Thread Micael Padraig Og mac Grene

Just a preemptive question, Mark.  Is your servlet's class object really
called myservlet.class rather than, say, MyServlet.class?


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 7:00 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


Thanks for your reply Scott, and thanks to your and Micael's responses I
_believe_ I understand the relationship between the servlet naming/mapping
and the associated html.  As Micael noted, one could put pudding in the
url-pattern as long as the html was setup as ACTION=pudding.  But... how
do the example servlets work when they don't seem to have any servlet
mapping in the ..\examples\WEB-INF\web.xml?

Even after all the advice, I *STILL* can't get my app to run - I still get
a 404 error on the servlet. This seems like such a simple issue but I can
NOT get past it.  I've even gone as far as downloading Tomcat 3.3, with the
same result. Again, I know Tomcat is parsing my web.xml, because if I
intentionally make a typo, the parser complains when Tomcat is started.

To recap where I am:

(a)  I have myservlet.class in the
$CATALINA_HOME\webapps\myapp\WEB-INF\classes
 directory.  The servlet has no associated package.
(b)  The html is FORM ACTION=/servlet/myservlet method=POST
(c)  My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows:

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app
 servlet
 servlet-namemyservlet/servlet-name
 servlet-classmyservlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namemyservlet/servlet-name
 url-pattern/servlet/myservlet/url-pattern
 /servlet-mapping
 /web-app


Am I still missing something?  This is driving me berserk...

TIA. Mark.



At 12:22 AM 11/22/2001 -0500, you wrote:
Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/servlet/myservlet/url-pattern
   /servlet-mapping

which would have a coresponding form tag of

FORM ACTION=/servlet/myservlet method=POST


~Scott

Mark wrote:

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute my
JSPs, but a POST to a servlet does not work (this app has run under Forte
and VA Java in the past).   I get a 404 error with the requested
resource
(/myservlet) is not available. Since the examples work, I have to assume
it's something in my configuration. Any help figuring out why the servlet
won't run would be *greatly* appreciated.  I suspect it's something
simple/braindead on my part.


o  My directory structure for the app:
   TomcatHome
|
+--webapps
  |
  +--myapp\.jsp, .html .gif
 |
 +--WEB-INF\web.xml
   |
   +--classes\.class files


o  My html POST stmt. I've tried various path prefixes to myservlet, eg

   classes/myservlet.  As with the Tomcat examples, this servlet has no
   package:

FORM ACTION=/myservlet method=POST


o  My web.xml - I know Tomcat's seeing/parsing this because if I
deliberately
   make a typo I get an error upon startup:

 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
   PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
   http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
   !-- Define servlets that are included in the application --
   servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet
   servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping
/web-app


o  Update to server.xml

   Context path=/myapp docBase=myapp debug=0
   Logger className=org.apache.catalina.logger.FileLogger
   prefix=myapp_log. suffix=.txt
   timestamp=true/
   /Context








--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles 

Re: TC 4.0 newbie - servlet app won't run

2001-11-26 Thread Micael Padraig Og mac Grene

Okay, Mark, Part II, I want to make sure we are communicating properly
before going further.  No sense wasting time.  Your note is not correct
about at least somethings -- for example (no pun intended):

The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings.  So, I
am not sure what you are looking at.  The servlet SnoopServlet has the
mappings to the patterns /snoop and *.snp under the name snoop.  The
servlet servletToJsp which has the same name, i.e. servletToJsp, has a
mapping to the pattern /servletToJsp.

Micael


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 7:00 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


Thanks for your reply Scott, and thanks to your and Micael's responses I
_believe_ I understand the relationship between the servlet naming/mapping
and the associated html.  As Micael noted, one could put pudding in the
url-pattern as long as the html was setup as ACTION=pudding.  But... how
do the example servlets work when they don't seem to have any servlet
mapping in the ..\examples\WEB-INF\web.xml?

Even after all the advice, I *STILL* can't get my app to run - I still get
a 404 error on the servlet. This seems like such a simple issue but I can
NOT get past it.  I've even gone as far as downloading Tomcat 3.3, with the
same result. Again, I know Tomcat is parsing my web.xml, because if I
intentionally make a typo, the parser complains when Tomcat is started.

To recap where I am:

(a)  I have myservlet.class in the
$CATALINA_HOME\webapps\myapp\WEB-INF\classes
 directory.  The servlet has no associated package.
(b)  The html is FORM ACTION=/servlet/myservlet method=POST
(c)  My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows:

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app
 servlet
 servlet-namemyservlet/servlet-name
 servlet-classmyservlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namemyservlet/servlet-name
 url-pattern/servlet/myservlet/url-pattern
 /servlet-mapping
 /web-app


Am I still missing something?  This is driving me berserk...

TIA. Mark.



At 12:22 AM 11/22/2001 -0500, you wrote:
Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/servlet/myservlet/url-pattern
   /servlet-mapping

which would have a coresponding form tag of

FORM ACTION=/servlet/myservlet method=POST


~Scott

Mark wrote:

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute my
JSPs, but a POST to a servlet does not work (this app has run under Forte
and VA Java in the past).   I get a 404 error with the requested
resource
(/myservlet) is not available. Since the examples work, I have to assume
it's something in my configuration. Any help figuring out why the servlet
won't run would be *greatly* appreciated.  I suspect it's something
simple/braindead on my part.


o  My directory structure for the app:
   TomcatHome
|
+--webapps
  |
  +--myapp\.jsp, .html .gif
 |
 +--WEB-INF\web.xml
   |
   +--classes\.class files


o  My html POST stmt. I've tried various path prefixes to myservlet, eg

   classes/myservlet.  As with the Tomcat examples, this servlet has no
   package:

FORM ACTION=/myservlet method=POST


o  My web.xml - I know Tomcat's seeing/parsing this because if I
deliberately
   make a typo I get an error upon startup:

 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
   PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
   http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
   !-- Define servlets that are included in the application --
   servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet
   servlet-mapping
   servlet-namemyservlet/servlet-name
  

Re: TC 4.0 newbie - servlet app won't run

2001-11-26 Thread Micael Padraig Og mac Grene

Okay, Mark, Part III, another question:

If you don't put your servlet called myservlet in a package called
myservlet as well, why do you use that odd pattern?  The pattern looks
like you want to use servlet as a package name?  I am starting to think
that you have some left-over confusion from the old days about referencing
servlets in a package called servletor something?

Micael
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 7:00 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


Thanks for your reply Scott, and thanks to your and Micael's responses I
_believe_ I understand the relationship between the servlet naming/mapping
and the associated html.  As Micael noted, one could put pudding in the
url-pattern as long as the html was setup as ACTION=pudding.  But... how
do the example servlets work when they don't seem to have any servlet
mapping in the ..\examples\WEB-INF\web.xml?

Even after all the advice, I *STILL* can't get my app to run - I still get
a 404 error on the servlet. This seems like such a simple issue but I can
NOT get past it.  I've even gone as far as downloading Tomcat 3.3, with the
same result. Again, I know Tomcat is parsing my web.xml, because if I
intentionally make a typo, the parser complains when Tomcat is started.

To recap where I am:

(a)  I have myservlet.class in the
$CATALINA_HOME\webapps\myapp\WEB-INF\classes
 directory.  The servlet has no associated package.
(b)  The html is FORM ACTION=/servlet/myservlet method=POST
(c)  My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows:

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app
 servlet
 servlet-namemyservlet/servlet-name
 servlet-classmyservlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namemyservlet/servlet-name
 url-pattern/servlet/myservlet/url-pattern
 /servlet-mapping
 /web-app


Am I still missing something?  This is driving me berserk...

TIA. Mark.



At 12:22 AM 11/22/2001 -0500, you wrote:
Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/servlet/myservlet/url-pattern
   /servlet-mapping

which would have a coresponding form tag of

FORM ACTION=/servlet/myservlet method=POST


~Scott

Mark wrote:

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute my
JSPs, but a POST to a servlet does not work (this app has run under Forte
and VA Java in the past).   I get a 404 error with the requested
resource
(/myservlet) is not available. Since the examples work, I have to assume
it's something in my configuration. Any help figuring out why the servlet
won't run would be *greatly* appreciated.  I suspect it's something
simple/braindead on my part.


o  My directory structure for the app:
   TomcatHome
|
+--webapps
  |
  +--myapp\.jsp, .html .gif
 |
 +--WEB-INF\web.xml
   |
   +--classes\.class files


o  My html POST stmt. I've tried various path prefixes to myservlet, eg

   classes/myservlet.  As with the Tomcat examples, this servlet has no
   package:

FORM ACTION=/myservlet method=POST


o  My web.xml - I know Tomcat's seeing/parsing this because if I
deliberately
   make a typo I get an error upon startup:

 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
   PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
   http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
   !-- Define servlets that are included in the application --
   servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet
   servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping
/web-app


o  Update to server.xml

   Context path=/myapp docBase=myapp debug=0
   

Re: TC 4.0 newbie - servlet app won't run (correction)

2001-11-26 Thread Micael Padraig Og mac Grene

I will reply, Mark, in bits and drabs, as I try to figure out what you are
missing and what you may have wrong.  First, the servlets I referred to are
not any different as servlets.  They are not compiled JSP pages.  The are
regular old servlets.  Compiled JSP page servlets are kept in tomcat/work/.
Micael
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 10:15 AM
Subject: Re: TC 4.0 newbie - servlet app won't run (correction)


Correction, using POST results in a 405-Resource not allowed due to the
HelloWorldExample servlet not implementing doPost().  Others do and work
fine with POST. My apologies.


At 01:02 PM 11/26/2001 -0500, you wrote:
The examples you mentioned are the JSPs examples. I realize JSPs compile
to
servlets, but what about the straight up HelloWorldExample servlet?  I
didn't see mapping for that or the other servlet (vs. JSP) examples in the
web.xml.  Being a newbie, I could very well be missing something so please
bear with me (again).

BTW - I've fiddled with the example servlet index.html to use FORM vs.
href=../servlet/abc method of running servlets.  POST always results in
a
404.  GET does however work.

Example:

   FORM ACTION=../servlet/HelloWorldExample method=POST  - doen't
work
   FORM ACTION=../servlet/HelloWorldExample method=GET   - works.

Mark



At 09:30 AM 11/26/2001 -0800, you wrote:
Okay, Mark, Part II, I want to make sure we are communicating properly
before going further.  No sense wasting time.  Your note is not correct
about at least somethings -- for example (no pun intended):

The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings.  So,
I
am not sure what you are looking at.  The servlet SnoopServlet has the
mappings to the patterns /snoop and *.snp under the name snoop.  The
servlet servletToJsp which has the same name, i.e. servletToJsp, has a
mapping to the pattern /servletToJsp.

Micael


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 7:00 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


Thanks for your reply Scott, and thanks to your and Micael's responses I
_believe_ I understand the relationship between the servlet
naming/mapping
and the associated html.  As Micael noted, one could put pudding in
the
url-pattern as long as the html was setup as ACTION=pudding.  But...
how
do the example servlets work when they don't seem to have any servlet
mapping in the ..\examples\WEB-INF\web.xml?

Even after all the advice, I *STILL* can't get my app to run - I still
get
a 404 error on the servlet. This seems like such a simple issue but I
can
NOT get past it.  I've even gone as far as downloading Tomcat 3.3, with
the
same result. Again, I know Tomcat is parsing my web.xml, because if I
intentionally make a typo, the parser complains when Tomcat is started.

To recap where I am:

(a)  I have myservlet.class in the
$CATALINA_HOME\webapps\myapp\WEB-INF\classes
 directory.  The servlet has no associated package.
(b)  The html is FORM ACTION=/servlet/myservlet method=POST
(c)  My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows:

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app
 servlet
 servlet-namemyservlet/servlet-name
 servlet-classmyservlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namemyservlet/servlet-name
 url-pattern/servlet/myservlet/url-pattern
 /servlet-mapping
 /web-app


Am I still missing something?  This is driving me berserk...

TIA. Mark.



At 12:22 AM 11/22/2001 -0500, you wrote:
Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/servlet/myservlet/url-pattern
   /servlet-mapping

which would have a coresponding form tag of

FORM ACTION=/servlet/myservlet method=POST


~Scott

Mark wrote:

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run
the
example servlets, but not my own.  My html displays and I can execute
my
JSPs, but a POST to a 

Re: TC 4.0 newbie - servlet app won't run (correction)

2001-11-26 Thread Micael Padraig Og mac Grene

I have not looked at the webapps/examples except incidentally, Mark, so I am
not sure how the HelloWorldExample servlet is accessed.  How you access a
servlet and where the servlet is are very important in these contexts.
Inside and outside WEB-INF are very different, for example.  Inside WEB-INF
is dark to the outside world and must be accessed differently than outside
WEB-INF.  There must, as it were, be a portal.  I still have not received
answers from my last questions, which I need to go forward in my attempt to
see what you may be doing.  Certain answers to those questions could resolve
everything.  Micael
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 10:15 AM
Subject: Re: TC 4.0 newbie - servlet app won't run (correction)


Correction, using POST results in a 405-Resource not allowed due to the
HelloWorldExample servlet not implementing doPost().  Others do and work
fine with POST. My apologies.


At 01:02 PM 11/26/2001 -0500, you wrote:
The examples you mentioned are the JSPs examples. I realize JSPs compile
to
servlets, but what about the straight up HelloWorldExample servlet?  I
didn't see mapping for that or the other servlet (vs. JSP) examples in the
web.xml.  Being a newbie, I could very well be missing something so please
bear with me (again).

BTW - I've fiddled with the example servlet index.html to use FORM vs.
href=../servlet/abc method of running servlets.  POST always results in
a
404.  GET does however work.

Example:

   FORM ACTION=../servlet/HelloWorldExample method=POST  - doen't
work
   FORM ACTION=../servlet/HelloWorldExample method=GET   - works.

Mark



At 09:30 AM 11/26/2001 -0800, you wrote:
Okay, Mark, Part II, I want to make sure we are communicating properly
before going further.  No sense wasting time.  Your note is not correct
about at least somethings -- for example (no pun intended):

The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings.  So,
I
am not sure what you are looking at.  The servlet SnoopServlet has the
mappings to the patterns /snoop and *.snp under the name snoop.  The
servlet servletToJsp which has the same name, i.e. servletToJsp, has a
mapping to the pattern /servletToJsp.

Micael


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 7:00 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


Thanks for your reply Scott, and thanks to your and Micael's responses I
_believe_ I understand the relationship between the servlet
naming/mapping
and the associated html.  As Micael noted, one could put pudding in
the
url-pattern as long as the html was setup as ACTION=pudding.  But...
how
do the example servlets work when they don't seem to have any servlet
mapping in the ..\examples\WEB-INF\web.xml?

Even after all the advice, I *STILL* can't get my app to run - I still
get
a 404 error on the servlet. This seems like such a simple issue but I
can
NOT get past it.  I've even gone as far as downloading Tomcat 3.3, with
the
same result. Again, I know Tomcat is parsing my web.xml, because if I
intentionally make a typo, the parser complains when Tomcat is started.

To recap where I am:

(a)  I have myservlet.class in the
$CATALINA_HOME\webapps\myapp\WEB-INF\classes
 directory.  The servlet has no associated package.
(b)  The html is FORM ACTION=/servlet/myservlet method=POST
(c)  My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows:

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app
 servlet
 servlet-namemyservlet/servlet-name
 servlet-classmyservlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namemyservlet/servlet-name
 url-pattern/servlet/myservlet/url-pattern
 /servlet-mapping
 /web-app


Am I still missing something?  This is driving me berserk...

TIA. Mark.



At 12:22 AM 11/22/2001 -0500, you wrote:
Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   

Re: TC 4.0 newbie - servlet app won't run (correction)

2001-11-26 Thread Micael Padraig Og mac Grene

Mark.  I personally work on my sites at a distance, so I am presently ftping
the webapps/examples to have a look at them.  Micael
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 10:15 AM
Subject: Re: TC 4.0 newbie - servlet app won't run (correction)


Correction, using POST results in a 405-Resource not allowed due to the
HelloWorldExample servlet not implementing doPost().  Others do and work
fine with POST. My apologies.


At 01:02 PM 11/26/2001 -0500, you wrote:
The examples you mentioned are the JSPs examples. I realize JSPs compile
to
servlets, but what about the straight up HelloWorldExample servlet?  I
didn't see mapping for that or the other servlet (vs. JSP) examples in the
web.xml.  Being a newbie, I could very well be missing something so please
bear with me (again).

BTW - I've fiddled with the example servlet index.html to use FORM vs.
href=../servlet/abc method of running servlets.  POST always results in
a
404.  GET does however work.

Example:

   FORM ACTION=../servlet/HelloWorldExample method=POST  - doen't
work
   FORM ACTION=../servlet/HelloWorldExample method=GET   - works.

Mark



At 09:30 AM 11/26/2001 -0800, you wrote:
Okay, Mark, Part II, I want to make sure we are communicating properly
before going further.  No sense wasting time.  Your note is not correct
about at least somethings -- for example (no pun intended):

The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings.  So,
I
am not sure what you are looking at.  The servlet SnoopServlet has the
mappings to the patterns /snoop and *.snp under the name snoop.  The
servlet servletToJsp which has the same name, i.e. servletToJsp, has a
mapping to the pattern /servletToJsp.

Micael


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 7:00 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


Thanks for your reply Scott, and thanks to your and Micael's responses I
_believe_ I understand the relationship between the servlet
naming/mapping
and the associated html.  As Micael noted, one could put pudding in
the
url-pattern as long as the html was setup as ACTION=pudding.  But...
how
do the example servlets work when they don't seem to have any servlet
mapping in the ..\examples\WEB-INF\web.xml?

Even after all the advice, I *STILL* can't get my app to run - I still
get
a 404 error on the servlet. This seems like such a simple issue but I
can
NOT get past it.  I've even gone as far as downloading Tomcat 3.3, with
the
same result. Again, I know Tomcat is parsing my web.xml, because if I
intentionally make a typo, the parser complains when Tomcat is started.

To recap where I am:

(a)  I have myservlet.class in the
$CATALINA_HOME\webapps\myapp\WEB-INF\classes
 directory.  The servlet has no associated package.
(b)  The html is FORM ACTION=/servlet/myservlet method=POST
(c)  My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows:

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app
 servlet
 servlet-namemyservlet/servlet-name
 servlet-classmyservlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namemyservlet/servlet-name
 url-pattern/servlet/myservlet/url-pattern
 /servlet-mapping
 /web-app


Am I still missing something?  This is driving me berserk...

TIA. Mark.



At 12:22 AM 11/22/2001 -0500, you wrote:
Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/servlet/myservlet/url-pattern
   /servlet-mapping

which would have a coresponding form tag of

FORM ACTION=/servlet/myservlet method=POST


~Scott

Mark wrote:

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run
the
example servlets, but not my own.  My html displays and I can execute
my
JSPs, but a POST to a servlet does not work (this app has run under
Forte
and VA Java in the past).   I get a 404 error with the requested
resource
(/myservlet) is not available. Since the examples work, 

Re: TC 4.0 newbie - servlet app won't run

2001-11-26 Thread Micael Padraig Og mac Grene

Mark, I don't have webapps/examples running, so I need to ask you another
question.  Is there a class file called HelloWorldExample.class in
examples/servlets/?, i.e. examples/servlets/HelloWorldExample.class.  From
what I can tell about your remarks, there should be.

I notice that the only reference to any HelloWorldExample.class in the whole
example app is in that file.  If there is a way to get to the file without a
file where the reference is, I don't know how that would happen.

Micael
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 9:58 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


The examples you mentioned are the JSPs examples. I realize JSPs compile to
servlets, but what about the straight up HelloWorldExample servlet?  I
didn't see mapping for that or the other servlet (vs. JSP) examples in the
web.xml.  Being a newbie, I could very well be missing something so please
bear with me (again).

BTW - I've fiddled with the example servlet index.html to use FORM vs.
href=../servlet/abc method of running servlets.  POST always results in a
404.  GET does however work.

Example:

   FORM ACTION=../servlet/HelloWorldExample method=POST  - doen't
work
   FORM ACTION=../servlet/HelloWorldExample method=GET   - works.

Mark



At 09:30 AM 11/26/2001 -0800, you wrote:
Okay, Mark, Part II, I want to make sure we are communicating properly
before going further.  No sense wasting time.  Your note is not correct
about at least somethings -- for example (no pun intended):

The web.xml for examples/WEB-INF/web.xml DOES have servlet mappings.  So,
I
am not sure what you are looking at.  The servlet SnoopServlet has the
mappings to the patterns /snoop and *.snp under the name snoop.  The
servlet servletToJsp which has the same name, i.e. servletToJsp, has a
mapping to the pattern /servletToJsp.

Micael


-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 7:00 AM
Subject: Re: TC 4.0 newbie - servlet app won't run


Thanks for your reply Scott, and thanks to your and Micael's responses I
_believe_ I understand the relationship between the servlet
naming/mapping
and the associated html.  As Micael noted, one could put pudding in the
url-pattern as long as the html was setup as ACTION=pudding.  But...
how
do the example servlets work when they don't seem to have any servlet
mapping in the ..\examples\WEB-INF\web.xml?

Even after all the advice, I *STILL* can't get my app to run - I still
get
a 404 error on the servlet. This seems like such a simple issue but I can
NOT get past it.  I've even gone as far as downloading Tomcat 3.3, with
the
same result. Again, I know Tomcat is parsing my web.xml, because if I
intentionally make a typo, the parser complains when Tomcat is started.

To recap where I am:

(a)  I have myservlet.class in the
$CATALINA_HOME\webapps\myapp\WEB-INF\classes
 directory.  The servlet has no associated package.
(b)  The html is FORM ACTION=/servlet/myservlet method=POST
(c)  My $CATALINA_HOME\webapps\myapp\WEB-INF\web.xml is as follows:

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd

 web-app
 servlet
 servlet-namemyservlet/servlet-name
 servlet-classmyservlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namemyservlet/servlet-name
 url-pattern/servlet/myservlet/url-pattern
 /servlet-mapping
 /web-app


Am I still missing something?  This is driving me berserk...

TIA. Mark.



At 12:22 AM 11/22/2001 -0500, you wrote:
Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/servlet/myservlet/url-pattern
   /servlet-mapping

which would have a coresponding form tag of

FORM ACTION=/servlet/myservlet method=POST


~Scott

Mark wrote:

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute
my
JSPs, but a POST to a servlet does not work (this app has run under

Re: TC 4.0 newbie - servlet app won't run

2001-11-26 Thread Micael Padraig Og mac Grene

Mark, regarding accessing servlets, I will give a few general remarks that
may or may not be helpful.  I would appreciate knowing either way.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Monday, November 26, 2001 9:58 AM
Subject: Re: TC 4.0 newbie - servlet app won't run



First, there is more than one way to not only skin a cat but also to access
a servlet.  Let's look at a non-web.xml way.

A.We can do it via URL by prepending the servlet's class name with
/servlet/.  Thus, we can access it as typically noted by
http://localhost:8080/servlet/HelloWorld
B.If the servlet if part of a package, then
http://[serverroot]:8080/servlet/package.name.HelloWorld, where the servlet
is put into server_root/webapps/yourapp/WEB-INF/classes/package/name


Note that we have NOT MENTIONED THE web.xml.  Okay?

I think you are probably actually putting in the servlet reference as a
directory or something.  Are you?  Are you including classes as part of a
package name?  Something like that must be going on.  The directory classes
is not part of the classpath.  I assume you know that.

I keep wondering why you are continuing to use /servlet/ in your web.xml
with /servlet/myservlet.  It makes me think you might be doing something
like actually constructing a servlet directory or something.




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: TC 4.0 newbie - servlet app runs now!!

2001-11-26 Thread Micael Padraig Og mac Grene

Mark wrote:

For example, now that I *finally* got my app to work using servlet mapping,
I also found if I leave all mapping out of web.xml and have FORM
ACTION=servlet/myservlet METHOD=POST, Tomcat will still find/run the
servlet under ..WEB-INF/classes.  Is that by design?

Mark,

Congradulations, nice when things work well,

I will say a few things that you can get from an excellent book Java Servlet
Programming by Jason Hunter and William Crawford (O'Reilly).

First, do not assume, because you will be wrong, that / is required in the
mapping pattern.  You are using a particular kind of mapping.

Second, in answer to your question, indeed it is.  I hope my last little
note made that clearer.  I like to keep my applications essentially dark to
the outside world except in very controlled ways, so I put everything inside
WEB-INF except my index.jsp and make all servlets accessible through clever,
;-) , patterns used in servlet mappings.   I use a Model 2 multi-tier
architecture and run EVERYTHING first through a controller servlet that
monitors all outside access.

A general point about web.xml and servlet tags.  Servlets that you want to
be registered with the server and receive special treatment get that through
the web.xml.  That is what the servlet tags are for.  Only one example of
such treatments is that we can set up URL patterns that will invoke the
registered servlet.  There are lots of good reasons for doing this.  For
example, you could use this to have a servlet preplace an existing JSP page
at any given URL, so all bookmarks and links to the page continue to work.
Kewl, eh?  I like to use it to hide things and to thereby enhance security.
You can have your servlets invoked by dinky.html, if you like.

Mappings have varieties:

1.Explicit Mappings

 /whatever

These contain no wildcards.  This is useful when replacing an
existing page.

2.Path Prefix Mappings

/something/database/*

These maps always begint with a / and end with a /*.  This
allows a servlet to control an entire virtual hierarchy like a database app.

3.Extension Mappings

*.wm or *.jsp

These begin with * and handle all requests ending with the
subsequent prefix.  David Geary uses this in his app provided in the 12th
chapter of his new book on taglibs in order to make sure all urls ending in
.do go to his controller ActionServlet of a Model 2 architecture.

4.Default Mapping

/

This provides the servlet to be used if no other servlet
matches.  You could get the same sort of behavior by /* but this has the
advantage of coming after extension mappings are done.

If there are collisions, the precedence is the order indicated above.

Okay, last thing.  With Tomcat server, server_root/webapps/ROOT is the
default context mapped to the root path /.  THIS IS IMPORTANT.  ;-)  This
means that servlets placed under the servlets placed under the
server_root/webapps/ROOT/WEB-INF/classes can be accessed using the path
/servlet/HelloWorldExample.  HOWEVER, this default context mapping can be
changed and new mappings can be added by editing the
server_root/conf/server.xml serverwide configuration file.  Other servers
handle this differently.  Okay dokay?





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: TC 4.0 newbie - servlet app won't run

2001-11-21 Thread Micael Padraig Og mac Grene

Your pattern does not occur in your post.  So, the pattern will not send the
post to the servlet.  If you make your post anything and make your pattern
anything, that will work.  Get my drift?  The post is just some text that
should match the pattern and that will then refer the app to your servlet.
-Original Message-
From: Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Wednesday, November 21, 2001 12:39 PM
Subject: TC 4.0 newbie - servlet app won't run


I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute my
JSPs, but a POST to a servlet does not work (this app has run under Forte
and VA Java in the past).   I get a 404 error with the requested resource
(/myservlet) is not available. Since the examples work, I have to assume
it's something in my configuration. Any help figuring out why the servlet
won't run would be *greatly* appreciated.  I suspect it's something
simple/braindead on my part.


o  My directory structure for the app:
   TomcatHome
|
+--webapps
  |
  +--myapp\.jsp, .html .gif
 |
 +--WEB-INF\web.xml
   |
   +--classes\.class files


o  My html POST stmt. I've tried various path prefixes to myservlet, eg
   classes/myservlet.  As with the Tomcat examples, this servlet has no
   package:

FORM ACTION=/myservlet method=POST


o  My web.xml - I know Tomcat's seeing/parsing this because if I
deliberately
   make a typo I get an error upon startup:

 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
   PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
   http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
   !-- Define servlets that are included in the application --
   servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet
   servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping
/web-app


o  Update to server.xml

   Context path=/myapp docBase=myapp debug=0
   Logger className=org.apache.catalina.logger.FileLogger
   prefix=myapp_log. suffix=.txt
   timestamp=true/
   /Context








--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: TC 4.0 newbie - servlet app won't run

2001-11-21 Thread Micael Padraig Og mac Grene

Mark,

Scott is right, of course, but there is no reason to use a url when in fact
you are just using a tag or a name.  It is misleading, in my opinion.  In
Scott's code, substituting form action=pudding method=post for form
action=/servlet/servlet method=post works just as well as long as you
use url-servletpudding/url-servlet instead of
url-pattern/servlet/servlet/url-pattern.  This is not an incidental
matter.  The latter for gives the mistaken impression that the semantics of
url-pattern has something to do with urls, classpath, etc, which it does
not.  Once you free yourself of the meaningless references to urls in
url-pattern you can begin to use it for passing code, keys for the
controller servlet, etc.  As long as you stick with url-look-alikes, you
have misleading code.  Typically, a Tomcat Model 2 Architecture uses this
possible way of employing and passing free semantics to the controller.  The
issue, in my opinion, is not a trivial matter in Model 2 design patterns.




-Original Message-
From: Scott Ahten [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Wednesday, November 21, 2001 9:20 PM
Subject: Re: TC 4.0 newbie - servlet app won't runThi


Mark,

The servlet tag is used to assign a name to a particular servlet class
file.

 servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet

This would attempt to assign the name 'myservlet' to the class
'myservlet.class.'

The servlet-mapping tag defines the pattern or 'location' of a named
servlet from the root of your context. This means that 

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping

if this were the ROOT context, this would map your servlet at /classes
and your form action would need to be defined as

FORM ACTION=/classes method=POST

A more common mapping for servlets is

servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/servlet/myservlet/url-pattern
   /servlet-mapping

which would have a coresponding form tag of

FORM ACTION=/servlet/myservlet method=POST


~Scott

Mark wrote:

I installed Tomcat 4.0.1 under Win 2k using JDK 1.3 and able to run the
example servlets, but not my own.  My html displays and I can execute my
JSPs, but a POST to a servlet does not work (this app has run under Forte
and VA Java in the past).   I get a 404 error with the requested resource
(/myservlet) is not available. Since the examples work, I have to assume
it's something in my configuration. Any help figuring out why the servlet
won't run would be *greatly* appreciated.  I suspect it's something
simple/braindead on my part.


o  My directory structure for the app:
   TomcatHome
|
+--webapps
  |
  +--myapp\.jsp, .html .gif
 |
 +--WEB-INF\web.xml
   |
   +--classes\.class files


o  My html POST stmt. I've tried various path prefixes to myservlet, eg
   classes/myservlet.  As with the Tomcat examples, this servlet has no
   package:

FORM ACTION=/myservlet method=POST


o  My web.xml - I know Tomcat's seeing/parsing this because if I
deliberately
   make a typo I get an error upon startup:

 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
   PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
   http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
   !-- Define servlets that are included in the application --
   servlet
   servlet-namemyservlet/servlet-name
   servlet-classmyservlet/servlet-class
   /servlet
   servlet-mapping
   servlet-namemyservlet/servlet-name
   url-pattern/classes/url-pattern
   /servlet-mapping
/web-app


o  Update to server.xml

   Context path=/myapp docBase=myapp debug=0
   Logger className=org.apache.catalina.logger.FileLogger
   prefix=myapp_log. suffix=.txt
   timestamp=true/
   /Context








--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]









--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Java and double

2001-11-14 Thread Micael Padraig Og mac Grene

Not sure what your point is.  The code is okay, check out the internal
math yourself.  You can do it by hand.  If you want more precision, use
different code.

-Original Message-
From: Mangi, Rick [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Date: Wednesday, November 14, 2001 8:44 AM
Subject: RE: Java and double


Ya, I've seen that one before. use the java.math package.

-Original Message-
From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:39 AM
To: [EMAIL PROTECTED]
Subject: Java and double


Hi,

Excuse me... this mail shouldnot be on this mailing list but
it is an hurry.

public class TestDouble
{
  static public void main(String args[]) {

double val = 0.5055 * 1000 ;
System.out.println( val );
  }
}

This program gives me the following results :
505.44

I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.

Have u got informations about this ?
Can u try too ?

Thanks a lot and sorry again

Bye

Michenaud Laurent
- Adeuza -
[ Développeur Web - Administrateur Réseau ]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]


This email and any attachments are confidential and may be
legally privileged. No confidentiality or privilege is waived
or lost by any transmission in error.  If you are not the
intended recipient you are hereby notified that any use,
printing, copying or disclosure is strictly prohibited.
Please delete this email and any attachments, without
printing, copying, forwarding or saving them and notify the
sender immediately by reply e-mail.  Zurich Capital Markets
and its affiliates reserve the right to monitor all e-mail
communications through its networks.  Unless otherwise
stated, any pricing information in this e-mail is indicative
only, is subject to change and does not constitute an offer
to enter into any transaction at such price and any terms in
relation to any proposed transaction are indicative only and
subject to express final confirmation.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: MVC in Tomcat is hard

2001-11-03 Thread Micael Padraig Og mac Grene

Lo, Evil.  You can look at Struts, as suggested, or take a look at David
Geary's new book on taglibs, with it's sample app in the last (I think)
chapter.  He has everything you are asking for precoded.  Micael


-Original Message-
From: Dr. Evil [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Saturday, November 03, 2001 2:00 AM
Subject: MVC in Tomcat is hard



I'm trying to use the Model-View-Controler design approach in Tomcat.
Here's what I'm trying to do:

I'll put the Model stuff in a servlet.  The View stuff will go into a
jsp page (actually a custom tag lib).  What I need to do is, when I
view a page like foo.jsp, the servlet needs to get invoked to set up
some state, so the tags can then dispaly it.  So, let's say the client
requests

http://host/dir/foo.jsp

I want to have a servlet, let's call it controler.class, be called,
do its stuff, and then get a RequestDispatcher, and then do
rd.forward() to foo.jsp.  This doesn't seem to be possible.  Is there
a way to do this?

Thanks

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Form authentication/ password changing

2001-11-01 Thread Micael Padraig Og mac Grene

Are you experiencing the same thing?
-Original Message-
From: Timothy Fisher [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Date: Thursday, November 01, 2001 12:47 PM
Subject: Re: Form authentication/ password changing


Craig,

I agree with all of your comments.  From the tomcat
access perspective, your correct, flat file vs. DB
storage of users/passwords may be roughly equivalent
in terms of how secure that is.

But, if you ignore tomcat, and just consider the
usernames and passwords sitting out there, I would
argue that they are more vulnerable sitting in a flat
file than in a database.  But Im sure this could be
debated on an on...

Tim

--- Craig R. McClanahan [EMAIL PROTECTED] wrote:
 
 
 On Thu, 1 Nov 2001, Timothy Fisher wrote:
 
  Date: Thu, 1 Nov 2001 12:08:18 -0800 (PST)
  From: Timothy Fisher [EMAIL PROTECTED]
  Reply-To: Tomcat Users List
 [EMAIL PROTECTED]
  To: Tomcat Users List
 [EMAIL PROTECTED]
  Subject: Re: Form authentication/ password
 changing
 
  There is a sample tomcat-users.xml included with
  tomcat 4.0 in the conf directory.  Just follow
 this
  format.  Yes, the file must be in this format,
 unless
  you write your own connector.
 
 
 Yep.
 
  The server containing the tomcat-users file
 definitely
  must be protected.  Yes, this is less secure than
  storing the users/passwords in a
 directory/database.
 
 
 It's hard to talk about more secure or less
 secure unless we define
 how you measure this :-).  However, I would suggest
 that this is not
 necessarily true.
 
 First, under all circumstances, you should run
 Tomcat under a username
 other than root.  That username must (obviously)
 have read access to the
 files in the conf directory.  But, *no* other
 users on the server should
 be able to read those files.  This allows you to
 leverage your operating
 system's standard protection for files.
 
 Second, let's assume that we put the users in a
 database instead, and
 configure JDBCRealm to have Tomcat talk to it.  If
 you examine the
 configuration parameters you have to set up in
 conf/server.xml, you will
 note that you have to specify the database username
 and password -- so you
 are *still* depending on limiting access to the
 configuration files, even
 if you take this approach.  That doesn't sound more
 secure to me.
 
 (An approach that would qualify as more secure
 would be to challenge the
 system administrator for a password when Tomcat is
 started up.  Some
 progress towards building such stuff has taken place
 with regards to the
 keystore files used for SSL certificates, but not
 yet for database
 passwords.  And, you have to balance the security
 with the extra hassle
 that you cannot script a startup of Tomcat without
 having someone around
 to answer the password prompt.)
 
  Tim
 
 
 Craig
 
 
 --
 To unsubscribe:  
 mailto:[EMAIL PROTECTED]
 For additional commands:
 mailto:[EMAIL PROTECTED]
 Troubles with the list:
 mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Can't happen - classname is null, who added this ?

2001-11-01 Thread Micael Padraig Og mac Grene

Usually happens when you add something to a web container run in conjunction
with a JBoss application server without bouncing JBoss.  Did you do that?


-Original Message-
From: Voon, Wendy [EMAIL PROTECTED]
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
Date: Thursday, November 01, 2001 9:58 PM
Subject: Can't happen - classname is null, who added this ?


Hi,

I am running TC 3.2.3

I am getting a weird error, does anyone know what this means?

Internal Servlet Error:
java.lang.IllegalStateException: Can't happen - classname is null, who
added
this ?

Cheers in advance,
Wendy Voon
Consultant
Black Diamond
T e c h n o l o g i e s
Level 1, 6 Riverside Quay,
Southbank, Victoria, 3006.
E-mail: [EMAIL PROTECTED]
Telephone: (03) 9698 - 7600
Facsimile: (03) 9698 - 7666
Web: http://www.bdt.com.au/

---INTERNET E-MAIL CONFIDENTIALITY/DISCLAIMER

Privileged and confidential information may be contained in this e-mail.
If
you are not the intended recipient of this communication please delete and
destroy all copies and kindly notify the sender by return e-mail.
Recipients of this e-mail must not use, disclose or forward any information
or attachments without express permission from Black Diamond Technologies.

Any views expressed in this communication are those of the individual
sender
except where the sender specifically states them to be the views of Black
Diamond Technologies.  Except as required at law, we do not represent
warrant and/or guarantee that the integrity of this communication has been
maintained or that it is free of errors, viruses, interception or
interference.





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Can't happen - classname is null, who added this ?

2001-11-01 Thread Micael Padraig Og mac Grene

And, are you running David Geary's app?  That is a good source for that
under those circumstances.

-Original Message-
From: Voon, Wendy [EMAIL PROTECTED]
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
Date: Thursday, November 01, 2001 9:58 PM
Subject: Can't happen - classname is null, who added this ?


Hi,

I am running TC 3.2.3

I am getting a weird error, does anyone know what this means?

Internal Servlet Error:
java.lang.IllegalStateException: Can't happen - classname is null, who
added
this ?

Cheers in advance,
Wendy Voon
Consultant
Black Diamond
T e c h n o l o g i e s
Level 1, 6 Riverside Quay,
Southbank, Victoria, 3006.
E-mail: [EMAIL PROTECTED]
Telephone: (03) 9698 - 7600
Facsimile: (03) 9698 - 7666
Web: http://www.bdt.com.au/

---INTERNET E-MAIL CONFIDENTIALITY/DISCLAIMER

Privileged and confidential information may be contained in this e-mail.
If
you are not the intended recipient of this communication please delete and
destroy all copies and kindly notify the sender by return e-mail.
Recipients of this e-mail must not use, disclose or forward any information
or attachments without express permission from Black Diamond Technologies.

Any views expressed in this communication are those of the individual
sender
except where the sender specifically states them to be the views of Black
Diamond Technologies.  Except as required at law, we do not represent
warrant and/or guarantee that the integrity of this communication has been
maintained or that it is free of errors, viruses, interception or
interference.





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: getNamedDispatcher

2001-10-26 Thread Micael Padraig Og mac Grene

Try the trusted and true:

 if(isForward) {
ServletContext ctx = servlet.getServletContext();
RequestDispatcher rd =
ctx.getRequestDispatcher(response.encodeURL(url));
rd.forward(request, response);
} else {
response.sendRedirect(res.encodeRedirectURL(url));
 }

-Original Message-
From: Dr. Evil [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Thursday, October 25, 2001 7:01 PM
Subject: getNamedDispatcher



Hi, I am trying to use ServletContext.getNamedDispatcher(String) to get
a RequestDispatcher object in my servlet.  The goal of this is to
allow my controller servlet to hand off request processing to another
servlet.  What I have done is set up a default servlet-mapping in my
web.xml file, so that all requests going to the server will be handled
initially by a controller servlet, which will then decide which
servlet should really handle the request.  It will go through its
logic and then come up with a string, which will be the real servlet
which will handle the request.

I'm trying to use getNamedDispatcher so that I can avoid the loop that
would happen because of the default servlet-mapping.  This seems like
it should work.

In my servlet's init method, I do this:

   this.context = getServletConfig().getServletContext();

This works.  context is not null after this call, so it definitely
gets a context.

However, later when I do:

  RequestDispatcher rd =
  this.context.getNamedDispatcher(/static/index.html);

rd comes back as null, and obviously rd.forward(request, response) is
impossible.

Any sugestions on this?  How do I get a servlet to send something to a
named servlet without going through the servlet-mappings again?

Thanks





Re: More experiments with changing the default (/) mapping

2001-10-26 Thread Micael Padraig Og mac Grene

I think I already sent you the answer.  You have a ControlServlet servlet
which has a BeanServlet servlet do its work processing the request in the
ControlServlet's service(Req, Res) method.  The call to the BeanServlet
returns a RouterServlet.  The RouterServlet has the code I previously sent
you, which can send to Servlet, html, JSP, whatever.

Do you understand?  This is a fairly standard Model 2 architecture problem,
I think, even if you are obviously in WAP.

-Original Message-
From: Dr. Evil [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Friday, October 26, 2001 2:10 AM
Subject: More experiments with changing the default (/) mapping



I have figured out a few things about how servlet-mapping and
RequestDispatcher might work together.

If I put in a servlet-mapping entry for /* (which will catch every
request coming in to the server, which is something which I need to
do), and I make the servlet which handles it look like this:

RequestDispatcher rd = context.getNamedDispatcher(default);
rd.forward(request, response);

then it works for serving plain old static files.  In toher words,
http://localhost/foo/bar.html will get the bar.html from the /foo
directory.

This leaves me with two problems:  First, if I understand correctly,
servlets are not allowed to modify the HttpRequest object.  This means
that my director servlet can't change which director bar.html will be
in.  This is bad for me.

Second, I can't get it to work at all for jsp pages.  I would have
thought that:

RequestDispatcher rd = context.getNamedDispatcher(jsp);
rd.forward(request, response);

would work but it doesn't.  I get an exception with a message
org.apache.jasper.JasperException: No output directory: String index
out of range: -1.  I can't figure out why that is happening or what
to do about it.

So, any sugestions on a) changing the paths default and jsp will
use to get their source pages from and b) how to get jsp to work?

I also thought about doing this with filters, but the problem with
filters is that they can only dispatch to servlets, not to jsp or html
pages, which is what I need to do.  Any sugestions would be most
appreciated.

Thanks





Re: Catching NPE's in JSPs

2001-10-22 Thread Micael Padraig Og mac Grene

To tell you the truth, I don't get all this baloney we hear all the time
about error finding being such a problem with JSP, or Jasper, etc.  I really
have never had a problem with this.  If you spend three months coding before
you test something, I can see the problem.  But, that's silly.  If not, I
have absolutely no problem isolating the problem right away.  Error
reporting is not supposed to replace knowledge of the technology.


-Original Message-
From: Jeff Turner [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, October 22, 2001 7:51 PM
Subject: Re: Catching NPE's in JSPs


I don't know.. 3.2, 3.3 and 4.0 are all uniformly useless at JSP error
reporting, probably because (AFAIK) they use variants of the same JSP
servlet,
Jasper. Anyone know if other JSP engines handle errors better?

Velocity people will rightly claim that this is the fundamental ickyness of
JSP
showing though ;)

http://jakarta.apache.org/velocity/ymtd/ymtd.html


If you're on Unix and have vim installed, the following script might be of
use.

# Takes a filename:lineno string
function tvim()
{
[ -z $1 ]  return
filename=`echo $1 | cut -d: -f 1`
lineno=`echo $1 | cut -d: -f 2`
echo Searching for file $filename, line no $lineno
path=`find $TC_HOME/work -name $filename`
if [ -e $path ]; then
vim $path +$lineno
else
echo Couldn't find file $filename in $TC_HOME/work.
fi
}


When you see an error like:

..
Root cause:
java.lang.NullPointerException
at foo_1._jspService(foo_1.java:59)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)

Go to a terminal and type 'tvim foo_1.java:59'. The script will search for
the
compiled .java file and open up vim at the right line number. Make sure you
quote with 's to escape the $'s that Tomcat 4 uses.


HTH,

--Jeff

On Mon, Oct 22, 2001 at 02:26:48PM -0700, Hunter Hillegas wrote:
 Like a lot of people, sometimes I'll see a JSP error out with an NPE...
In
 this case I have a JSP that pulls some stuff using request.getAttribute()
 and displays the info...

 I'm having a hell of a time finding the current culprit of my NPE... I've
 tried pulling out sections of code and reloading... Still having
trouble...
 Tomcat4 seems to buffer slightly differently where with 3.x the NPE was
 closer to the code that was just output?

 Anyway, wondering if anyone has any insightful methods to track down NPEs
in
 JSPs...

 Hunter





Re: Logging solution is complicated (was Re: Debugging in Tomcat 4)

2001-10-22 Thread Micael Padraig Og mac Grene

Jeesch, Dr. Evil, I gave you a logger that does fancier logging and has no
setup.  You didn't like it?  It also has simpler code in the class.  And, it
does automatic type identification on the fly.  Whatchawant?  ;-)

-Original Message-
From: Dr. Evil [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Saturday, October 20, 2001 4:14 AM
Subject: Logging solution is complicated (was Re: Debugging in Tomcat 4)



Ok, I figured out how to get log4j to work with Tomcat in a
reasonable, although complicated, way:

Download the log4j files, and copy the .jar files into
TOMCAT_HOME/libs, otherwise servlets can't find them.

First, compile a servlet called startlogging.java, in the classes
directory:

--
// start logging functions
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.PropertyConfigurator;

public class startlogging extends HttpServlet {

public void init() throws ServletException {

PropertyConfigurator.configure(/usr/local/jakarta-tomcat-4.0/webapps/myapp/
WEB-INF/classes/log4j.properties);
// or wherever your properties file is
}

}
--

Then, put this in the web.xml file:

--
   servlet
  servlet-namestartlogging/servlet-name
  servlet-classstartlogging/servlet-class
  load-on-startup1/load-on-startup
   /servlet
--

I put it as my first servlet entry in the file.  Order is important in
that file.

Then, create the log4j.properties file, in the classes directory:

--
# Set root category priority to DEBUG and its only appender to A1.
log4j.rootCategory=DEBUG, A1

# A1 is set to be a ConsoleAppender.
#log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1=org.apache.log4j.FileAppender

# set up the filename - change as appropriate
log4j.appender.A1.File=/tmp/test.log

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
--

Finally, in classes that you want to log from:

--
class myclass {

static Category cat = Category.getInstance(userinfo.class);

public void mymethod() {
.
cat.info(This is an info log entry.);
--

and then it will log to the file you specified in the log4j.properties
file.  That's a lot of complexity to get a line into a file, but
whatever, it's better than trying to figure out what's going on by
looking at html output from a servlet...

The other problem here is that it uses the FileAppender method from
the log4j package.  I'm not sure what's wrong with this method, but
they say it is depracated, slated for removal, and there doesn't seem
to be any replacement for it.  Sometimes all you want is to put a line
in a file.  When you can't figure out what's going on, nothing is
better than falling back on a good old printf(we're here\n);.  I am
glad to here that java 1.4 is getting an assert() facility.  Maybe a
log() facility would be another good addition to that.





Re: Logging solution is complicated (was Re: Debugging in Tomcat 4)

2001-10-22 Thread Micael Padraig Og mac Grene

Cool.  Glad you are doing well.
-Original Message-
From: Dr. Evil [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, October 22, 2001 8:48 PM
Subject: Re: Logging solution is complicated (was Re: Debugging in Tomcat 4)



 Jeesch, Dr. Evil, I gave you a logger that does fancier logging and has
no
 setup.  You didn't like it?  It also has simpler code in the class.  And,
it
 does automatic type identification on the fly.  Whatchawant?  ;-)

Sorry, Marcel, I couldn't figure it out.  I was extremeley extremely
frustrated that night by not being able to get prepared statments to
work and having no debugging output and then looking at log4j's
enormous installation guide... but I did manage to get log4j installed
and it works fine.

Your logger's auto-object detection is cool, I must way.

Now with log4j everything is on track.  Tomcat works.  The learning is
painful though.





Re: Debugging in Tomcat 4

2001-10-19 Thread Micael Padraig Og mac Grene

Why don't you build a logger?  That is simple to do and can give you
whatever you want.  Every coder should have a few in his or her toolkit
anyway.  If you don't want to build one, there are oodles on the market and
laying around for free.

Don't know what kind of code you are writing, but it should be easier than
you are making it.  I include with this response a logger you can use if you
want to.  Please note that you can write code like new
Logger().add(stuff).add(stuff).add(stuff).log(options).  Each method returns
the logger so you can do this.  Good luck.


-Original Message-
From: Dr. Evil [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Friday, October 19, 2001 10:03 PM
Subject: Debugging in Tomcat 4



This is very painful.  The log() facility is great... in classes which
have the appropriate servlet packages imported.  However, if I am
using other classes which don't import those packages, then I don't
have log().  System.out.println() doesn't display anything to console
or any logs.  Running Tomcat in a debugger is challenging.  I'm left
with... hmm, not much other than throwing exceptions, but that's not a
good way to see something in operation.  So how do people debug with
Tomcat?  If there is no way to look at internal state of methods as
they are going, then that is a major, major failure of the product,
right?  Even a simple method can have some logic errors in it.  I
can't imagine trying to write a large, complex class without any form
of debugging.

Thanks



 Logger.java


Re: Tomcat 3.3 and user specific Webapps...

2001-10-02 Thread Micael Padraig Og mac Grene

Do you mind my asking why you want to do that, to better understand if I can
be helpful without wasting time?
-Original Message-
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, October 02, 2001 10:07 PM
Subject: Tomcat 3.3 and user specific Webapps...


Hi there, I would like to setup my Tomcat server (running behind Apache)
for users of my system.  I would like them to be able to deploy their web
applications by placing the neccesary files in a webapps directory not under
the standard tomcat/webapps directory but instead in their own
/home/userid/webapps directory.  They would then get access to their webapps
via a URL like so:

http://mydomain/~userid/webapps/mywebapp/MyServlet

How do I setup Apache/Tomcat to fullfill this need?

Thanks,

Craig.







Re: Tag Libs And Model 2

2001-09-26 Thread Micael Padraig Og mac Grene

Yes.  javax.servlet.jsp.PageContext is referenced the variable pageContext
in TagSupport for the PageContext member field.  Check out JSP Tag Libraries
by Shachor,et al, by Manning Publications Co. or Advanced JavaServer Pages
by David Geary by Pretice-Hall Press.  Both books are good.  I like Geary's
better, but each has its charms.  You can read the first 40 pages of Geary
and be pretty much on your way.


-Original Message-
From: Hunter Hillegas [EMAIL PROTECTED]
To: Tomcat User List [EMAIL PROTECTED]
Date: Wednesday, September 26, 2001 4:06 PM
Subject: Re: Tag Libs And Model 2


I couldn't find a PageContext object under tagext in the 1.2 JavaDocs...
There is a javax.servlet.jsp.PageContext... Does that apply to taglibs as
well?


 From: Craig R. McClanahan [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 Date: Wed, 26 Sep 2001 15:40:40 -0700 (PDT)
 To: Tomcat User List [EMAIL PROTECTED]
 Subject: Re: Tag Libs And Model 2



 On Wed, 26 Sep 2001, Hunter Hillegas wrote:

 Date: Wed, 26 Sep 2001 15:27:39 -0700
 From: Hunter Hillegas [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: Tomcat User List [EMAIL PROTECTED]
 Subject: Re: Tag Libs And Model 2

 Is there any way for a tag that is invoked to call a servlet (with the
 request and response being propagated) before returning it's output?


 Check out javax.servlet.jsp.tagext.PageContext -- particularly the
 include() method.

 From a page directly, of course, you can use jsp:include for this
 purpose.

 Craig






Re: [JSP] get serial value in PostgreSQL

2001-09-25 Thread Micael Padraig Og mac Grene

Don't know PostgreSQL, but it must be a call of to get something like
lastId().  Watch not to leave any space in time between the two, if you
have an active site, and even if you do not.


-Original Message-
From: Lester June Cabrera [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Tuesday, September 25, 2001 9:47 PM
Subject: [JSP] get serial value in PostgreSQL



After adding a record in PostgreSQL with id as serial, how do I get the
value of id?


Thanks,
Lester






Re: Limits of Web

2001-09-24 Thread Micael Padraig Og mac Grene

Hi, Jim,

I am unclear about your question.  The Web can easily take care of this sort
of thing.  Certain there is no trouble with a number of Java solutions to
the job at hand.  I am not sure why you would think that Java could not do
this.  It is a relatively easy task.  It's just a matter of banging the
solution out, really.  You must have an underlying problem that you are not
articulating?

If you are an administrator that does not know the limits of the technology,
then the simple answer is that this is easy.

Micael
-Original Message-
From: Jim Cheesman [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, September 24, 2001 8:22 AM
Subject: Re: Limits of Web


At 04:59 PM 24/09/01, you wrote:
I have a question regarding the limits of web applications.

I sent out an e-mail requesting help for a problem with submitting
multiple
forms and the responses I am getting say I am nuts for trying to do such
complicated application on the Web.

My problem is that I work for a government agency that wants to take very
complicated client server data entry and reporting applications (there are
master/details that go three levels deep) and rewrite them for use on the
web.

In order to save money they want them to be similar enough to the
client-server applications so that they will not have to retrain users.
I
am currently finishing up the first (and easiest) of these applications
and
have had not a few headaches and frustrations.

My question is using technologies such as Java, Tomcat, JSP, and Tag
Libraries, how realistic is it to expect to be able to develop complicated
data entry forms with the same ease of use, precision, and stability as
client server applications using such tools as Java Swing, PowerBuilder,
VB
or Oracle Developer?  Are there tools that I am missing that would make
this easier or is the web just not able to handle such sophisticated apps?
Am I setting myself up for disaster?


Just out of interest, what's to stop you using a Swing applet?


Jim




--

   *   Jim Cheesman   *
 Trabajo:
[EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
I have my
doubts about disbelief.







Re: Limits of Web

2001-09-24 Thread Micael Padraig Og mac Grene

There is no need to use Swing, but it is not that slow.  Chances are that
your developers have learned how to write Swing but that they have no
learned how to wrap the application up for speed.  On the security issues,
you can make things as secure as you want, so I don't get that problem.
-Original Message-
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, September 24, 2001 8:51 AM
Subject: Re: Limits of Web



When we started with this app it we did not have the skills needed to
develop Swing applets.  Now the problem appears to be the speed of these
applets.  They are way to slow.  They also expect it to be as fast as their
Client Server Applications.  Plus the company I work for is paranoid about
security to the point of irrationality.  If they ever got wind of the
security problems involved in applets they would shut development down.






Re: Limit access to manager app?

2001-09-24 Thread Micael Padraig Og mac Grene

Put it inside WEB-INF
-Original Message-
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, September 24, 2001 9:52 PM
Subject: Limit access to manager app?


Is there a way to prevent remote users from accessing the /manager/
application? I know it's protected with a username/password, but is it
possible to limit access to that to local access only (from the machine
where tomcat resides only)? If so, how?

Thank you.





___
http://inbox.excite.com







Re: what port should I use for mod_webapp

2001-09-24 Thread Micael Padraig Og mac Grene

Change warp
-Original Message-
From: Nick Torenvliet [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, September 24, 2001 8:45 PM
Subject: what port should I use for mod_webapp



I managed to get Apache and Tomcat going tonight whew!!! 

To get it working I had to define 

Servername 192.168.2.4
Port 8008

I'm wondering what port I should use for Port?  I am running 
warp on 8008, and tomcat stand alone on 8080, I think apache
http is on 80.  What do you suggest?

Nick





Re: how to make a servlet as the home page

2001-08-26 Thread Micael Padraig Og mac Grene

Why don't you just have the welcome page in the web.xml contain:
jsp:forward page=/map* /
and have /map* mapped in web.xml to a servlet?  I don't understand why you
think going to a servlet in a problem?
-Original Message-
From: Aravind Naidu [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Sunday, August 26, 2001 7:52 PM
Subject: RE: how to make a servlet as the home page



Create an index.html with the following text

HTML
HEAD
meta http-equiv=REFRESH CONTENT=0; URL=/servlet/com.acme.XYZServlet
/HEAD
/HTML

Ensure that the servlet handles doGet(...)

-- Aravind


- Original Message -
From: naveen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, August 26, 2001 9:29 PM
Subject: how to make a servlet as the home page


 hi ,
 I am using tomcat and apache, I want to make a servlet as the home page
of
 my web site,
 when i access http://www.mysite.com/, a servlet needs to be called
and the
 most important thing in this is I need to access HTTP variables like
Remote
 Host, etc.
 thanks in advance








Re: Why and How Tomcat before Apache?

2001-08-17 Thread Micael Padraig Og mac Grene

What if it is not a servlet/jsp that is looking for the properties file,
but, rather a garden variety file?
-Original Message-
From: Jan Labanowski [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Cc: Jan Labanowski [EMAIL PROTECTED]
Date: Friday, August 17, 2001 7:16 PM
Subject: RE: Why and How Tomcat before Apache?




On Fri, 17 Aug 2001, Li, Jerry wrote:

 Hi, All:

 Your help is highly appreciated for the following questions.

 1. Does Tomcat have web-based administration functionality?

 We want to let the Tomcat administrator start/stop Tomcat through a
 Web-based interface. I have searched the mail archives, and found
somebody
 starting working on it in April. Is it available now? If yes, where could
I
 get it?

Well, yes... You can stop it via Web, but then can you start it afterwards,
when the web server goes dead?

 2. where is the right location to put properties files

 Our application uses a single properties file: system.properties. We have
 found that we have to put system.properties into WEB-INF/classes,
otherwise,
 Tomcat could not find it.

This is not a bad location for properties file.


 We have tried to put it into WEB-INF/lib and put WEB-INF/lib into
tomcat's
 classpath ( the classpath in tomcat.bat under tomcat_home/bin), but
tomcat
 still could not find it. However, if put it into WEB-INF/classes, tomcat
 will find it.

You need to read about tomcat security manager and classloaders.
What you put in the CLASSPATH is irrelevant for your application.
You can put the property file anywhere, and then specify its
location in the web.xml via context parameter, so the servlet/jsp can
open it.


 thanks,

 Jerry


Jan K. Labanowski|phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center|Internet: [EMAIL PROTECTED]
1224 Kinnear Rd, |http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163  |http://www.osc.edu/






Re: Why and How Tomcat before Apache?

2001-08-17 Thread Micael Padraig Og mac Grene

Sorry, I did not mean file but, rather, class.
-Original Message-
From: Jan Labanowski [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Cc: Jan Labanowski [EMAIL PROTECTED]
Date: Friday, August 17, 2001 7:16 PM
Subject: RE: Why and How Tomcat before Apache?




On Fri, 17 Aug 2001, Li, Jerry wrote:

 Hi, All:

 Your help is highly appreciated for the following questions.

 1. Does Tomcat have web-based administration functionality?

 We want to let the Tomcat administrator start/stop Tomcat through a
 Web-based interface. I have searched the mail archives, and found
somebody
 starting working on it in April. Is it available now? If yes, where could
I
 get it?

Well, yes... You can stop it via Web, but then can you start it afterwards,
when the web server goes dead?

 2. where is the right location to put properties files

 Our application uses a single properties file: system.properties. We have
 found that we have to put system.properties into WEB-INF/classes,
otherwise,
 Tomcat could not find it.

This is not a bad location for properties file.


 We have tried to put it into WEB-INF/lib and put WEB-INF/lib into
tomcat's
 classpath ( the classpath in tomcat.bat under tomcat_home/bin), but
tomcat
 still could not find it. However, if put it into WEB-INF/classes, tomcat
 will find it.

You need to read about tomcat security manager and classloaders.
What you put in the CLASSPATH is irrelevant for your application.
You can put the property file anywhere, and then specify its
location in the web.xml via context parameter, so the servlet/jsp can
open it.


 thanks,

 Jerry


Jan K. Labanowski|phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center|Internet: [EMAIL PROTECTED]
1224 Kinnear Rd, |http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163  |http://www.osc.edu/






Paris

2001-06-09 Thread Micael Padraig Og mac Grene

Hi, as well,

Hate to jump into a conversation, but what is your gig in Paris, Dom?  I am
a Francophile and have been looking for a way to get to Paris forever.  I am
an engineer with a focus, a strong focus, in Java.  So, thought I'd drop
this note.

Micael Padraig mac Grene
-Original Message-
From: Dom [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Saturday, June 09, 2001 3:16 AM
Subject: Re: JSP website hosting ?


Hi

Maybe you're french (I'm french) but I answer in english

I own a server, which I use for research and development of JSP and
databases, here in Paris
Linux, Apache, Tomcat 3.2.2, PHP4, MySql, Postgresql, IBM DB2, etc ...

If you're interested, write me back

Dom

- Original Message -
From: SIMONIN Alexandre [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 08, 2001 1:53 PM
Subject: JSP website hosting ?


 Hi,

 My apologies if this may not be the ideal place for such question...

 I'm looking for a company which could host two sites written in JSP ?
 One site has a .fr extension and the other a .com.

 Any suggestions ?

 Thanks in advance
 Alexandre







<    1   2