I wrote a jsp script to display Tomcat, Servlets and JSP versions.
I am using Eclipse / STS 4.
This is my script :
<%#page import="javax.servlet.jsp.*" %>
<!DOCTYPE html>
<html>
<body>
<h2>Hello World START !</h2>
The current date is <%=new java.util.Date() %>
<br>
Tomcat Version :
<%= application.getServerInfo() %><br>
Servlet Specification Version :
<%= application.getMajorVersion() %>.<%= application.getMinorVersion() %> <br>
JSP Version:
<%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %>
</body>
</html>
Result of the previous code is as follow :
Hello World START !
The current date is Sun Aug 14 17:21:46 CEST 2022
Tomcat Version : Apache Tomcat/10.0.21
Servlet Specification Version : 5.0
JSP Version: 3.0
However, my code has two errors in my IDE :
line 1 : The import javax.servlet.jsp cannot be resolved.
line 14 : JspFactory cannot be resolved
I used pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org
/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.incvision.springwebflow</groupId>
<artifactId>SpringWebFlowStart</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SpringWebFlowStart Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>SpringWebFlowStart</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
How to clean this code to remove indication error code in problems ?
Thanks.
Both your project and Tomcat 10 support Jakarta EE.
The javax.servlet package is part of Java EE. If you want that, modify your project and run on Tomcat 9.
From https://tomcat.apache.org/whichversion.html:
*Apache Tomcat 10.0.x builds on Tomcat 9.0.x and implements the Servlet 5.0, JSP 3.0, EL 4.0, WebSocket 2.0 and Authentication 2.0 specifications (the versions required by Jakarta EE 9 platform).
[...]
Apache Tomcat 9.x builds on Tomcat 8.0.x and 8.5.x and implements the Servlet 4.0, JSP 2.3, EL 3.0, WebSocket 1.1 and JASPIC 1.1 specifications (the versions required by Java EE 8 platform).*
Related
On building my spring boot app using mvn clean package, the final artifact that is getting built, myapp.jar, is not having the version number included in the jar name.
What change should i do to get the artifact verion number to be part of jar.
The relevant part of pom.xml is as below -
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycomp</groupId>
<artifactId>myapp</artifactId>
<version>2.6.0</version>
<name>myapp</name>
<description>
<![CDATA[]]>
</description>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<springboot.version>2.5.6</springboot.version>
</properties>
<dependencies>
<!-- Spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.12</version>
</dependency>
...
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
<build>
<finalName>gitlab-finder</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
</plugin>
</plugins>
</build>
</project>
Note: I created a new spring boot project using spring starter (through sts), and for this new project the jar has artifact version included in the jar name by default. So wondering if this a default feature why is this not the case for my project (by the way, i am maintainer of this project not the creator but i have to add this feature of including version number to jar name.)
You are overwriting the default behaviour of generating project names. This is because you define the finalName tag.
From the docs:
finalName: This is the name of the bundled project when it is finally built (sans the file extension, for example: my-project-1.0.jar). It defaults to ${artifactId}-${version}.
In your case it is defined as <finalName>gitlab-finder</finalName> which does not contain the version of the project. You either add ${version} to it <finalName>gitlab-finder-${version}</finalName> or remove the finalName tag.
I am just trying to create a simple Mail Application in Java.
And have found out how to code it, but I seem to have some problems with my imports.
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
IntelliJ recommends adding Jave EE 6 JARs to module dependencies. But it just did not help! Maybe you know what to do.
The Answer by Mustafa seems correct but is outdated.
Jakarta EE
JavaEE was owned by Oracle Corporation. JavaMail was part of JavaEE, one of the few dozen technologies housed there.
Years ago, Oracle transferred ownership to the Eclipse Foundation.
The name changed from JavaEE to Jakarta EE.
JavaMail changed its name to Jakarta Mail.
In the latest versions, the package names have changed from javax.* to jakarta.*.
Jakarta Mail
Spec
Find the Jakarta Mail specifications list. The current version is Jakarta Mail 2.0.
Implementation
At least one implementation exists: Eclipse Jakarta Mail.
Others are free to write implementations as well. I do not know if anyone has or not.
Example
I have not used Jakarta Mail myself, but your Question made me curious. So I put this dependency:
<!-- https://mvnrepository.com/artifact/com.sun.mail/jakarta.mail -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<version>2.0.1</version>
</dependency>
… into this Maven POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns = "http://maven.apache.org/POM/4.0.0"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>work.basil.example</groupId>
<artifactId>JMail</artifactId>
<version>1.0-SNAPSHOT</version>
<name>JMail</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.mail/jakarta.mail -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
… to create a little project. I added the Registry class from here, a link provided here.
Minor note: I fixed a typo to change the class name from registry to Registry per Java naming conventions.
Notice the imports on that file use jakarta.* package naming.
import java.util.*;
import jakarta.mail.*;
import jakarta.mail.internet.*;
That Registry class compiles, but I did not run it.
Deployment
If you are writing a standalone app, you need to include a JAR containing an implementation. You would ship that JAR as part of your app, provided you can abide by its license.
If you are writing a web app or web service to be deployed on a Jakarta EE service, then you would change your Maven POM to use the Jakarta Mail APIs alone without an implementation. The implementation would be provided at runtime by the Jakarta EE compliant server product you chose for deployment.
Download JavaMail Release
In addition, the JavaMail jar files are published to the Maven
repository. The main JavaMail jar file, which is all most applications
will need, can be included using this Maven dependency:
If you use Maven,
<dependencies>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
You can find all of the JavaMail jar files in both the java.net Maven
repository, and in Maven Central.
Otherwise download the javax.mail jar and add it to your libs/classpath:
https://maven.java.net/content/repositories/releases/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2.jar
I keep getting this error while trying to deploy an application to AWS:
An internal error occurred during: "Updating AWS Elastic Beanstalk environment:
SampleWebApplication".
javax/xml/bind/JAXBException
Here is what I do:
I create new Maven project based on maven-archetype-webapp 1.0
I configure the pom.xml file with dependencies (full file below)
I type in whatever to index.jsp (it's supposed to be super easy application)
I run it on tomcat7:run, it works like a charm on http://localhost:8080/
I create AWS Server
I select the project, I choose Amazon Web Services Tool --> Deploy to AWS Elastik Beanstalk, choose the added server and I keep getting this message:
I am not able to find any information about this error in the internet. The only thing that I have found is that it is connected to Java version, but I am running Java 1.8 (as was suggested in one post that I found).
Can anyone please help me? I am following this instruction for deployment of the application.
I'm super new to AWS so I don't even know where to start!
index.jsp
<html>
<body>
<h2>Hello There!</h2>
</body>
</html>
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dominikazb</groupId>
<artifactId>SampleWebApplication</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>SampleWebApplication Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<tomcat.version>7.0.50</tomcat.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<build>
<finalName>SampleWebApplication</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<wtpversion>2.0</wtpversion>
<wtpContextName>todo</wtpContextName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<verbose>true</verbose>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<contextReloadable>true</contextReloadable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webappDirectory>${project.build.directory}/${project.artifactId}
</webappDirectory>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
</build>
</project>
Project structure
Please, please, please help!
Finally, I find an answer to this problem in the website:
https://github.com/aws/aws-toolkit-eclipse/issues/123
The examples there were in Unix. Mine is in Window 7. What I did base on the website suggestion is:
Find where is the file jaxb-api-2.2.5.jar located. I am not sure if version 2.2.5 is a must. Suggest try whatever you have.
Mine is located in
C:\Users\myUserName\.m2\repository\javax\xml\bind\jaxb-api\2.2.5.
Exit the Eclipse IDE.
Open PowerShell in Admin mode.
cd to your user directory (my case C:\Users\myUserName) and execute the following command to open the Eclipse IDE with a -dev option which points to the jaxb-api-2.2.5.jar.
C:\Users\myUserName\eclipse\jee-2020-09\eclipse\eclipse -dev $(ls ~/.m2/repository/javax/xml/bind/jaxb-api/*/*[0-9].jar | Select-Object -Last 1)
Certainly, the location of your eclipse.exe can be different.
Happy coding!
I'm using Java 11 (Maven project) for mongodb Free Tier Cluster (Version 4.0.13). I'm trying to connect via connection-string (for 3.6 drivers or later) like:
mongodb+srv://user:pass#cluster0-ox90k.mongodb.net/test?retryWrites=true&w=majority
and by the same way via connection-string (for 3.4 driver or later):
mongodb://user:pass#cluster0-shard-00-00-ox90k.mongodb.net:27017,cluster0-shard-00-01-ox90k.mongodb.net:27017,cluster0-shard-00-02-ox90k.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority
I've already tested different dependencies for java drivers like: mongodb-driver-sync (ver. 3.11.0), mongodb-driver-sync (ver. 3.10.0) , mongodb-driver-sync (ver. 3.8.0).
Maven dependency looks like this:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>3.11.0</version>
</dependency>
Also I tried to use mongo-java-driver via connection-string for 3.6 or later drivers/3.4 or later and versions like: 3.11.0, 3.10.0, 3.8.0, 3.7.0.
Maven dependency looks like this:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.11.0</version>
</dependency>
And I'm getting always the same issue:
Exception in thread "main" com.mongodb.MongoCommandException: Command failed with error 8000: 'no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.' on server cluster0-shard-00-01-ox90k.mongodb.net:27017. The full response is { "ok" : 0, "errmsg" : "no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.", "code" : 8000, "codeName" : "AtlasError" }
at com.mongodb.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:164)
at com.mongodb.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:286)
at com.mongodb.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:247)
at com.mongodb.connection.CommandHelper.sendAndReceive(CommandHelper.java:84)
at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:34)
at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:91)
at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:51)
My current POM is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test_project</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<!-- jsoup HTML parser library # https://jsoup.org/ -->
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.11.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>project.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Any ideas how to solve the issue will be appreciated.
I had the same issue using a Docker image from adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim. Since I've upgraded to adoptopenjdk/openjdk11-openj9:jdk-11.0.5.10-alpine-slim, my connection to MongoDB is OK.
Java 8
I've changed Java 11 to Java 8 and it solved the issue. Looks like Java 11 doesn't support SNI. Because all attempts were unsuccessful despite the fact that I used the latest drivers.
Java 11
Thanks to clarification by Virg, I've changed version of Java 11, but also the license. I had Java 11 using Java Development Kit builds (from Oracle) - as sourse. Then I've installed another license as Azulu using JDK version 11.0.5+10 and it also solved the error.
I'm following a tutorial on Udemy that explains JSPs and Servlets:
https://www.udemy.com/jsp-tutorial
The tutorial uses Eclipse + Tomcat server.
Since I'm an IntelliJ and Maven user I wanted to set up my environment using these two. So I created a Maven project from the following archetype: "org.apache.maven.archetypes:maven-archetype-webapp" and configured my POM as folllows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SomeGroupId</groupId>
<artifactId>HelloWorldJavaServerPages</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>HelloWorldJavaServerPages Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>HelloWorldJavaServerPages</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>Tomcat85Localhost</server>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
</plugins>
</build>
</project>
Set up my other properties as described here:
Tomcat 8 Maven Plugin for Java 8
I am able to build my project and use the tomcat plugin to deploy to the tomcat server (or manually drag the war file in the webapps folder).
Problem is that when I have the following two files:
student-form.html
<html>
<head><title>Student Registration Form</title></head>
<body>
<form action="student-response.jsp">
First name: <input type="text" name="firstName" />
<br/>
Last name: <input type="text" name="lastName" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
student-response.jsp
<html>
<head><title>Student Confirmation Title</title></head>
<body>
The student is confirmed: <%= request.getParameter("firstName")%> ${param.lastName}
</body>
</html>
The request.getParameter method works, but the ${param.lastName} does not and it simply shows up as plain text in the browser: ${param.lastName}.
Using Eclipse (without Maven) it does work for both, so I'm wondering what I'm doing actually different/wrong here and why it is not working.
Thanks in advance for your help.
Once I found out that the references between the braces are called the "Expression Language", I decided to do another search on stackoverflow and found this:
Expression Language in JSP not working
Changing the web.xml as described in the link above made it work.
Thank you all for reading my question, the answer was quite simple actually.