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.
Related
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?
I have created web application in spring.So finally I got requirement to integrate a CMS to my project.I decided to use magnolia with blossom.I am new to magnolia and cms terminology.How should I integrate CMS to spring application.I referred documentation and some examples but I haven't got any clarity on it.So finally what's my doubt is how to integrate magnolia blossom with my spring application with out doing tight coupling.
These are the links I referred Refr Link.
Sample magnolia project Ref Link In this example they have given multi module maven project , in that one module for blossom and one for webapp magnolia.So here I haven't understood how to call my spring application to render my jsp pages or my app associated blog pages.
So please share your ideas or suggestion to implement a cms to spring....
The documentation you link is pretty clear on it
- to get things working you need to deploy Magnolia and your spring app in same war file.
- your spring controller becomes Magnolia page or component template. In case you need dialogs you create those in your code too by annotating appropriate code as a dialog.
- editing/placing of something at give URI/page location is then done via Magnolia using template (controller) found via annotation in your spring code.
If you have concrete issue, it would help to describe it and explain what you tried and what didn't work and where you are actually stuck.
Otherwise you perhaps want to try first few examples of working with just the CMS part of Magnolia and only once you understand that, start merging the two.
I am partly following quickstart tutorial at http://projects.spring.io/spring-roo/#quick-start.
I created an entity class and generated MVC using web mvc all --package ~.web command.
Question I have is that my controller class has scaffolding done using #RooWebScaffold, how do I generate the code for it? Is there a command synonymous to Grails generate all. In grails this command would actually generate actions called update, edit, delete, insert etc with full code which can be edited.
Thanks
Spring Roo generates code in aspects. These aspects are then integrated into the application code using the ajc compiler.
That is why you do not see any code in the controller. In order to see the code in the controller you need to use the Push-In refactoring that is provided by both Eclipse and IntelliJ IDEs.
Keep in my that if you push-in the aspects into the application code, you will no longer be able to add new code to that controller with Roo.
The code generated by ROO is based on AspectJ.
If you want "pure Java code" in order to adapt it after generation
you should try Telosys Tools http://tools.telosys.org
The tutorial for Spring MVC / JPA is here : https://sites.google.com/site/telosystutorial/
I am developing large web project, using IntellijIDEA (11.1.3).
I would like to have some environment, where I will be working under HTML templates. I won't use any server-side programming there, just HTML markup, CSS style sheets and JavaScript.
As well, I need different environment, where I will create dynamic application, using not only markup, style sheets and client-side programming, but also Maven, Spring MVC, Hibernate, PostgreSQL and, probably, other technologies.
I will use Tomcat to deploy both my template and my final application into container to view it in browser.
The question is how to structure my project?
That would be absolutely great if someone could show me step-by-step instructions of creating sample project, but any advises are appreciated.
IntelliJ IDEA 11 has a special Web module type for the plain HTML/JS projects, create one module of this type and another Java module for the rest of the technologies.
I've inherited an incomplete but small web project (Java EE 5, running on WebSphere 7).
The project consists mostly of JSPs that are accessed directly via their URL, and most JSPs look up their own reference to the EJBs (services) they need. Also, there's a Servlet for every form that gets submitted by the HTML code in the JSPs.
Architecturally speaking, is there anything wrong with this?
I was thinking it would be better to have an MVC design. I don't want to convert everything to JSF because I don't want to convert all the HTML and embedded Java scriptlets into JSF tags and managed beans.
I don't really want to use Struts or Spring MVC because they're not part of the Java EE 5 toolkit that comes out of the box with WebSphere, and I don't want to add additional complexity with the additional libs and config files.
I was thinking about building my own little MVC with a "ControllerServlet" that accepts a command and dynamically build and execute the command object, and redirect to the JSP view.
But I ask myself again, is there anything "wrong" with JSPs that post to Servlets? It's actually kind of elegant in its simplicity.
What do you think?
Any suggestions are GREATLY appreciated! Rob
You're asking a rather subjective/localized question. But ala.
There's technically nothing wrong with individual JSPs that submit to individual servlets. The only real problem is when the servlets turn out to contain duplicated code for quite common tasks like collecting request parameters, converting/validating them, setting bean properties, invoking actions, performing navigation. That is not DRY and is what a MVC framework with a single front controller and a well definied lifecycle is supposed to solve.
Or, if the servlet's tasks are actually well refactored with homegrown code to perform those common tasks, then this is in turn not very maintainable as no one else than the original developer knows the ins and outs of this custom framework. So it's hard to find anyone else willing to maintain this webapp without learning another framework again which the new developer wouldn't likely to see in other future webapps. That is why companies usually adopt an existing and well-developed MVC framework like JSF, Spring MVC, Stripes, Struts, etc.