Netbeans + Xampp(tomcat)→JSP

Netbeans + Xampp(tomcat)→JSP

GitHub URL
Text
Tags
Live
Created
Aug 1, 2022 06:50 PM

🚀Setting up Netbeans

 
  • From the file menu select "New Project" -> "Java Web" -> "Web Application”
  • Change the Project Name and add project location
  • Click on the server and select "Add server" → Apache Tomcat
  • Choose the Server Location (for xampp users : “C:\xampp\tomcat” )
  • Set username and password

JSP file creation

  • Under Web Pages→ index.html (delete the file)
  • select the project →right click→new→JSP→ create new JSP file (newjsp.jsp) (! outside the folder)
  • Execute the JSP page by clicking Shift+F6
 
HTTP 404 - file not found error

⚡Solution 1 : Manual setup

 
go to the project→right click→properties→run→Relative URL→mention the jsp file path
notion image
The url can be changed manually in the browser specifying the jsp file name
 

⚡Solution 2 : Shift+F6 to run JSP file

 
Project→ right click on Properties→compiling→uncheck compile on save
 
Open:
[YOUR PROJECT DIR]/nbproject/build-impl.xml
And remove or comment out these 2 lines:
<arg value="-compilerSourceVM ${javac.source}"/> <arg value="-compilerTargetVM ${javac.target}"/>
 
Now insert this in build-impl.xml
<property name="endorsed.classpath.cmd.line.arg" value="--patch-module  java.base='${toString:endorsed.classpath.path}'"/>
 
OR
in project.properties , simply set empty value to
endorsed.classpath=
 
Note : Change any one of the files in solution 2
 

Reference🗒️