Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating from JSP: contextPath / pageContext #430

Open
Pique7 opened this issue Feb 10, 2025 · 2 comments
Open

Migrating from JSP: contextPath / pageContext #430

Pique7 opened this issue Feb 10, 2025 · 2 comments

Comments

@Pique7
Copy link

Pique7 commented Feb 10, 2025

For example, I have this absolute url of a local resource in my JSP template:

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resource/css/my_own.css" />
    ...
  </head>
  ...
</html>

What is the recommended way to get the same result in a JTE template?

@casid
Copy link
Owner

casid commented Feb 13, 2025

Hi, usually I just use relative urls, since I only have one context as contextPath would just be empty.

jte itself does not know about how the template is served and doesn't have access to a page context etc.

If this is needed I would add utility methods to resolve paths and pass those to the template.

@Pique7
Copy link
Author

Pique7 commented Feb 15, 2025

Hi, usually I just use relative urls

Meanwhile I also switched to relative paths in my project, but at the first moment it felt as if something is missing when I was not able to use contextPath anymore ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants