P
P
P_Alexander2018-03-27 18:46:31
Java
P_Alexander, 2018-03-27 18:46:31

Why doesn't ${pageContext.request.contextPath} work?

Server WildFly
pom.xml
Also connected to jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

The page itself is in -WEB-INF/views/login.jsp
<dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
    </dependency>

      <dependency>
          <groupId>jstl</groupId>
          <artifactId>jstl</artifactId>
          <version>1.2</version>
      </dependency>

      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>jsp-api</artifactId>
          <version>2.0</version>
          <scope>provided</scope>
      </dependency>

Why does this not work - ${pageContext.request.contextPath}/loginif more specifically then
<li><a href="${pageContext.request.contextPath}/login">Login</a></li>
, As a result, I see in the browser -
http://localhost:8080/WebSiteGame/$%7BpageContext.request.contextPath%7D/login
. When I wrote on Tomcat, it worked with a bang! Of course, I'm not sure that this is connected with the server, maybe I didn't connect something!?! What is the problem please tell me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
P_Alexander, 2018-03-27
@P_Alexander

So I gave ....))) I forgot to add a header to web.xml)))

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question