tags:

views:

500

answers:

1

hi guys and girls. i want to call 2 views within one controller in spring with java. for example

this.controller.view('header');
this.controller.view('body');
this.controller.view('footer');

how can i do that? or it is possible in spring? or can you suggest any other way to do it?

and can i call a view inside a view. for example in view/login.jsp,

<table><tr><td>
<jsp>this.controller.view('login_form')</jsp>
</td></tr></table>

yeah, all the codes i wrote there are not valid jsp language, but that is the concept i want to do in this project.

+2  A: 

It appears that you would like to reuse fragments of a JSP (header, footer) across multiple JSP pages. If that is the case, consider using one dedicated view (for example login_form.jsp) and using JSP include statements to incorporate the 'common' fragments from that JSP page.

As an example (of login_form.jsp):

<jsp:include page="header.jsp"/>
<!-- login_form specific page content goes here -->

<jsp:include page="footer.jsp"/>

This would allow you to reuse common header and footer content across multiple JSP pages.

I would also recommend having a look at Spring MVC (documentation), it is a pretty good approach for Spring based web apps.

Pierce Hickey