servlet-3.0

JSF 2.2 - File upload return java.lang.NullPointerException

蓝咒 提交于 2021-02-11 18:26:37
问题 <h:inputFile/> return a NullPointerException error. I know there is already a lot of stuff about this exception and uploading files with JSF but I've read it all without any success to diagnose this problem. I am using JSF 2.2 with GlassFish 4.1.1, without PrimeFaces or Tomahawk since you can handle the file upload with JSF 2.2. as I read. The goal is just to upload a picture on the remote filesystem, and copy the path to the DB to retrieve it later through a datatable. I've already checked :

JSF 2.2 - File upload return java.lang.NullPointerException

核能气质少年 提交于 2021-02-11 18:25:59
问题 <h:inputFile/> return a NullPointerException error. I know there is already a lot of stuff about this exception and uploading files with JSF but I've read it all without any success to diagnose this problem. I am using JSF 2.2 with GlassFish 4.1.1, without PrimeFaces or Tomahawk since you can handle the file upload with JSF 2.2. as I read. The goal is just to upload a picture on the remote filesystem, and copy the path to the DB to retrieve it later through a datatable. I've already checked :

Apache Velocity + Servlet 3.0

可紊 提交于 2021-02-10 20:50:00
问题 I'm upgrading from servlet 2.5 to 3.0, and I'm using Apache Velocity for templating, after a mvn dependency:tree I see velocity-tools depends on servlet-api:jar:2.3, there's a way to use servlet 3.0 with Apache Velocity? Thanks in advance 回答1: I had the same problem; my Servlet 3.0 project wouldn't compile because servlet-api 2.3 was on the Maven classpath as a dependency of Velocity Tools. The work-around is to declare the Velocity dependency as runtime so at compile-time the project still

Apache Velocity + Servlet 3.0

心已入冬 提交于 2021-02-10 20:43:51
问题 I'm upgrading from servlet 2.5 to 3.0, and I'm using Apache Velocity for templating, after a mvn dependency:tree I see velocity-tools depends on servlet-api:jar:2.3, there's a way to use servlet 3.0 with Apache Velocity? Thanks in advance 回答1: I had the same problem; my Servlet 3.0 project wouldn't compile because servlet-api 2.3 was on the Maven classpath as a dependency of Velocity Tools. The work-around is to declare the Velocity dependency as runtime so at compile-time the project still

Apache Velocity + Servlet 3.0

我只是一个虾纸丫 提交于 2021-02-10 20:37:50
问题 I'm upgrading from servlet 2.5 to 3.0, and I'm using Apache Velocity for templating, after a mvn dependency:tree I see velocity-tools depends on servlet-api:jar:2.3, there's a way to use servlet 3.0 with Apache Velocity? Thanks in advance 回答1: I had the same problem; my Servlet 3.0 project wouldn't compile because servlet-api 2.3 was on the Maven classpath as a dependency of Velocity Tools. The work-around is to declare the Velocity dependency as runtime so at compile-time the project still

Where can I find the full documentation of deployment descriptor(web.xml)

可紊 提交于 2020-01-15 04:52:26
问题 Is there a full documentaion of the deployment descriptor that describes each element and each sub-element? I realy can't find it. P.S. I ask because I found the way to set maxAge of session cookies by adding <session-config> <session-timeout>525600</session-timeout> <cookie-config> <max-age>31536000</max-age> </cookie-config> </session-config> into DD. But I cannot find any official documentation that describes <cookie-config> element. 回答1: For the standard Java EE deployment descriptor

Glassfish/Wildfly not failing if @Resource cannot be resolved?

吃可爱长大的小学妹 提交于 2020-01-15 04:50:12
问题 I am experimenting with @Resource in a servlet to see if we can use it to inject configuration parameters easily (this is servlet 3.0 webapp in Glassfish 4.1.1). I was told in https://stackoverflow.com/a/45715196/53897 that the behavior I saw of a @Resource String userName being null when used if it could not be resolved if the env-entries in web.xml were not present, to be wrong according to the specification, but that the behavior of WildFly was the same. Question is: Is this a known bug?

Invoking servlet from java main method

放肆的年华 提交于 2020-01-13 05:54:21
问题 import java.net.*; import java.io.*; public class sample { public static void main (String args[]) { String line; try { URL url = new URL( "http://localhost:8080/WeighPro/CommPortSample" ); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); line = in.readLine(); System.out.println( line ); in.close(); } catch (Exception e) { System.out.println("Hello Project::"+e.getMessage()); } } } My Servlet is invoking another Jsp page like the below, RequestDispatcher rd