How to create a jsp template similar to blade.php?

I want to create a jsp template similar to blade.php. This is a sample page that I want to create from JSP. I looked at the tags in the jsp template. How to create the following clip template using jsp.

default.blade.php

<!DOCTYPE html>
<html lang="en">
@include('dashboard.includes.head')
<body>
<div id="wrapper">
<div id="main-container">
<!-- BEGIN TOP NAVIGATION -->
@include('dashboard.includes.nav-top')
<!-- END TOP NAVIGATION -->
<!-- BEGIN SIDE NAVIGATION -->  
@include('dashboard.includes.nav-side')
<!-- END SIDE NAVIGATION -->
<!-- BEGIN MAIN PAGE CONTENT -->
<div id="page-wrapper">
<!-- BEGIN PAGE HEADING ROW -->
<div class="row">
<div class="col-lg-12">
<!-- BEGIN BREADCRUMB -->
@include('dashboard.includes.breadCrumb')
<!-- END BREADCRUMB --> 
<div class="page-header title">
<!-- PAGE TITLE ROW -->
@yield('pageHeader')
</div>
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<!-- END PAGE HEADING ROW -->   
<div class="row">
<div class="col-lg-12">
<!-- START YOUR CONTENT HERE -->
@yield('pageContent')
<!-- END YOUR CONTENT HERE -->
</div>
</div>
<!-- BEGIN FOOTER CONTENT -->   
@include('dashboard.includes.footer')
<!-- END FOOTER CONTENT -->
</div><!-- /#page-wrapper -->   
<!-- END MAIN PAGE CONTENT -->
</div>
</div>
@include('dashboard.includes.scripts')
</body>
</html>
+4
source share
1 answer

JSPs are similar to PHP in this respect, that everything that doesn't really matter is printed literally. Thus, most of your file should be copied to the JSP as it is. I see two types of control statements: @include and @yield.

@include: JSP : <% @include... > < jsp: include > . , , include. - , HTTP-. . , . , StackOverflow, . : https://www.tutorialspoint.com/jsp/include_directive.htm : JSP

@yield: , , , , , . , , , . JSP ( ), bean, . : https://www.javatpoint.com/jsp-useBean-action. , , (https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) JSP. , Spring -MVC Java , , Model ModelMap. JSP ${nameofmodelattribute} ${nameofmodelattribute.property}. : https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-controller

Java-, , - . , , JSP. , , , Java- MVC , , , , , , .

0

All Articles