1

In my project i have requirement to open a jsp page as a popup from another jsp for that i use the javascript code as follows

window.open('popup.jsp','popupname','//properties of popup window ')

here in url if i mention as of above then i have to keep that jsp page in webcontent folder

now my question is If i want to keep that jsp page in WEB-INF folder how i have to mention the url.

I tried to give url like WEB-INF/popup.jsp but it is not working. but if i create a new folder in webcontent and try to acess it like createdfolder/popup.jsp its working.

Can anyo one help me one this issue how i have the url to acess the jsp page in WEB-INF.

Note:-I am using springs frame work in my project.

raki
  • 195
  • 1
  • 10
  • JSPs in WEB-INF after not directly available to clients. Either access it through a controller, or if it must be accessed directly, just don't put it there. The reason they're put there is specifically to disallow direct access--why would you want it there but still allure direct access? – Dave Newton Apr 15 '12 at 10:20

1 Answers1

2

You have to use viewResolver to find jsp pages which are inside WEB-INF

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

add this in your controller

@RequestMapping("/popup.htm")
    public String showPopupPage(){
        return "popup";
    }

add this in your jsp page

window.open('popup.htm','popupname','//properties of popup window ')
Ramesh Kotha
  • 8,266
  • 17
  • 66
  • 90