running a web app using NetBeans &tomcat


H

harryos

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
 
Ad

Advertisements

L

Lew

harryos said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top