How to build Angular6 project while having html,css and js files - java

I am developing a website using angular6 and spring boot with microservice architecture.
I have got the UI from designer team in the form of HTML, CSS, and JS file, whose structure is attached here HTML and CSS files
Also, I had created a angular6 project named DIS, whose structure is attached here Angular6 project
What will be the best way to start with angular 6?
How to include these files in angular6 project considering microservices architecture?

If i understood your question correctly.Yes you can do that.
Step 1: You need to create the Necessary components, Modules needed to build your website.
Step 2: Replace the components with the necessary HTML file and CSS file. As you generate a component with CLI you should have those 2 files just replace them.
When you have global CSS files that can be shared among other files as well. You can configure using Angular CLI.
Regards to microservices architecture, that does not have anything to do with your front end applicaiton, its totally on the server side. But you can consider while creating the components based on the services you have.

ng new ng6-proj --style=scss --routing
Just make changes in the main style.scss that will apply globally.
Images you can keep it anywhere, you just need to use it by providing its path

Related

Dynamic Web Project to Maven Project with customer specific

I have an old Dynamic Web Project. I have a standard version of that project. When I install it, some customers ask for specific changes that I don't want to put in the standard version.
In that case I create a new Dynamic Web Project with all the standard JSP/JS/images and a JAR with all the JAVA programs.
In the Dynamic Web Project structure, I was using this structure to manage the specifics programs:
"JavaSpecific" folder : specific java programs for this customer.
"JavaStandard" folder : if a quick fix was needed in the standard programs without generating a new standard JAR.
"WebSpecific" folder : specific JSP, JS, CSS, images... for this customer.
"WebStandard" folder : all the standard JSP.
The specific files were overwritting the standard ones (even if I have "index.jsp" in WebSpecific and WebStandard, the index.jsp from WebSpecific will be used).
It allow me to know what JSP/JAVA are specific. When we want to update the application with a new version, we know which JSP are specific: we can delete everything in "WebStandard" and "JavaStandard", import the new JAR and JSPs, and check the specific compatibility. That's the main reason why it was made like that: to know what's specific and what standard.
Now my problem : I was aked to use Maven in the future and I did not find how I should manage the specific.
For the JAVA programs: no problem, I can use 2 folders like before.
But for the JSP/JS/images, with Maven, I could not find a way to use 2 folders like I was doing before or anything similar. Everything must be in the "webapp" folder. Is there a way? Or should I manage that totally differently?
Thanks

Spring MVC Carousel

How to make images slider (carousel) in Java Spring MVC.
I have admin panel which upload the images to local drive.
I would like to display images from local drive to JSP page in carousel.
Please guide.
Also I tried one example from the link https://blog.e-zest.com/dynamic-carousel-built-using-javascript/ but I am getting javascript error.
Thanks,
Bhavin
First you need to be able to serve your files to web browser. You can serve files from local drive using tomcat or web server (nginx, Apache httpd etc) built-in features without writing Java code or write a Spring controller to read files form drive and serve them if you need custom logic.
Then you could use one of javascript carousel plugins like Slick or another - there is a great choice of those.
Add needed scripts and css to your page and follow selected plugin instructions to create needed HTML with your JSP page.

How to upload a folder on a web server using Spring?

I am using the Spring MVC framework to create a website. One of the features that I will need to have is the ability to upload a folder.
However, by only using Spring, I can only upload a single file or multiple files. Alternatively, I can ask the user to create a ZIP of the folder to upload, but this would be their responsibility to do that.
Is there a way to, within HTML, select a particular folder? Is there any way to copy that entire folder to a server?
you can use spring multifile feature to upload multiple file.
please refer given link , may help you to solve your problem.
http://howtodoinjava.com/spring/spring-mvc/spring-mvc-multi-file-upload-example/

How to structure multi-page JSP project?

My Java project has multiple JSP (view) pages, which either insert into or query a database. I created the main page and links to each JSP.
I am unsure whether I should put each component of the project (MVC pattern with jsp, servlet, a Java file) into its own web application and its own war file for uploading to the web server. Is this a proper way to build my web project?
If I did this, each component/application would need their own JDBC driver, which seems redundant. I could also group the insert pages together in one application and the query pages in another - would that be a better way to proceed?
I don't see any problem building your war like that, but I prefer using some kind of building tool like Maven, Gradle, etc..
Anyway, If it is a simple dynamic web project with eclipse, you can just put your jdbc driver under your WebContent -> WEB-INF -> lib.
This way, the jdbc driver will be available in your classpath so that basically every java class in your project will be able to use it.

Generating Site maps in java and making them available publicly

I'm using a java framework, Tapestry5. I have millions of pages and I'd like to generate my sitemaps with a nightly cron job rather than dynamically generate them on the fly. The problem I'm facing is I don't seem to know how to place the xml sitemaps dynamically in a directory that can be read publicly. Currently I have a manually written xml sitemap that points to dynamically written ones. The manually written sitemap is placed in the Web Pages / webapp directory along side the robots.txt file. How do I place a file there with java?
It's generally a bad idea to write to areas within your WAR directory. Fortunately, all the popular web and app servers (except perhaps some cloud hosting environments like Google App Engine) have the ability to configure an arbitrary directory on the file system as the path corresponding to particular URL patterns. This gives you the freedom to put the sitemap files anywhere you want.

Categories

Resources