running a web app using NetBeans &tomcat

This is a discussion on running a web app using NetBeans &tomcat within the Java forums in Programming Languages category; hi i am learning to create and deploy web apps using NetBeansIDE and tomcat6,I used the following dir structure myapp -src -web -MET-INF ---has context.xml -WEB-INF--has html, jsps and web.xml In context.xml ,I set the following context <Context path="/myapp"> ....some db resource with name jdbc/myapp </Context> In web.xml ,I set <welcome-file-list> <welcome-file>begin.html</welcome-file> </welcome-file-list> <resource-ref> <res-ref-name>jdbc/myapp</res-ref-name> <res-type>javax.sql.DataSource</res-type> ... I have a begin.html in WEB-INF directory that i want to be loaded when the app starts.When I build the application ,java classes are compiled and a browser window opens and tries to load http://localhost:8080/myapp/ But i get an error 404 saying that ...

Go Back   Application Development Forum > Programming Languages > Java

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 11-10-2008, 10:38 AM
harryos
Guest
 
Default running a web app using NetBeans &tomcat

hi
i am learning to create and deploy web apps using NetBeansIDE and
tomcat6,I used the following dir structure

myapp
-src
-web
-MET-INF ---has context.xml
-WEB-INF--has html, jsps and web.xml

In context.xml ,I set the following context
<Context path="/myapp">
....some db resource with name jdbc/myapp
</Context>

In web.xml ,I set
<welcome-file-list>
<welcome-file>begin.html</welcome-file>
</welcome-file-list>
<resource-ref>
<res-ref-name>jdbc/myapp</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
...

I have a begin.html in WEB-INF directory that i want to be loaded when
the app starts.When I build the application ,java classes are compiled
and a browser window opens and tries to load http://localhost:8080/myapp/
But i get an error 404 saying that The requested resource (/myapp/) is
not available.
Is there something wrong with the entries in the xml files?Is that why
i get this error?

pls help
harry
Reply With Quote
  #2  
Old 11-10-2008, 11:34 AM
Lew
Guest
 
Default Re: running a web app using NetBeans &tomcat

harryos wrote:
> i [sic] am learning to create and deploy web apps using NetBeansIDE and
> tomcat6,I used *the following dir structure
>
> myapp
> * * -src
> * * -web


Web pages here.

> * * * * * -MET-INF *---has context.xml
> * * * * * -WEB-INF--has html, jsps and web.xml
>
> In context.xml ,I set the following context
> <Context path="/myapp">
> ...
> </Context>
>
> In web.xml ,I set
> <welcome-file-list>
> * * * * <welcome-file>begin.html</welcome-file>
> * * * * </welcome-file-list>
> ..
>
> I have a begin.html in WEB-INF directory that i [sic] want to be loaded when
> the app starts.When I build the application ,java classes are compiled
> and a browser window opens and tries to loadhttp://localhost:8080/myapp/
> But i [sic] get an error 404 saying that The requested resource (/myapp/)is
> not available.


Try putting 'begin.html' directly in the context root, i.e, in the
source tree under web/ instead of web/WEB-INF/.

> Is there something wrong with the entries in the xml files?Is that why
> i [sic] get this error?


WEB-INF is for resources that you want hidden from the browser, such
as including .jspf page fragments. You have successfully hidden
'begin.html' from the browser by putting it in that directory.

--
Lew
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:17 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.