1 Reply Latest reply on Dec 19, 2001 1:45 PM by jsents

    mapping in web.xml - general question..

    yehonatan_mozes

      hey all , i'm kinda new to tomcat ,and http , so any help is welcomed :-)
      i'm currently using jboss 2.4.4 and tomcat4 (known as catalina). i'm deploying an ear application .
      i know how to work basically with the web.xml file , and i know how to make mapping to servlets and jsp files.
      my problem is that all my classes are in packages like
      com.xxx.xxx.xxx.jsp
      com.xxx.xxx.xxx.servlets , etc.
      when i map i know how to make the browser show the
      /App-Name/jsp/index.jsp ,instead of
      /App-Name/com/xxx/xxx/xxx/jsp/index.jsp
      but what should i do with images and regular htmls?
      can (and should ?) i map them?
      cause if i ask an image from a jsp file i have
      to do this all along -->

      does anyone have a better idea?
      i don't wish that the users will see all my folders.

      Best regards
      Yoni.





        • 1. Re: mapping in web.xml - general question..
          jsents

          I am not sure this is the best practice but we have set up our web app something like this

          Web App
          **CSS /for style Sheet
          **Images / for Images
          **jScript / for JavaScript
          **pages / for our JSP's
          **Web-INF /
          ****Classes
          ******com.. // this is all of our servlets and fronted classes
          ****lib //extra classes
          ****tld //tag stuff

          In our code our URL or Web.xml entries go to Servlets for the most part. The servlet then forwards to a JSP for the display. The address remains whatever was setup in the Web.xml name and not the jsp name and path or the servlet name and path. Now to include images and things of the nature we do the following line of code
          <input type="image" name="Select Address" border="0" alt="Select Address" src="<%=request.getContextPath()%>/images/administration/buttons/b_right_arrow.gif" height=17 width=17>

          The reason we use the request.getContextPath() is because that value changes from Web server to server and avoids the use of ../.. to get to the right directory. Also we have not put our JSP's in dir that have the com.?.? setup.

          I hope this helps some
          Thanks
          Josh