Can not issue data manipulation statements with executeQuery() [duplicate]

This question already has answers here: Cannot issue data manipulation statements with executeQuery() (11 answers) Closed 5 years ago. I use com.mysql.jdbc.Driver I need insert and get id. My query: INSERT INTO Sessions(id_user) VALUES(1); SELECT LAST_INSERT_ID() FROM Sessions LIMIT 1; error – Can not issue data manipulation statements with executeQuery() How insert and get id? … Read more

How can I reopen a closed InputStream when I need to use it 2 times

I am currently using an InpuStream to get a JSON response from my server. I need to do 2 things with: Parsing it and displaying the values on the screen Save this feed on SDCard file That gives me no issues at all when using these 2 methods one by one. The parsing is made … Read more

List of JSF 2 events?

So far I have only known and seen <f:event type=”preRenderView” listener=”#{situationHelper.load}”/> and I wonder where I can find a list of other page (or view) events other than preRenderView? Particularly, I’m looking for a event which is triggered before the binding proccess, (preRenderView runs after components are bound) Thanks. Answer From the tag library document … Read more

Java immutable classes? [duplicate]

This question already has answers here: Why do we need immutable class? (19 answers) Closed 7 years ago. I found an article with an interesting piece of code: public class Employee { private String firstName; private String lastName; //private default constructor private Employee(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public … Read more

What is inside com.sun package?

Like javax contains the extensions, what is the com.sun package supposed to contain? Answer It contains Sun Oracle reference implementations of the standard Java (EE) APIs. Among others Mojarra (the reference JSF implementation of Oracle) and Glassfish (the reference Java EE implementation of Oracle) use this package. It’s preferable to not use those classes directly … Read more

JSTL – Print current url including query strings

${requestScope[‘javax.servlet.forward.servlet_path’]} gets me the right string, but not including parameters that might be set in the url. Example: http://localhost/path/i/want?param=1 should give me a string /path/i/want?param=1 I have a feeling this should be done easily but can’t figure it out. Thanks in advance! Answer It’s available by ${requestScope[‘javax.servlet.forward.query_string’]}. AttributionSource : Link , Question Author : Tilman … Read more