开发者

using frameset in Spring 3

开发者 https://www.devze.com 2023-04-09 22:51 出处:网络
I am a newbie to Spring 3 , and am learning on my own. I have run into a issue regarding framesets. In my page , I have included 3 framesets , something like this

I am a newbie to Spring 3 , and am learning on my own. I have run into a issue regarding framesets.

In my page , I have included 3 framesets , something like this

<frameset rows="10">

<frame src="/开发者_如何学JAVAWEB-INF/views/frame1.jsp" name="frame1"scrolling="no">

<frameset cols="20%,*">

<frame src="/WEB-INF/views/frame2.jsp" name="frame2">

<frame src="/WEB-INF/views/frame3.jsp" name="frame3">

</frameset>

</frameset>

Now when I run the frameset page it throws a resource not found exception , I do not get why.

Is it that I have to define the mapping for each of the frame*.jsp pages in the Controller. Any examples would be appreciated

Thanks in advance : Vivek


Normally the browser itself should not be able to access files located under WEB-INF (this is an app-container thing). You'd need to map them to something publicly-accessible; a view, a JSP not under WEB-INF, etc.


All pages inside WEB-INF directory not accessed to user, so if this is a simple JSP pages, move it to public folder (and check that it accessable via browser).


A frame source would require an actual mapping or a publicly available file. You will notice that you will get a 404 if you try to hit that resource in a browser.


Instead of framesets directly having link to jsp as src, point it to a server side action. Let the action handler (for ex. servlet or spring controller) do a forward to your jsp present inside web-inf.


I had the same problem of not being linked to the jsp page in one frames in the frameset. Note that each frame is a new http request. the flow is web.xml ---> servletname-servlet.xml --> controller --> view resolver.

put some thing like this in your frameset frame frame src="frame_b" link it with controller @RequestMapping(value = "/frame_b", method = RequestMethod.GET) public ModelAndView goFrameb(ModelMap model) { return new ModelAndView("frame_b"); } view resolver can map to your jsp page like frame_b.jsp **** jsp is present in web-inf/jsp/*.jsp


I had the same problem of not being linked to the jsp page in one frames in the frameset.

Note that each frame is a new http request. the flow is web.xml ---> servletname-servlet.xml --> controller --> view resolver.

put some thing like this in your frameset frame src of frame has src="frame_b"

link it with controller

@RequestMapping(value = "/frame_b", method = RequestMethod.GET) public ModelAndView goFrameb(ModelMap model) { return new ModelAndView("frame_b"); }

view resolver can map to your jsp page like frame_b.jsp

**** jsp is present in web-inf/jsp/*.jsp

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号