JSP Parameters not accessible using ${param.xxx} using HTML form - java

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.

Related

Check jsp version with Tomcat

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).*

HTTP Status 404 - not found - Java Spring MVC

I'm trying to run my first Spring MVC Program on eclipse using XML configuration, I have no error markings on my directory but I get this response when I run the program. I also tried with Spring java configuration and got similar response.
bug
I use eclipse Version: 2021-06 (4.20.0) and apache-tomcat-10.0.13 installed on my device, sending a request at http://localhost:8080/ returns apache-tomcat successfully installed. So far I have tried all suggestions I found online including updating maven project, maven build-clean install, cleared file cache, deleted temp folder in my root director changed workspace directory, uninstalled and reinstall apache-tomcat multiple times, cleared missing files on source directory in java build path but none of this approaches have worked. Below is a screenshot of my program (XML configuration)
Directory
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.idevelope</groupId>
<artifactId>spring-mvc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Spring MVC</name>
<description>Spring MVC example</description>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.3.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>16</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</build>
</project>
web.xml
dispatcher-servlet.xml
controller
user.java
(View Pages)
home.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Spring MVC tutorial - Home JSP</title>
</head>
<body>
<h1>Hello World!</h1>
<h4>Message- </h4><span>${message}</span>
<form:form action="showUser" modelAttribute="user" method="post">
<tr>
<td>
<form:label path="firstName">First Name</form:label>
</td>
<td>
<form:input path="firstName" id="firstname" />
</td>
</tr>
<tr>
<td>
<form:label path="lastName">Last Name</form:label>
</td>
<td>
<form:input path="lastName" id="lastname" />
</td>
</tr>
<input type="submit" value="Submit">
</form:form>
</body>
</html>
user.jsp
Please I need help to fix this bug.
In my case and as i searched internet - tomcat 10 does not work. I downloaded tomcat 9 and 404 disappeared. Spring MVC 5 does not work on Tomcat 10. This is because Tomcat 10 is based on Jakarta EE 9 where package names for APIs have changed from javax.* to jakarta.*.
maybe lack
*<mvc:annotation-driven/>*Annotation-driven injection (e.g. Controller, #requestMapping, etc.) results in a page always indicating that the relevant resource information cannot be accessed
You write, you try to run your first spring program with Spring MVC. I did not dive into your details, but I would suggest two different approaches to learn and play around with Spring MVC:
Spring initializer web site
When I try out new spring parts, I always start at
https://start.spring.io/
and just add my wanted dependencies (search for mvc when pressing add button).
After defined your setting there, you can just download a working maven or a gradle example directly from the web page as a zip file. After extraction the files can be directly imported by IDE (e.g. eclipse, intelliJ, etc.)
Official Spring MVC tutorial
When you are searching a good and out-of-the-box working MVC example you should look at https://spring.io/guides/gs/serving-web-content/
This works well and you can start directly without dependency problems etc.
Try adding tomcat jasper dependency to pom.xml
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>10.1.0-M5</version>
</dependency>
check tomcat version before adding the dependency

Application.properties not being found

Application.properties doesn't get pick up.
Very small program not sure what's wrong, I've google and did research.
But when I use this code in FirstController.java it does work....
return new ModelAndView("/WEB-INF/jsp/welcome.jsp","dateAndTime",dateAndTime);
FirstController.java
package com.vpp.fleetman.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.Date;
#Controller
public class FirstController {
#RequestMapping("/home.html")
public ModelAndView firstPage(){
Date dateAndTime = new Date();
//This work, I just want to remove the hard coded and use application.properties
// return new ModelAndView("/WEB-INF/jsp/welcome.jsp","dateAndTime",dateAndTime);
//Let's use a view resolver for the views
return new ModelAndView("welcome","dateAndTime",dateAndTime);
}
}
webapp/WEB-INF/jsp/welcome.jsp
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<h1>Welcome from Intelij ..... Time is: ${dateAndTime} </h1>
<c:forEach var="i" begin="1" end="5">
<p>${i}</p>
</c:forEach>
application.properties the default one that is set with the facet
sping.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.virtualpairprogrammers</groupId>
<artifactId>fleetman</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>fleetman</name>
<description>VPP Fleet Management Application</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I get this error when I http://localhost:8080/home.html
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Apr 27 13:57:24 EDT 2021
There was an unexpected error (type=Not Found, status=404).
/welcome.jsp
As soon I use the reference to application.properties it doesn't work... vs when I keep the hard coded ref ?? any guidance would be appreciated.
Thanks for your suggestion.
The answer is what Luke Woodward propose... in the file application.properties.
Typo Error.
Sping.mvc.prefix:/WEB-INF/jsp/ vs spring.mvc.view.prefix:/WEB-INF/jsp/
I've also tried with : and = and both work.
Thanks for your support appreciated.

Problems running react js in java spring mvc

I'm learning to use React and wanted to use it in a SpringBoot application, but I just can't seem to get this working.
I can create a website using Spring-MVC and also execute JavaScript code on it (without React, JSX). But I just can't figure out how to use JavaScript code that uses React.
What I got working so far is...
A website with a Spring-MVC backend
Executing javascript code on this website
Building a jar of the application using maven
Creating a React project inside my spring project using the create-react-app tool
Compiling the React code using a maven plugin (following this tutorial) (or at least I think it's working, because maven says that the build is successfull)
Loading the React js script in the browser
What is not working is...
Executing the React js script in the browser or debugging the script
The simple React code I want to execute looks like this: test.js
import React from "react";
import ReactDOM from "react-dom";
export default function TestComponent() {
return <div>
<p>Hello There!</p>
</div>;
}
debugger;
ReactDOM.render(<TestComponent />, document.getElementById('hello_there'));
alert("Hello There!");
It should just add some text into the html file to show it's working, but it doesn't. The html (thymeleaf) file looks like this: home.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Go Server - JFabricationGames</title>
</head>
<body>
<h1>JFG - Go Server (WIP)</h1>
<img th:src="#{images/welcome.png}" width=500 />
<br>
<a th:href="#{/login}">Login</a>
<div id="hello_there"></div>
<div id="hello_there_2"></div>
<script src="test.js"></script>
<!-- <script src="test_no_react.js"></script> -->
</body>
</html>
And my Spring project looks like this:
and is build using this 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>net.jfabricationgames</groupId>
<artifactId>go_server_spring</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>go_server_spring</name>
<description>A Go Server</description>
<properties>
<java.version>1.8</java.version>
<frontend-src-dir>${project.basedir}/src/main/app</frontend-src-dir>
<node.version>v12.3.1</node.version>
<yarn.version>v1.16.0</yarn.version>
<frontend-maven-plugin.version>1.7.6</frontend-maven-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin.version}</version>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<yarnVersion>${yarn.version}</yarnVersion>
<workingDirectory>${frontend-src-dir}</workingDirectory>
<installDirectory>${project.build.directory}</installDirectory>
</configuration>
<executions>
<execution>
<id>install-frontend-tools</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
</execution>
<execution>
<id>yarn-install</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>build-frontend</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>position-react-build</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<outputDirectory>${project.build.outputDirectory}/static</outputDirectory>
<resources>
<resource>
<directory>${frontend-src-dir}/build</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
If you want to have a look at the full project code you can find it on GitHub: https://github.com/tfassbender/go_server_spring/tree/react_test_2
Now when opening the website in the browser (firefox 72.0.2 (64-Bit)) and using the developer tools I can see that the script was loaded and I can even see the script code:
But what is strange is that I can't seem to debugg the file or even find the file in the debugger...
... although it is loaded and even seems to be executed, because the developer tools show an error in the first line of the script (in the image above).
And what is also kind of strange to me is that the script (test.js) that I can see in the browser (when opening it from the network tab of the developer tools) shows exactly the react code from the test.js file. I would expect it to be compiled to ES5, but I'm very new to React so I don't realy know if this is a problem or an expected behaviour.
So basically the problem is that I can't debugg my javascript/React code and I'm not shure whether I load the correct file or even compiled it correctly (because I'm realy new to React). In fact I have no idea what's going on here and what the problem might be.
So any help would be great.
The issue here seems to be that you want to run the javascript output by create-react-app on the build, but actually, you're just running a static file test.js which is in the src/main/app/public directory.
This test.js file is not touched by create-react-app at all, so you're right that it's not being compiled to ES5, it's simply being served statically as it is. The error you're seeing in Firefox is exactly because of that - it can't handle the import statements (fixing this directly is a separate issue which I won't get into here, but essentially you won't have this problem with the create-react-app compiled code because it'll be bundled and transpiled to ES5).
Only the code with the entry point at src/main/app/src/index.js will be compiled by create-react-app and indeed it is, and then as per your pom.xml configuration is then copied into target/classes/static/static/{bundle files}.js.
What you want to do is link to those create-react-app generated bundle files, instead of this test.js file. Whatever React code those built bundles contain will run just fine. It's unclear what the role of test.js is here, but to conclude, it's simply not being compiled at all and that's the cause of the error, nothing to do with React per se. You should just delete it and link instead to your create-react-app generated bundles.

How can i use taglib in JSP page

I know this problem has been posted many times but every solutions that have been posted didn't solve my problem whereas my issue is the same.
I have a JSP page and i want to use taglib in. So i added this line in it :
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
My project runs with maven 2 so i included in pom.xml that dependency too :
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
Here is the line which in the web.xml :
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee `enter code here`http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
And now, here is the error i Get whatever i try :
org.apache.jasper.JasperException: L'uri absolute: http://java.sun.com/jsp/jstl/core cannot be resolved in the file web.xml or in the others files jar deployed with this application
When I build the project, there is still nothing in web-inf/lib...
Am I doing something wrong ? I mean, once i have the configuration i put in my last post, i do on my project a "maven build", it displays on my screen "build success", then i launch tomcat and enter the url of my asp and it prints the error i gave above...
Here is my entire pom.xml given that you told me somethind could go wrong with it:
<modelVersion>4.0.0</modelVersion>
<groupId>CapG</groupId>
<artifactId>CapG</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
Once you get your packaged war file through maven verify that you have the required jstl-1.2.jar in your WEB-INF/lib directory. If not, perhaps something needs to be fixed in your pom.xml.
EDIT: Try adding <packaging>war</packaging> (before build) in your pom.xml.

Categories