How add JSTL to my IntelliJ Jakarta EE 10 project running GlassFish - intellij-idea

First, sorry for my poor english.
I begin to learn jakarta EE and I discover Jakarta Standard Tag Library (JSTL) for prevent XSS attack.
The IDE say this : "cannot resolve taglib uri"
I don't find any guide for a way to use JSTL in intelliJ with maven, glassfish 7 and recent Jakarta EE 10.
I tried to add JSTL in my Jakarta EE project in IntelliJ ultimate.
My project run with glassfish 7.0 server and JDK 19.
I tried to download JSTL lib by adding a library from maven in the project structure setting.
I saw a lot of problem with intelliJ and JSTL 3.0 so I tried many version of JSTL, 3.0, 1.5 and 1.2.
I tried to declare URI by two syntax in the bottom of my JSP :
`<%# taglib prefix="c" uri="jakarta.tags.core" %>
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>`
I added dependecies in pom.xml like this :
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
</dependency>
Can someone help me ?
That's my first question, i am a noobie so please be indulgent if my question is stupid ^^
thanks.

I tried to add JSTL in my Jakarta EE project in IntelliJ ultimate. My project run with GlassFish 7.0 server and JDK 19
Stop
Normal Jakarta EE servers such as GlassFish already ship with JSTL out the box. You do not need to manually install it like as you would need to do for barebones servletcontainers such as Tomcat.
Please completely remove the individual JSTL dependency from your pom.xml. Duplicate classes in runtime classpath would only cause runtime conflicts.
See also:
How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved, the section "Installing JSTL on normal JEE server"
What exactly is Java EE?
The IDE say this : "cannot resolve taglib uri"
Ignore and run it. Does it work? Then it's very definitely a false error. The IDE version being used just needs to catch up with the current state of technology. Upgrade it. Does it still whine? Report it to the IDE guys. In case of IntelliJ IDEA it's here: https://youtrack.jetbrains.com/issues/IDEA

Related

How to download JAR from Maven and add to non-Maven IntelliJ WAR project

I need to setup https://github.com/adminfaces but i can't make it work at all. I get errors in wildfly deployment.
I setup intellij project, i select framework support for JSF, and Primefaces which are prerequisites. But than docs say:
Add admin theme to your classpath:
<dependency>
<groupId>com.github.adminfaces</groupId>
<artifactId>admin-theme</artifactId>
<version>1.0.0-RC9</version>
</dependency>
How do i do this if i don't use maven? Can i set it up, via some jar file. Also i don't get it, if i download release from github, what is install.sh?
But even if i added it through maven via Intellij browser it still doesn't work. Can't deploy to Wildfly.
Maven library can be added to non Maven project through Intellij IDEA.
Project structure->Libraries->Add library->From Maven
AdminFaces jars are published to maven central, you can download it there, see here.
Just add admin-template and admin-theme to your classpath.
Also it depends on OmniFaces (2.x) and PrimeFaces (5.1.1 or greater) and also JavaEE apis such as servlet, EJB, CDI, JSF and JPA.
If you are running it outside a JavaEE container such as Tomcat take a look at Admin Starter Tomcat dependencies, you should be able to download them from maven central as well.

intellij JavaDoc browser plugin can't find javax

I'm on Arch linux x64 machine , I installed intellij idea but whenever I open a project a startupabortedexception occurs with the JavaDoc browser plugin.
I looked into my idea.log and figured out that it can't find javax.servlet.Servlet, I disabled the plugin in order to open a java project and indeed when I type import javax; it says it can't find javax.
I have java-openjfx installed and still intellij can't find it, what to do in this case ? .
Environment information
jdk:openjdk 1.8.0_60 64 bit.
intellij version: 14.1.5 community edition.
Goal
My goal is to get the JavaDoc browser plugin to work not to program in javax.servlet, I don't intend to do any web development with java right now.
If you don't have Maven project, you can just add the jar to the project. The one you are missing can be downloaded from:
http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api/3.1.0
(just click "Download (JAR)" button)
The class javax.servlet.Servlet is not part of the standard JDK, it is part of the JEE, so you have to add servlet-api.jar to your classpath.
If your project is a Maven project you add the dependency like this:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
And you probably want to add
<scope>provided</scope>
as this dependency is most likely present in your application server.

