Announcement Announcement Module
Collapse
No announcement yet.
Directory Structure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Directory Structure

    The directory structure of my current application is some thing like this,
    Code:
    WebApp  
           |-jsp  
           |-js  
           |-images  
           |-WEB-INF      
                  |- classes      
                  |- lib
    JSP pages need some images that are in images folder and .js file that are in js folder.
    Problem is I am not able to access any of them using /images/some.gif and /js/cal.js

    Reference like this works on dev, but not on QA. QA environment is different from Dev. It have one proxy which redirects requests to either one of 2 servers.

    In dev, it is like both client and server are on same machine.

    I am not sure if this is something to do with view resolvers configured in xx-servlet.xml file.

    Code:
           <bean id="viewResolver"          class="org.springframework.web.servlet.view.InternalResourceViewResolver">      <property name="viewClass">               <value>org.springframework.web.servlet.view.JstlView</value>          </property>
         <property name="prefix">
              <value>/jsp/</value>
         </property>
         <property name="suffix">
              <value>.jsp</value>
         </property>
          </bean>
    Can some one please help me to understand so that I can get access to images and .js file from my jsp file in QA aswell.

  • #2
    Can some one please help me to understand so that I can get access to images and .js file from my jsp file in QA as well.
    You can just use URLs relative to the root, and it will work. E.g.
    Code:
    <c&#58;url value="/images/some.gif"/>
    NB - Your JSPs shouldn't need to be in the root folder.

    Problem is I am not able to access any of them using /images/some.gif
    You should be able to hit them directly with your browser - unless you can do this there is something wrong with the deployment. Does QA have a separate static content web-server?

    Comment


    • #3
      katentim,
      Thank you very much for ypur reply.

      I apologize not to post my reply soon as I had to test if <c:URL/> work in my QA environment.
      Unfortunatly it did not work.

      I am not sure what static content web-server mean?

      This is my environment. Weblogic 7.0.. On this QA this is how it is setup.

      There is a proxy box to which all requests are sent to.. That proxy would inturn redirects requests to either one of the weblogic servers. This is how even production is setup..

      Hence to give any send any requests in QA, the url contains the proxy name and then the application name.

      Example:
      In dev the URL look like this: http://localhost/webApp/index.jsp

      In QA same requests look like this: http://qaServer/proxy/webApp/index.jsp


      all url that have /webApp should go to mainController. This is setup in web/xml through servlet mapping..

      Can you please help me on how to make my URL relative to the context root?

      Please reply

      Comment


      • #4
        I apologize not to post my reply soon as I had to test if <c:URL/> work in my QA environment.
        This will only work if you're using JSTL. You can do other things - the point is to use a URL without a hard-coded web-app. contect root.

        If using html tag library (in Struts) you can use the html:rewrite tag.

        If not using this or JSTL, you can use a scriptlet as a last resort <%=request.getContextPath()%>.

        As the proxy changes the URL, a better option is to use relative paths. Otherwise you'll have to build the URL to include the proxy prefix.

        I am not sure what static content web-server mean?
        Some environments have a separate web-server to server static content (e.g. images, CSS, HTML and JS files).

        Can you please help me on how to make my URL relative to the context root?
        See above, but first verify you can view the images at all directly with the browser (e.g. http://qaServer/proxy/webApp/images/some.gif), otherwise you won't get anywhere.

        Comment

        Working...
        X