running a web app using NetBeans &tomcat

Discussion in 'Java' started by harryos, Nov 10, 2008.

  1. harryos

    harryos Guest

    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
     
    harryos, Nov 10, 2008
    #1
    1. Advertising

  2. harryos

    Lew Guest

    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
     
    Lew, Nov 10, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pimousse
    Replies:
    2
    Views:
    3,707
    Roedy Green
    Apr 21, 2004
  2. hocho888
    Replies:
    1
    Views:
    685
  3. Sean Berry
    Replies:
    3
    Views:
    4,588
    Tim Terry
    Dec 19, 2005
  4. gavino
    Replies:
    0
    Views:
    1,331
    gavino
    Oct 29, 2006
  5. Enter The
    Replies:
    9
    Views:
    2,476
    Roedy Green
    Feb 25, 2010
Loading...

Share This Page