How do I install Robot framework and selenium 2 library with Jython?

I searched a lot regarding this. Still I didn't get any definite answer for this. Someone Please explain me on how to do this. Please mention the compatible versions also.
You can use the Selenium 2 java robot framework.
Just add the following dependency to the pom file (if you use maven)
<dependency>
<groupId>com.github.markusbernhardt</groupId>
<artifactId>robotframework-selenium2library-java</artifactId>
<version>1.4.0.6</version>
</dependency>
If you don't use maven, just download the jar from
https://github.com/MarkusBernhardt/robotframework-selenium2library-java
(You can find a link there to the jar with the dependencies in it)
This is compatible with all jython versions (since it's java based)

converting GWT1.7 application to GWT2.0

I am developing a web application in GWT 1.7.Now I am planning to move to GWT 2.0. I am using maven build tool and intellij idea IDE.Can any one tell me the maven plugin for GWT2.0 and how to run/debug using intellij idea IDE?RIght now I am using GWT Mojo plugin http://mojo.codehaus.org/gwt-maven-plugin/ ?
I've provided detailed steps and a pom.xml to use Maven, GWT 2.0 and the Maven GWT Plugin 1.2 in this answer. All the non Eclipse specific steps (i.e. the Maven part) should apply and help you to update from GWT 1.7 to 2.0.
gwt-maven-plugin 1.2 has been released and now full supports GWT 2.0.
I'm not familiar with IntelliJ IDEA. But, they do support maven integration like any other IDE. You can integrate your maven-gwt project like any other one into IntelliJ.

Can JDK version be specified in source code?

I'm developing a Java app on two different computers (same source code) that have different JDK versions. Is there a way to specify JDK version in the source code so that an IDE (e.g. NetBeans) will compile the source code the same way on both machines?
One of my computers has JDK5 and the other has JDK6. Under 5, jdbc-interface doesn't support some methods (e.g. NClob, XML...) which are available in 6, so code that gets compiled on the 6 machine works while code compiled on the 5 machine doesn't. Right now, I have to comment out 6-only stuff when working on the 5 machine.
Not in the source code. You want to set your IDE to compile using a Java 5 JDK. You can do this by installing a Java 5 JDK alongside the Java 6 JDK, and specifying that (which is IDE dependent).
Alternatively, if you're using Ant, you can specify the Java version in the javac task.
Don't overcomplicate the issue... install the same version of the JDK on all the machines, and set your IDEs to use that version. Ignore other versions.
I know this has been answered but if you cant update the 1.5 to 1.6 then all you need to do is set the ide that is using 1.6 to compile to "source compatibility" of 1.5
There is no need to install the 1.5 on the machine that is running 1.6 because the JDK is backward compatible.
The setting in eclipse is preferences > Java > Compiler
You'll always have to regress to and code against the lowest version of the JDK - in your case you can't use the features introduced in JDK version 6.
As Brian has said, it's probably safest if you work with the IDE configured to use the same JDK (version 5 in your case).
You can switch to a particular runtime version using the version argument, but that's probably not going to help in you.
Also note, compiling your code against version 6 and running against version 5 will cause runtime error due the incompatible class versions, when as you stated you try to use JDBC methods that didn't exist in the older version.
In NetBeans you have right click on project properties then source version if you have jdk 1.6 you can build it with previous versions
What you need to do is specify the source compatibility to something that's supported by both JDKs (<= 1.5). It may make sense to go lower than 1.5 if, for instance the application you're building may be deployed to an environment that only has Java 1.3 installed.
I know this is possible in Eclipse, but unfortunately, I'm not familiar with NetBeans, but I'm sure it would be possible too.
If it's any help, here's how you do it if you're just running javac from the console (assuming you want 1.5 as your base level):
javac -source 1.5 ...
This is also possible as a plug in configuration within a Maven POM, if you're using Maven (which I understand NetBeans has excellent support for). This is how you'd do that (from http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html):
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>
And as Brian Agnew points out, possible in Ant also.
Problem is: do you need to support JVM 1.5? If so, your code should be fully 1.5-compatible (which doesn't seem to be). If not, just update your JVM in all your machines (as already suggested) to same JVM version (and don't forget version minor: 1.6.0_03 != 1.6.0_14).