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
I have some CRUD app that connected through hibernate with the database. There is one JSP file in views. Everything is configured in the config XML file. But CSS still doesn't work.
My app running on IntelliJ IDEA 2019.1.2, MySql 8, Spring 5, Tomcat 9. I tried a few different ways to set up in JSP file path to CSS files. But the result always the same. Everything working, but without styles.
servlet config
project structure
jsp file
result
In the png you it seem you are using resourses instead of resources. Also verify in developer tool of your browser the name of resources folder. You can go to sources tab(chrome) or debugger(firefox) and check the folder structure.
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
I have a Web Project which is running on Tomcat7.
When a user uploads a pdf file I want to pass it to another Java Project which can be called by command line (not written by me but by Apache).
Since the Web Project itself is quite huge, I do not want to include the other Java Project inside the Web Project.
Also logically it makes sense to keep the Projects separate.
This is how the flow works - User uploads a pdf file. This is passed to the Web Projects Business Layer. . After getting the details of the pdf from the "other" project I want to save it in the DB via the Web Projects DAO layer.
Can you suggest ways to call the method of another Project?
You can create a wrapper for this command line tool and host it as service. It will be easier for your webcomponent to deal with service. Also all the exception scenario can be handled by service making it easier for your webproject
You can write a shell script and call it from your webproject to invoke another project
Runtime.getRuntime().exec("script.sh");
so now i think i have learned all basics and terminology for java. but what i don´t know is how to code and display a web page with Netbeans in Java.
the most tutorials contains lots of talks about different technologies "Java uses Java Beans, JSP and servlets" and so on. Where can i find short practical tutorials that actually teach me where to code what and then compile and where to put all the files (war, jar, ear..) in Glassfish to be able to see the output from a Web browser. Simples things that makes one understand all these different "layers" which are just classes using classes. Feels like i never get to know how i can put up a web server with Java cause I can´t find this kind of tutorials.
Would be great if someone could send some links to such practical stuff.
Thanks.
This is the first such document I found: http://www.java-tips.org/java-tutorials/tutorials/introduction-to-java-servlets-with-netbeans.html
More:
http://netbeans.org/kb/docs/web/quickstart-webapps.html
http://blogs.oracle.com/jonasdias/entry/webservices_with_jsp_on_netbeans
http://www.fuzzylizard.com/archives/2005/09/18/628/
http://cit.wta.swin.edu.au/cit/subjects/CITP0014/tutorials/netbeans/tomcat/Running_Tomcat_from_Netbeans.html
http://supportweb.cs.bham.ac.uk/documentation/java/servlets/netbeans-webapps/
I even found a small ebook on this (PDF!) http://www.comp.dit.ie/bduggan/Courses/projects/Getting%20Started%20with%20Tomcat%20&%20NetBeans.pdf
How do I code and display a web page with NetBeans in Java?
Let's go! Fire up NetBeans. I'm using NetBeans 6.7.1 with the Java EE stuff installed, and I've got a GlassFish installed and tied up, so I don't have to care about that stuff. Your setup might differ in the details.
Do a File->New Project, and pick "Java Web" from the categories. Select "Web Application" and hit Next. Enter a project name and tweak the location, if liked. Hit Next. The next page should have a server selection drop-down; as hinted above, mine has "GlassFIsh v2.1" selected. That's fine - as long as NetBeans can interact with a Java application server of some sort, this crash course will run okay.
Make a note of the "context path" - this will be based on the project name, and basically forms the base of the URL at which your application will reside. Hit Next. Ignore the next page, for now, which talks about various frameworks, and hit Finish.
Churn, churn. You should eventually see your web project created. It's a very simple application which contains a single JSP file, and that will be open in the main editor. It's got a bunch of HTML in it, and some JSP syntax.
Take a look at the project structure. You've got a "web pages" folder which contains a WEB-INF directory, and an index.jsp file. That's the same file you're looking at. WEB-INF is a standard directory which contains the metadata used to deploy your application, and also the compiled classes that power it.
The only thing you should need to do now, in order to get to the original objective, is to hit the big ol' Run button, or right-click on the project and select "Run" from the menu. NetBeans will compile, and then fire up your application server and deploy the application to it. Finally, your web browser should pop open a new tab with the classic "Hello, world" page in it.
At this point, what do you actually have? You've got an empty web project with a single JSP file in it. You could customise it, but that's maybe not very exciting. What you're really looking at is a basic framework in which you can apply your learning of JSP and of servlets as you get to grips with them.
How to proceed with said knowledge transfer? I recommend a decent book or two. The one I used to get going was "Beginning JSP, JSF and Tomcat Web Development: From Novice to Professional" (Zambon, Guilio; Apress; ISBN 1-59059-904-7), which has a decent beginner's guide to how JSP and servlets work together, and a handy reference guide for the former.
As soon as possible, you're going to want to migrate away from raw servlets and JSP to tying them together in a slightly more flexible way using one of the frameworks I skipped over earlier. I'm not going to tell you which one to learn; there are several pretty decent ones. Try Spring MVC, or Struts. Once again, I'd suggest getting a decent book.
I would start by taking a look at servlets and JSP. I found this book helpful when I read it: Head First Servlets and JSP
Netbeans comes with many sample projects, create a few and browse the source code.
A already working sample is always a good starting-point for your coding.
If you're also interested in using Eclipse, which makes it very simple to create and deploy web applications here's a nice tutorial - WTP Tutorials
Hi to start code and setting up web server with java follow the following procedure.
First you need to install Apache-Tomcat or Jetty any web container or servlet container.
And you have set the classpath of servlet-api.jar file.
Next you will have to save your web-page code stuff in web-apps folder of tomcat.In web-apps folder there you have to create a web-inf folder in which web.xml file is stored.And after writing servlet and jsp programs the compiled class files are stored in classes folder of web-inf folder.JSP files are stored along with WEB-INF folder.
You have to keep all the jar files in LIB folder of classes folder.
The web container will take care of initalizing servlet, loading class using inti method.Using service method it will create two objects request and response.
The Java EE stack is quite a mouthful. I suggest you just look at writing a Web Application (WAR), and deploy it to Tomcat.
Unfortunately doing a full WAR-file deployment is rather tedious so you generally want some help from your IDE or the web container.
The easiest place to start is probably installing and starting Tomcat and then fiddle with the files in the file system. There is an example application.