JSTL not working in maven [message #1836300] |
Mon, 28 December 2020 17:51 |
Jim Whitaker Messages: 26 Registered: October 2020 |
Junior Member |
|
|
No problem with servlet, but jstl is not working in a maven web project in eclipse.
I did the same servlet and jsp page in netbeans 12.2 chose maven wep project, so same exact code no difference works in netbeans, same tomcat server also.
And I tried many suggestions from stackoverflow post, I mean at least 15 stackoverflow post.
I even tried to add the tag libraries as "add external jars". did the "pom" thing like stackoverflow showed, etc.
Why doesn't jstl work? Must be an on going problem as there are many questions about it on the web.
I have done many "ant" projects in the past in eclipse and never encountered such a thing. The dynamic web projects just always worked. Never needed this forum til now trying to learn maven.
[Updated on: Mon, 28 December 2020 17:52] Report message to a moderator
|
|
|
Re: JSTL not working in maven [message #1836318 is a reply to message #1836300] |
Tue, 29 December 2020 00:28 |
|
Don't add it as an external jar--those don't get published to the server because they're not located in your project. Put the jar into your project's WEB-INF/lib folder.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Re: JSTL not working in maven [message #1836345 is a reply to message #1836318] |
Tue, 29 December 2020 18:20 |
Jim Whitaker Messages: 26 Registered: October 2020 |
Junior Member |
|
|
Yes I had already tried that did not work. Finally got it by adding:
<%@ page isELIgnored="false" %>
to the jsp file. I tried adding the following to pom:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
</jsp-property-group>
</jsp-config>
But that actually caused errors in the pom. Which I cannot understand why.
Remember I am new to maven, I feel I am forced to learn maven since jakarta will require maven builds.
A reminder I never ever had any problems with ant, it just worked perfect.
This little webapp was generated from a maven maven-archetype-webapp.
So how did it not get the jsp files to work without me adding the above line of code I showed.
I will say I do not like maven, I like ant, but if I am going to eventually do jakarta I have no choice but to use maven.
[Updated on: Tue, 29 December 2020 18:21] Report message to a moderator
|
|
|
Re: JSTL not working in maven [message #1836358 is a reply to message #1836345] |
Wed, 30 December 2020 04:21 |
|
Although it is a useful set of actions, JSPs don't require JSTL to function. jsp-config is a tag that goes in the web.xml, not the pom, hence Maven throwing up all sorts of error messages.
What was your original error message?
_
Nitin Dahyabhai
Eclipse Web Tools Platform
[Updated on: Wed, 30 December 2020 04:21] Report message to a moderator
|
|
|
Re: JSTL not working in maven [message #1836371 is a reply to message #1836358] |
Wed, 30 December 2020 21:53 |
Jim Whitaker Messages: 26 Registered: October 2020 |
Junior Member |
|
|
Here is untouched web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>Display</servlet-name>
<display-name>Display</display-name>
<description></description>
<servlet-class>net.Display</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Display</servlet-name>
<url-pattern>/Display</url-pattern>
</servlet-mapping>
</web-app>
If I modify it to:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>Display</servlet-name>
<display-name>Display</display-name>
<description></description>
<servlet-class>net.Display</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Display</servlet-name>
<url-pattern>/Display</url-pattern>
</servlet-mapping>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
</jsp-property-group>
</jsp-config>
</web-app>
I get -- Element type "el-ignored" must be declared.
And same for all the elements. And sorry earlier I meant web.xml, not pom.
[Updated on: Wed, 30 December 2020 21:53] Report message to a moderator
|
|
|
|
|
|
Re: JSTL not working in maven [message #1836403 is a reply to message #1836400] |
Sat, 02 January 2021 01:25 |
Jim Whitaker Messages: 26 Registered: October 2020 |
Junior Member |
|
|
I tried:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>Display</servlet-name>
<display-name>Display</display-name>
<description></description>
<servlet-class>net.Display</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Display</servlet-name>
<url-pattern>/Display</url-pattern>
</servlet-mapping>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
</jsp-property-group>
</jsp-config>
</web-app>
Shouldn't maven archetype be creating something that works?
This: https://maven.apache.org/archetypes/maven-archetype-webapp/
But created in eclipse with maven dropdown.
Like I said it only works adding to jsp file:
<%@ page isELIgnored="false" %>
Exact same project in netbeans 12.2 works without that line of code.
So is this an eclipse bug?
[Updated on: Sat, 02 January 2021 01:27] Report message to a moderator
|
|
|
|
|
|
Re: JSTL not working in maven [message #1836429 is a reply to message #1836414] |
Sun, 03 January 2021 20:19 |
Jim Whitaker Messages: 26 Registered: October 2020 |
Junior Member |
|
|
My code, meaning in the jsp:
<%@ page isELIgnored="false" %>
Is the only thing that worked.
Will Eclipse eventually have a create a "dynamic web app" based on jakarta instead of java? I am not new to java, but brand new to jakarta.
I'd like to practice a simple jakarta web app with a:
* jakarta bean
* servlet
* jsp
I am guessing I will have to wait on next version. Also I use tomcat, it seems tomcat 10 should run such jakarta apps.
I am referring to Jakarta bean (old java bean term), not EJB.
Hard to believe there's not already some good starter tutorials. When I first learned java years ago, there were a lot of tutorials.
Also, in the past I always used IDE default (ANT), but looks like jakarta requires maven, thus I am trying to learn maven.
Just trying to get up to speed. If you search Google for:
* javabean servlet jsp web app tutorial (many "java" results)
But changing it to:
* jakartabean servlet jsp web app tutorial
You don't find "jakarta" results, still java results. A couple of simple tutorials would be helpful.
[Updated on: Sun, 03 January 2021 21:09] Report message to a moderator
|
|
|
Re: JSTL not working in maven [message #1836498 is a reply to message #1836429] |
Wed, 06 January 2021 04:07 |
|
It's one part having a Jakarta EE 9 runtime to target your project against, one part having the tools updated to work correctly with
either set of package names. WTP 3.20/2020-12 added support for Apache Tomcat 10, which means you can create such a project
right now if you want. Developers of the other server adapters will have to update their adapters when their servers have Jakarta EE 9
versions. The tooling half of the equation is a work in progress with some parts of it expected in 2021-03, but it's hard to predict for
projects under WTP where I have no direct involvement beyond encouraging them to think through and implement support.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Re: JSTL not working in maven [message #1836951 is a reply to message #1836532] |
Tue, 19 January 2021 19:11 |
|
I'm not an expert, but I'd guess you can't without either knowing what command was used or by digging around in the archetypes themselves and making your own judgement.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Powered by
FUDForum. Page generated in 0.02785 seconds