Re: quick question when getting started

2004-04-15 Thread Michiel Toneman
Hi Stephen,

You've been tricked by the web.xml. The JSP's are pre-compiled to 
servlets and a mapping for the URL /index.jsp to this servlet has been 
inserted into web.xml. If you delete the servlet mapping in the web.xml, 
everything should be as normal, and your changes will be visible.

(this caught me out the first time too... ;-) )

Michiel

Stephen Charles Huey wrote:

I'm upgrading from Tomcat 4 to 5 and I just installed Tomcat 5 on a dev
machine to play with it, and I know a couple things are organized a bit
differently, but the provided index page is weirding me out.  

I tried to add a line of text to the index.jsp in webapps\ROOT and when I
reload the page (that I browse to by going to localhost on my Win 2K
Server machine), that line of text isn't appearing.  I've tried adding
other bits, too, and I've tried restarting Tomcat, and I found a
catalina-root.jar in the WEB-INF\lib folder and deleted that in an effort
to get it to recompile the index.jsp, but nothing seems to be working! 
Why?

Here's an example of what I've modified in the HTML:

pcenterbIf you're seeing this page via a web browser, it means
Stephen has setup Tomcat successfully.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

--
Michiel Toneman  Software Engineer   Bibit Global Payment Services
Regulierenring 10  3981 LB  Bunnik   [EMAIL PROTECTED]
Tel. +31-30-6595168  Fax +31-30-6564464  http://www.bibit.com/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: quick question concerning the Client Deployer Package

2004-01-27 Thread Remy Maucherat
Glanville, Jay wrote:
Hello all.  I have a quick question concerning the client deployer
package
(http://jakarta.apache.org/tomcat/tomcat-5.0-doc/deployer-howto.html#Dep
loying%20using%20the%20Client%20Deployer%20Package).  There is a compile
target and a deploy target.  My assumption is that the deploy target
only deploys the web application and not the compiled code from the
compile target.
Is this assumption correct?
compile does JSP precompilation on your webapp (and will actually also 
compile to /WEB-INF/classes any Java class put in /WEB-INF/src). deploy 
uploads that precompiled application to the server.

--
x
Rémy Maucherat
Developer  Consultant
JBoss Group (Europe) SàRL
x
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: quick question concerning the Client Deployer Package

2004-01-27 Thread Jay Glanville
Thanks

