开发者

how to reload the whole page through a button placed in a division in jsp

开发者 https://www.devze.com 2022-12-27 20:34 出处:网络
when i tried to make web project, i placed the links on the left on one division and a bigger division on the right to load the jsp pages on clicking the links making the main page same...

when i tried to make web project, i placed the links on the left on one division and a bigger division on the right to load the jsp pages on clicking the links making the main page same... but whe开发者_JS百科n there is a need arises to load the whole page by clicking the button placed on the right division, i found that the only page is loaded on the right division jsp calling its action... please help me to sort out this problem..


It sounds like that you're using client-side includes with help of HTML <frame> or <iframe> element instead of server-side includes with help of <jsp:include>.

In HTML world, frames are considered very poor practice when used for template text instead of external includes or binary content (PDF's and so on). It's recommend to use server-side includes for them since it's better for user experience and also SEO (the framed content is indexed separately and not related to the parent page). You also don't need that whacky Javascript code anymore to keep everything to work as supposed (for the case the client opens the link in a new window and so on).

So to solve your particular problem, just use server-side includes instead of client-side includes. The <jsp:include> can do dynamic includes with little help of EL, e.g.:

<jsp:include page="/WEB-INF/${pagename}.jsp" />

where the ${pagename} is dependent from the link clicked. It can for example be a request parameter or pathinfo.

0

精彩评论

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