dir.by  
  Search  
Programming, development, testing
Java
Java web application (servlet, jsp page, basic functionality and no frameworks)
Creating a new simple web application (jsp web page) | Java, Maven
  Looked at 1406 times    
 Creating a new simple web application (jsp web page) | Java, Maven 
last updated: 10 April 2025
Here's my jsp page:
  File index.jsp
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
Start the project and open the link:
http://localhost:8080/MyWeb1
We see that our web page is working on the way
Download an example:
MyWeb1.zip ...
size: 40 kb
 
Note! You must have Java JDK installed. If you don't have it, then need to download and install Java JDK ...

Note! You must have IntelliJ IDEA Ultimate installed. If you don't have it, then need to download and install IntelliJ IDEA Ultimate ...

Note! You must have Tomcat Web Server installed. If you don't have it, then need to download and install Tomcat Web Server ...
Step 1. Creating a new project
 
Select the project: Maven Archtype
Choose the type: webapp
 
The project was created:
jsp A file is a web page.
Let's try to run the project:
Click on the green triangle
The Edit configuration window with the default configuration appeared.
At the bottom, we see an error Error: Module is not selected
Step 2. To launch this web project well, you need to add a web server (add the Smart Tomcat plugin, this is a lightweight web server)
Click on Edit Configurations
 
Click on +
click on Smart Tomcat
Note! If there is no Smart Tomcat in the list, then You need to install Smart Tomcat plugin in Intellij Idea ...
 
A window appeared with the configuration for Smart Tomcat
I don't change anything, click on OK
Step 3. Launching the project
Click on the green triangle
The application starts and sees the command in Console:
C:\Users\echig\.jdks\openjdk-22.0.1\bin\java.exe "-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0"
-Dcatalina.base=C:\Users\echig\.SmartTomcat\MyWeb1\MyWeb1
-Djava.io.tmpdir=C:\Users\echig\.SmartTomcat\MyWeb1\MyWeb1\temp
-Djava.util.logging.config.file=C:\Users\echig\.SmartTomcat\MyWeb1\MyWeb1\conf\logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2024.3\lib\idea_rt.jar=55900:C:\Program Files\JetBrains\IntelliJ IDEA 2024.3\bin"
-Dfile.encoding=UTF-8
-Dsun.stdout.encoding=UTF-8
-Dsun.stderr.encoding=UTF-8
-classpath "C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\tomcat-juli.jar"
org.apache.catalina.startup.Bootstrap start
This means that the web server will be terminated Tomcat
Click on the link:
http://localhost:8080/MyWeb1

We see that our web page has been launched on a web server:
 
← Previous topic
Directly in the code (at runtime) we make an implementation for the interface | Java
 
Next topic →
Create a web servlet (the servlet is located on the web server, returns the result on request) | Java
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

  Объявления  
  Объявления  
 
Download and install
Installation JDK (download and install the Java library for Windows)
Download and install IntelliJ IDEA to explore Java, Spring, Jakarta EE | Functionality and differences: Community | Ultimate
Learn the language Java (class, interface, properties, etc.)
Create a simple console app in IntelliJ IDEA to learn Java
What is interface in Java ?
Directly in the code (at runtime) we make an implementation for the interface | Java
Java web application (servlet, jsp page, basic functionality and no frameworks)
Creating a new simple web application (jsp web page) | Java, Maven
Create a web servlet (the servlet is located on the web server, returns the result on request) | Java
Installation Tomcat web server (download and install for Windows)
Check, test Tomcat web server (create a new my.hml file)
What is Maven
What is a dynamic web page jsp (Java Server Page) ?
How to install Smart Tomcat plugin in Intellij Idea
Error "The SDK is not specified for module ... | Project SDK is not defined ..." in IntelliJ IDEA | Java
Spring in Java (Spring Framework, Spring Data, Spring Boot, ...)
What is Spring? Why use Spring in Java?
What is Spring Bean? What is Spring Container? IoC (inversion of control) | Creating a simple Spring project and configuration Spring Container in an XML file | Editor IntelliJ Idea and language Java
What is Dependency Injection in Spring? Creating a simple Spring project with Dependency Injection in the constructor with the attributes @Component, @Autowired | Editor IntelliJ Idea and language Java
Creating a new Spring web application (Controller responds to request) | Java, Spring Web, Spring Boot, Maven
Creating a new Spring WebSocket application (Java WebSocket sends a message to the JavaScript WebSocket) | Java, Spring WebSocket, Spring Boot, Maven
Create Azure Web App with the type Java (free). That is, create an empty web server
Put the Java Spring web application in Azure
Connect to the application Azure Web App (Java) via FTP | use File Explorer
Error "The SDK is not specified for module ... | Project SDK is not defined ..." in IntelliJ IDEA | Java, Spring Boot
How to install Spring WebSocket plugin in Intellij Idea
Jakarta EE / Java EE in Java (Web Applications, Web Services)
What is Jakarta EE (Java EE)? | In which editor (program) is it convenient to write Jakarta EE (Java EE) code?
Creating a simple web project in IntelliJ Idea Ultimate | Jakarta EE (Java EE)
Struts in Java (extends API Java Servlet using MVC)
What is Struts | Java
Interviews on Java

  Ваши вопросы присылайте по почте: info@dir.by  
Яндекс.Метрика