You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by or...@kewlstuff.co.za on 2007/03/10 10:25:38 UTC

RE: Tomcat and NetBeans IDE - THE BEST

Hi there,

I also only recently started using Tomcat and Netbeans and its a match made in heaven.
I use Tomcat for EVERYTHING.... its fantastic, wonderful, best thing I ever discovered, and Netbeans is sizzling hot as well.

No, you dont have to use the embedded Tomcat server, and it wont be long before you get a later Tomcat and want to use that anyway...
So what you do is open TOOLS->SERVER MANAGER and point it to the Tomcat version you want to use... its that easy.

Now you do not have to worry about starting and stopping Tomcat(the new one) when developing, as soon as you start a servlet it will happen automatically. If you want to stop it, you do it from INSIDE Netbeans.... either in the Runtime Tag, or you will see you can do it from the Tomcat Tag in the OUTPUT section of netbeans.... so you develop as normal.

Now when you CLEAN and BUILD your project you will see that it creates a DIST folder with the WAR file... that you simply drop into the WEPAPPS folder of ANY TOMCAT.... and then start THAT tomcat as a standalone (without netbeans running) and its deployed.... you can also use the Tomcat manager from the web browser but I find this method easier.

Now just one thing that can be confusing.... when Netbeans does all its magic and lets your debug stuff... it actually creates a temporary BUILD folder and when you
testing that is the code that is ACTUALLY running in the TOMCAT you using. Now what happens alot is that you drop your WAR file into tomcat BUT its not actiully deployed because NETBEANS still has control of Tomcat.... and what is actually happening is that Tomcat is still running your servlet in the BUILD folder.
It doesnt pick the WAR file up. So what I do before checking a WAR in tomcat, is DELETE the projects BUILD folder. Now if Tomcat complains, thats good, because you know it was still looking at the devlopment environment. Just stop tomcat, put the WAR file in WEBAPPS and restart it, it will pick up on the new WAR.

Dont give up, Netbeans and Tomcat are magic, best development environment I've ever used.

If you want to see some pretty cool stuff I've developed on Tomcat go to http://coolese.100free.com/

Theres 
a) A replication system for POSTGRESQL
b) A web site search engine based on LUCENE
c) An Application Server HARBOR, that lets you run normal java apps from anywhere if you also think, JBOSS, SPRING etc are too complex.

ALL DONE IN TOMCAT and NETBEANS... I love them.

==================
> Hi , I am new to tomcat and be grateful for your reply and explanation.
   
>  I have downloaded NetBeans which is bundled with Tomcat server .  I use tomcat from within
> the environment to test my pages.


Re: Specifying relative path for TOMCAT 5.5 ?

Posted by Rajendra Sakpal <ra...@gmail.com>.
Thanks ORG.  The ServletContext method solved my problem.

Rajendra



On 3/10/07, org@kewlstuff.co.za <or...@kewlstuff.co.za> wrote:
>
> Hi Rajendra,
>
> This also confused the hell out of me.
>
> Here are some tips
>
> If a url is relative, its relative to the page
> eg
> moreInfo/Details/SomePage.htm
> So its going to depend on the page the user is viewing and go from
> there...
> just like normal HTML pages.
>
> When you want it to go to an "absolute" relative page LOOK at the folders
> under you project name, or the folders under Web Pages in netbeans ONLY.
>
> So in Netbeans if you have Details/SomePage.jsp under Web Pages and you
> want
> the link to go there, you would write it as
> /Details/SomePage.jsp
>
> That little  / at the beginning makes it go to that page regardless of the
> page it is in.
>
> Now when you want to get at your class files, you normally just use the
> class name, no paths.
> eg:
> <jsp:useBean scope="request" id="searchBean"
> class="com.myco.searchResultBean" />
>
> BUT if you want to get at say the actual bytes then one way is to
>        ServletContext context = getServletContext();
>        sWebInfPath = context.getRealPath("/WEB-INF/");
>
> This will give you that actual location on your file system and then you
> can
> just
> use (new File) etc to get at the physical file in the sub folder.
>
> A more advanced function is to go the same way as you would if you wanted
> to
> extract the bytes of a class from a Jar file
>
>            in = getClass().getResourceAsStream(sPackageName);
>
> it also works on Tomcat.
>
> Hope that helps.....
>
> Heres some free software for you  http://coolese.100free.com/
> All done on the amazing Tomcat
>
> ----- Original Message -----
> Hi,
>
> I am using TOMCAT 5.5.  I am creating a file in class that is called from
> a
> JSP.  However, the relative path that I have specified in the class
> doesn't
> seem to work.  The path that I have used is
> :"/webapps/Jonathon/WEB-INF/etc/subscriber.txt".
>
> Can someone please let me know, what is wrong with the relative path ?
>
> thanks in advance,
> Rajendra
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Specifying relative path for TOMCAT 5.5 ?

Posted by or...@kewlstuff.co.za.
Hi Rajendra,

This also confused the hell out of me.

Here are some tips

If a url is relative, its relative to the page
eg
moreInfo/Details/SomePage.htm
So its going to depend on the page the user is viewing and go from there... 
just like normal HTML pages.

When you want it to go to an "absolute" relative page LOOK at the folders 
under you project name, or the folders under Web Pages in netbeans ONLY.

So in Netbeans if you have Details/SomePage.jsp under Web Pages and you want 
the link to go there, you would write it as
/Details/SomePage.jsp

That little  / at the beginning makes it go to that page regardless of the 
page it is in.

Now when you want to get at your class files, you normally just use the 
class name, no paths.
eg:
<jsp:useBean scope="request" id="searchBean" 
class="com.myco.searchResultBean" />

BUT if you want to get at say the actual bytes then one way is to
        ServletContext context = getServletContext();
        sWebInfPath = context.getRealPath("/WEB-INF/");

This will give you that actual location on your file system and then you can 
just
use (new File) etc to get at the physical file in the sub folder.

A more advanced function is to go the same way as you would if you wanted to 
extract the bytes of a class from a Jar file

            in = getClass().getResourceAsStream(sPackageName);

it also works on Tomcat.

Hope that helps.....

Heres some free software for you  http://coolese.100free.com/
All done on the amazing Tomcat

----- Original Message ----- 
Hi,

I am using TOMCAT 5.5.  I am creating a file in class that is called from a
JSP.  However, the relative path that I have specified in the class doesn't
seem to work.  The path that I have used is
:"/webapps/Jonathon/WEB-INF/etc/subscriber.txt".

Can someone please let me know, what is wrong with the relative path ?

thanks in advance,
Rajendra 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org