--
Jay Glanville


 -Original Message-
 From: Remy Maucherat [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 27, 2004 9:11 AM
 To: Tomcat Users List
 Subject: Re: quick question concerning the Client Deployer Package
 
 
 Glanville, Jay wrote:
  Hello all.  I have a quick question concerning the client deployer
  package
  
 (http://jakarta.apache.org/tomcat/tomcat-5.0-doc/deployer-howt
o.html#Dep
 loying%20using%20the%20Client%20Deployer%20Package).  There is a
compile
 target and a deploy target.  My assumption is that the deploy target
 only deploys the web application and not the compiled code from the
 compile target.
 
 Is this assumption correct?

compile does JSP precompilation on your webapp (and will actually also

compile to /WEB-INF/classes any Java class put in /WEB-INF/src). deploy 
uploads that precompiled application to the server.

-- 
x
Rémy Maucherat
Developer  Consultant
JBoss Group (Europe) SàRL
x

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: quick question

2003-09-24 Thread Atreya Basu
Hi Steven,

You should be able to if your URI directive is something like, 
[uri:localhost/*.jsp].  The other thing that you need to do is set up 
the proper context for the JSP, so if you want to place them in 
/home/apache, you'll need to add the proper context directive in your 
server.xml file.

Atreya

Steven Garrett wrote:

Hi,

Can I envoke jsp from outside of the application directory.  For example, I
have /var/tomcat4/webapps/application/some.jsp.  Can I put some.jsp in
/home/apache/ (my apache docroot) and have it still work?
Thanks,

Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

--

Developer
Greenfield Research Inc.
atreya(AT)greenfieldresearch(DOT)ca
(902)422-9426


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Quick Question

2002-08-14 Thread Durham David Cntr 805CSS/SCBE

post questions to the list please.  

It will work in a bean if you pass a reference to the servlet context to it.  I'm not 
all that familiar with using beans in jsp but I think that you will have to break out 
of the bean tags and actually make a method call like:  % 
myBean.setServletContext(getServletContext()) %


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 12, 2002 5:21 PM
To: Durham David Cntr 805CSS/SCBE
Subject: RE: Quick Question



the getServletContext.getRealPath will work in a java bean?? 

I'm trying to read a txt file from a java bean instead of a java servlet.   then I 
use the bean in a jsp page. 

thanks 
Alex 









Durham David Cntr 805CSS/SCBE [EMAIL PROTECTED] 
12/08/2002 05:12 p.m. 
Please respond to Tomcat Users List 

To:Tomcat Users List [EMAIL PROTECTED] 
cc: 
Subject:RE: Quick Question 




getServletContext.getRealPath(/config.txt) will return the path to config.txt in the 
root of your apps directory.



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 12, 2002 5:00 PM
 To: Tomcat Users List
 Subject: Quick Question
 
 
 Hi all,
 
 I wrote a simple java bean that reads a txt file, the problem 
 is where do 
 I need to put the txt file??...
 What is the default directory in Tomcat??
 
 when I put something like this in my java bean : 
 FileReader(config.txt) 
 Where does tomcat look for that file?
 
 thanks
 Alex
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-14 Thread Larry Meadors

IMO, it seems like a bad idea to me to tie your bean 
code to a servlet context unless you REALLY need to.

To me, a better way would be to put the file in a 
directory under classes, and use the classloader of 
the current thread to get to the file.

This way, you do not need servlet.jar to use your bean 
if you every decide to use it outside of a servlet.

This is a very simple process. Here is an example:

private InputStream getFile(String name){
 return Thread.
  currentThread().
  getContextClassLoader().
  getResourceAsStream(name);
}

To read a properties file classes/myprops.properties 
for instance, you just do this:

Properties p = new Properties();
p.load(getFile(myprops.properties));

Larry

 [EMAIL PROTECTED] 08/14/02 08:42 AM 
It will work in a bean if you pass a reference 
to the servlet context to it...

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-14 Thread Durham David Cntr 805CSS/SCBE

good point, although if you need to write to the file, getResourceAsStream doesn't 
work.  Is there something else along the same lines that will?


 -Original Message-
 From: Larry Meadors [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 14, 2002 10:11 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Quick Question
 
 
 IMO, it seems like a bad idea to me to tie your bean 
 code to a servlet context unless you REALLY need to.
 
 To me, a better way would be to put the file in a 
 directory under classes, and use the classloader of 
 the current thread to get to the file.
 
 This way, you do not need servlet.jar to use your bean 
 if you every decide to use it outside of a servlet.
 
 This is a very simple process. Here is an example:
 
 private InputStream getFile(String name){
  return Thread.
   currentThread().
   getContextClassLoader().
   getResourceAsStream(name);
 }
 
 To read a properties file classes/myprops.properties 
 for instance, you just do this:
 
 Properties p = new Properties();
 p.load(getFile(myprops.properties));
 
 Larry
 
  [EMAIL PROTECTED] 08/14/02 08:42 AM 
 It will work in a bean if you pass a reference 
 to the servlet context to it...
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-14 Thread Shapira, Yoav

Howdy,

good point, although if you need to write to the file,
getResourceAsStream
doesn't work.  Is there something else along the same lines that will?

How's about:

URL destinationURL = ...getResource(...);
URLConnection destinationConnection = URL.openConnection();
destinationConnection.setDoOutput();
OutputStream outputStream = destinationConnection.getOutputStream();
...

You are not guaranteed this will always work across containers.  I don't
think the spec says the container *has* to give you write permission to
URLs obtained this way.

Yoav Shapira
Millennium ChemInformatics



 -Original Message-
 From: Larry Meadors [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 14, 2002 10:11 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Quick Question


 IMO, it seems like a bad idea to me to tie your bean
 code to a servlet context unless you REALLY need to.

 To me, a better way would be to put the file in a
 directory under classes, and use the classloader of
 the current thread to get to the file.

 This way, you do not need servlet.jar to use your bean
 if you every decide to use it outside of a servlet.

 This is a very simple process. Here is an example:

 private InputStream getFile(String name){
  return Thread.
   currentThread().
   getContextClassLoader().
   getResourceAsStream(name);
 }

 To read a properties file classes/myprops.properties
 for instance, you just do this:

 Properties p = new Properties();
 p.load(getFile(myprops.properties));

 Larry

  [EMAIL PROTECTED] 08/14/02 08:42 AM 
 It will work in a bean if you pass a reference
 to the servlet context to it...

 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:tomcat-user-
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:tomcat-user-
[EMAIL PROTECTED]
For additional commands, e-mail: mailto:tomcat-user-
[EMAIL PROTECTED]



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


RE: Quick Question

2002-08-14 Thread Larry Meadors

It is  little more work to get read/write access, but the getResource()
method will give you a URL object.

You can then use URL.getProtocol() to see if it is coming from a file or
something else (a jar or even http, if you use the URLClassLoader), then
use the URL.getFile() if it was a file to get the path to the file.

Might be a good idea if you want to do that to create a 
class that makes this more abstract so you have a single API to work
with instead of trying to remember all the ClassLoader/URL/File APIs...

I might just do that - it might be fun. ;-)

Larry

 [EMAIL PROTECTED] 08/14/02 09:45 AM 
good point, although if you need to write to the 
file, getResourceAsStream doesn't work.  Is there
something else along the same lines that will?


 -Original Message-
 From: Larry Meadors [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 14, 2002 10:11 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Quick Question
 
 
 IMO, it seems like a bad idea to me to tie your bean 
 code to a servlet context unless you REALLY need to.
 
 To me, a better way would be to put the file in a 
 directory under classes, and use the classloader of 
 the current thread to get to the file.
 
 This way, you do not need servlet.jar to use your bean 
 if you every decide to use it outside of a servlet.
 
 This is a very simple process. Here is an example:
 
 private InputStream getFile(String name){
  return Thread.
   currentThread().
   getContextClassLoader().
   getResourceAsStream(name);
 }
 
 To read a properties file classes/myprops.properties 
 for instance, you just do this:
 
 Properties p = new Properties();
 p.load(getFile(myprops.properties));
 
 Larry
 
  [EMAIL PROTECTED] 08/14/02 08:42 AM 
 It will work in a bean if you pass a reference 
 to the servlet context to it...
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:  
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-14 Thread Larry Meadors

WOW! Cool, I did not know you could do that!

 [EMAIL PROTECTED] 08/14/02 09:54 AM 

URL destinationURL = ...getResource(...);
URLConnection destinationConnection = URL.openConnection();
destinationConnection.setDoOutput();
OutputStream outputStream = destinationConnection.getOutputStream();
...


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-13 Thread Isabel Lameda

Try to create a file in your bean and see where Tomcat stores it

-Mensaje original-
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Enviado el: Lunes, 12 de Agosto de 2002 06:00 p.m.
Para: Tomcat Users List
Asunto: Quick Question


Hi all,

I wrote a simple java bean that reads a txt file, the problem is where do 
I need to put the txt file??...
What is the default directory in Tomcat??

when I put something like this in my java bean : 
FileReader(config.txt) 
Where does tomcat look for that file?

thanks
Alex

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-13 Thread Drinkwater, GJ (Glen)


tomcats default directory is where ever you called the startup.sh/bat file.
So if you dont use another script to call the startup.sh/bat file tomcats
default will be the bin directory.

Use this code to find the directory where WEB-INF is.  Then you can traverse
your directory structure from there. 

//get context path
ServletConfig scon = null ;
String workingDir = null;

public void init(ServletConfig config) {
scon = config ;
 }
 public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
  
//get working dir
ServletContext sc = scon.getServletContext();
workingDir = sc.getRealPath();


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Quick Question

2002-08-13 Thread Michael E. Locasto

Alex,

Probably the current working directory, which is whatever directory Tomcat
was started out of (probably bin/, but not necessarily so). You can provide
a full file name in the code, or use your web.xml to set a context parameter
that indicates a base path to do read/write relative to in your servlet.

You could also put that file somewhere your web application's Classloader
will see it and load it via a findResource() or getResourceAsStream().

Regards,
Michael

- Original Message -
From: Isabel Lameda [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, August 13, 2002 8:50 AM
Subject: RE: Quick Question


 Try to create a file in your bean and see where Tomcat stores it

 -Mensaje original-
 De: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Enviado el: Lunes, 12 de Agosto de 2002 06:00 p.m.
 Para: Tomcat Users List
 Asunto: Quick Question


 Hi all,

 I wrote a simple java bean that reads a txt file, the problem is where do
 I need to put the txt file??...
 What is the default directory in Tomcat??

 when I put something like this in my java bean :
 FileReader(config.txt)
 Where does tomcat look for that file?

 thanks
 Alex

 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-13 Thread TOMITA_ALEX_NONLILLY

Hi all,

I'm trying to resolve this problem with all the solutions that you gave 
me,  but it doesn't work...
This is what I did:

in my java bean (not a servlet), I have this code:


public class DbBean {
   public  int Connect()  {
   InputStream is = 
Thread.currentThread().getContextClassLoader().getResourceAsStream(config.txt);
if (is == null) {
return 0;
}
else {
return 1;
}
}


then in my jsp, I called this method, and then I write the value (0 or 
1)..

The txt file is in WEB-INF/classes/beans..., because DbBean is in a 
package called beans, and I start tomcat from TOMCAT_HOME/bin..
When I load the jsp, the method Connect of the DbBean (java bean) returned 
0, which means the InputStream is null, but if I put the txt file in
TOMCAT_HOME/bin, I had no problem, the method returned 1  why is 
that??.. I'm using Tomcat 3.2
Do I need to set something else in Tomcat??

thanks again
Alex Tomita













Drinkwater, GJ (Glen) [EMAIL PROTECTED]
13/08/2002 08:11 a.m.
Please respond to Tomcat Users List

 
To: Tomcat Users List [EMAIL PROTECTED]
cc: 
Subject:RE: Quick Question




tomcats default directory is where ever you called the startup.sh/bat 
file.
So if you dont use another script to call the startup.sh/bat file tomcats
default will be the bin directory.

Use this code to find the directory where WEB-INF is.  Then you can 
traverse
your directory structure from there. 

//get context path
ServletConfig scon = null ;
String workingDir = null;
 
public void init(ServletConfig config) {
scon = config ;
 }
 public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
 
//get working dir
ServletContext sc = scon.getServletContext();
workingDir = sc.getRealPath();


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]






RE: Quick Question

2002-08-13 Thread Drinkwater, GJ (Glen)

hi

what you should try to do is either from your jsp use the method I suggested
before and pass the info to your bean, or if this is a config file, use this
method which works I have just tried it, to load your file into a properties
class.

Properties conf = new Properties();
conf.load(getClass().getResource(config.txt).openStream());

then you can extract the information.

glen


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-12 Thread Durham David Cntr 805CSS/SCBE

getServletContext.getRealPath(/config.txt) will return the path to config.txt in the 
root of your apps directory.



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 12, 2002 5:00 PM
 To: Tomcat Users List
 Subject: Quick Question
 
 
 Hi all,
 
 I wrote a simple java bean that reads a txt file, the problem 
 is where do 
 I need to put the txt file??...
 What is the default directory in Tomcat??
 
 when I put something like this in my java bean : 
 FileReader(config.txt) 
 Where does tomcat look for that file?
 
 thanks
 Alex
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Quick Question

2002-08-12 Thread Larry Meadors

If you are only reading the file, you could also put it in your
$/WEB-INF/classes folder and use the class loader to get an input
stream. That way, if you jar/war the file up, it will still find it.
Like this:

InputStream is = 
  Thread.
  currentThread().
  getContextClassLoader().
  getResourceAsStream(config.txt);

Also, a change to config.txt will trigger a reload, so in development,
you do not need to restart or otherwise force the file to get reloaded.

Not sure if this makes sense in your case, but it is another option.

Larry

 [EMAIL PROTECTED] 08/12/02 16:14 PM 
getServletContext.getRealPath(/config.txt) will return the path to
config.txt in the root of your apps directory.



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 12, 2002 5:00 PM
 To: Tomcat Users List
 Subject: Quick Question
 
 
 Hi all,
 
 I wrote a simple java bean that reads a txt file, the problem 
 is where do 
 I need to put the txt file??...
 What is the default directory in Tomcat??
 
 when I put something like this in my java bean : 
 FileReader(config.txt) 
 Where does tomcat look for that file?
 
 thanks
 Alex
 

--
To unsubscribe, e-mail:  
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Quick question?

2001-10-04 Thread Craig R. McClanahan



On Thu, 4 Oct 2001, James Turner wrote:

 Date: Thu, 4 Oct 2001 00:14:17 -0400
 From: James Turner [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Quick question?

 Do you happen to know what directory Turbine tries to load
 TurbineResources.properties from if you specify . as the path in new
 TurbineConfig?


If it is using file I/O to read the config file (don't have a clue ... ask
the Turbine list) then it will try to resolve this against the current
working directory of the servlet container.  In other words, this will
vary depending on which container (and which version of the container) you
are using.  It also depends on whether you used the standard startup
scripts or not, and whether you had the TOMCAT_HOME or CATALINA_HOME
environment variable preset or not ...

Webapps that want to be portable should read config files using
ServletContext.getResource() instead.

 Thanks,
 James


Craig McClanahan