Announcement Announcement Module
Collapse
No announcement yet.
Resource access with only 1 url extension Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resource access with only 1 url extension

    Hello guys,

    This question may sound simple but I really did my best to ask mr google but unfortunately it was fruitless. May I ask your expertise regarding this behavior:

    when i request for a certain page with "*.html" extension, what actually it is rendering is "*.jsp" page. what i wanna do is when i try to access the "*.jsp" file directly, i should NOT be able to access the page, instead, i must be redirected to a 'PAGE NOT FOUND' page.

    Any help is greatly appreciated.

    Thanks and regards,
    -marckun

    ps: im a newbie in this field so please go easy on me. if this same question has been asked before, would you please provide a link for it.. heheh i dont know how to search for this since i don't know how to call this behavior to begin with.. XD
    Last edited by marcKun; Mar 23rd, 2009, 04:41 AM.

  • #2
    Why don't you put your JSPs under WEB-INF folder ?
    Any file in there can't be accessed through HTTP.

    It's your ViewResolver which will forward the request to the appropriate JSP, here is an example :

    Code:
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    	<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
    	<property name="prefix" value="/WEB-INF/jsp/" />
    	<property name="suffix" value=".jsp" />
    </bean>

    Comment


    • #3
      Originally posted by mlarchet View Post
      Why don't you put your JSPs under WEB-INF folder ?
      Any file in there can't be accessed through HTTP.

      It's your ViewResolver which will forward the request to the appropriate JSP, here is an example :

      Code:
      <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      	<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
      	<property name="prefix" value="/WEB-INF/jsp/" />
      	<property name="suffix" value=".jsp" />
      </bean>
      Thanks man.. I got it now..

      Regards,
      -marcKun

      Comment

      Working...
      X