Is it possible to combine JSTL & Sightly components on a page in AEM6? - jstl

I have currently only developed on CQ5 and I'm starting with AEM6 was wondering if you can combine JSTL written components with Sightly written components on a page.
We are considering to upgrade, but we don't want to rebuild all components immediately.

You can use components that are written in sightly on the same page as components that are written in jsp. You can have a component that has a sightly file that includes a jsp file, or a jsp file that includes a sightly file. You cannot have a single file that uses both jsp and sightly.

Related

Replace JSP with Thymeleaf in Legacy Application

My company wants to level up by deploying our web-application as spring boot executable jar:
Specifications (Legacy Webpap):
classic web app (25 years old) but now with Spring
Over 100 jsp files
And more jsp files generated by our custom jsp generator
Custom jsp tag lib with more than 30 java classes
All jsp files are html 4 files with Active X components.
Problem
One of the main problems is that jsp rendition is not supported in executable jars. Therefore I consider using Thymeleaf. My best guess is to replace the rendition process in our custom jsp generator. In the future (don't know when that is) we plan to migrate to a single page web app but for now I need to run the web app as jar and with our existing templates and tag library.
Draft
My Question
Is it possible to use Thymeleaf along with our custom tag library?

How to implement Vue.js applications with Spring MVC or other server-sided frameworks?

I've already read the official Vue.js documentation about building app. What I understood is, by using vue-cli, *.vue files are built (or compiled ?) into a javascript file which is injected in index.html file.
What if I don't have any index.html ? In my current application, html documents are built at runtime from jsp template files, how can I have Vue inject js and 'asset' built files into a chosen jsp template ?
Plus, node server should be used in development mod, is this mandatory ?
I would copy the generated javascript file and put it in the public/static folder. Then on the jsps that would use it, just add a script tag that would point to it and the empty div#app.

Difference between spring JSP MVC and Thymeleaf MVC

What is the difference between spring JSP MVC and Thymeleaf MVC? Which one is best way for spring web design ?
Both of them are view layers of Spring MVC. Firstly, the very basic difference is the file extensions. (.jsp & .html)
Branislav in the comments is right, JSP is not a template engine. It's compiled to the servlet and then the servlet is serving web content. On the other hand, Thymeleaf is a template engine which takes the HTML file, parses it and then produces web content which is being served.
Thymeleaf is more like an HTML-ish view when you compare it with JSP views.
We can use prototype code in thymeleaf : http://www.dineshonjava.com/2015/01/thymeleaf-vs-jsp-spring-mvc-view-layer.html#.WEkLzLKLTig
Since it is more HTML-ish code, thymeleaf codes are more readable (of course you can disrupt it and create unreadable codes, but at the end, it will be more readable when you compare it with .jsp files)
Standard Dialect (The expression language) is much more powerful than JSP Expression Language
If we put all this to an edge, thymeleaf is the slow one here.
I would suggest you to take a look at this doc : http://www.thymeleaf.org/doc/articles/thvsjsp.html
Thymeleaf is template resolver that process template and produce pure html.
Thymeleaf is way better in my opinion because it have good underlying priciples and exploits natural behaviour of browsers.
Jsp makes html hard to read, it becomes weird mixture of html and java code which makes a lot of problems in comunication between designer - developer.
Thymeleaf preserves html and only adds tags that are intuitive and very expressive. It enables you to work in offline mode and it works great with spring and I definitely recommend it above jsp.
http://www.dineshonjava.com/2015/01/thymeleaf-vs-jsp-spring-mvc-view-layer.html?m=1

Can we run Java code review rules on scriptlets in jsp pages?

We have implemented automated code review in our project using SonarQube. We have some legacy application where all the coding was done on JSP pages. We will eventually migrate them to MVC design using Spring, but for now we have to do a code review for the existing java code inside JSP pages.
My question is: can we run Java rules on JSP files? If yes, how do we start with that?
No, you cannot analyze Java code inside JSP files.

What is sitemesh

I have seen Sitemesh used with Spring and Freemarker(FTL). So I want to know what is Sitemesh and its use with FTL, with example.
#see: http://www.opensymphony.com/sitemesh/
What Is It?
SiteMesh is a web-page layout and decoration framework and web- application integration framework to aid in creating large sites consisting of many pages for which a consistent look/feel, navigation and layout scheme is required.
SiteMesh intercepts requests to any static or dynamically generated HTML page requested through the web-server, parses the page, obtains properties and data from the content and generates an appropriate final page with modifications to the original. This is based upon the well-known GangOfFour Decorator design pattern.
SiteMesh can also include entire HTML pages as a Panel within another page. This is similar to a Server-Side Include, except that the HTML document will be modified to create a visual window (using the document's Meta-data as an aid) within a page. Using this feature, Portal type web sites can be built very quickly and effectively. This is based upon the well-known GangOfFour Composite design pattern.
SiteMesh is built using Java 2 with Servlet, JSP and XML technologies. This makes it ideal for use with J2EE applications, however it can be integrated with server-side web architectures that are not Java based such as CGI (Perl/Python/C/C++/etc), PHP, ColdFusion, etc...
SiteMesh is very extensible and is designed in a way in which it is easy to extend for custom needs.
sitemesh is a web page layout framework.
OpenSymphony doesn't seem to be around anymore, so the best documentation for Sitemesh I've seen is available through their Wiki and as the Readme on their Github repository.
I would caution that if you're interested in using Sitemesh, or at least understanding its structure in a project, Sitemesh2 and Sitemesh3 have significant differences in their structure and implementation, though they work conceptually the same way.

Resources