java-ee

Should I choose == or eq for comparing string in EL?

为君一笑 提交于 2019-12-18 10:47:12
问题 == and eq give the same result using EL to do my string comparison tests: <c:if test="${person.sokande_i == 'endast_usa'}">Endast USA</c:if> <c:if test="${person.sokande_i == 'alla'}">Alla länder</c:if> <c:if test="${person.sokande_i == 'alla_utom_usa'}">Alla utom USA</c:if> Should I use eq instead? Is == for integers only? But it works also for strings. AFAIK == test whether hashCodes are equal and eq means "meaningfully different". Another question says == and eq do the same thing. Is there

Why different persistence units with separated data sources query the same data source?

匆匆过客 提交于 2019-12-18 10:20:13
问题 I'm developing a webapp which needs access to two different database servers (H2 and Oracle). The container is an Apache Tomee 1.5.1 and I'm using the Java EE stack with libraries provided in it (JSF, JPA, CDI, EJB, etc.). I'm trying to use two entity managers inside an XA transaction to extract data from the Oracle database and persist it in the H2 after transforming it, BUT all the queries are executed against the H2 database no matter the entity manager I use. Any help? EDIT : I found that

What is the difference between log4j, slf4j and logback?

為{幸葍}努か 提交于 2019-12-18 10:19:58
问题 I am little bit confused by these three logger libraries. It seems like that they can do the similar thing in java logging... 回答1: Check out their home pages: SLF4J - The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction 1 for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time. 1) It is not itself a logging library, but a generic interface to one of many logging

Maven: Including a META-INF folder in the classes folder

巧了我就是萌 提交于 2019-12-18 10:13:48
问题 I have a very simple WAR project and I want to include a directory named META-INF at the top of the classes output folder where all the compiled Java classes are. I'm using Maven, but it seems that by default Maven won't include anything that is not a Java class. So it ignores my META-INF directory that is sitting at the top of the src directory. The META-INF directory contains a file named persistence.xml . Any quick pointers on how to instruct Maven to put this directory and file into the

Glassfish 3 security - Form based authentication using a JDBC Realm

一世执手 提交于 2019-12-18 10:10:23
问题 I want to understand form based security and JDBC realms with glassfishV3, so i decided to create a little app that just allows to sign in and out, i followed the instructions from this book to do so. I understand how the hold thing works, but something is wrong and i cant get it to work properly. What i did first was create a little database with JPA annotations: @Entity @Table(name="USERS") public class User implements Serializable { private static final long serialVersionUID =

What is the best place to store a configuration file in a Java web application (WAR)?

只愿长相守 提交于 2019-12-18 10:08:19
问题 I create a web application (WAR) and deploy it on Tomcat. In the webapp there is a page with a form where an administrator can enter some configuration data. I don't want to store this data in an DBMS, but just in an XML file on the file system. Where to put it? I would like to put the file somewhere in the directory tree where the application itself is deployed. Should my configuration file be in the WEB-INF directory? Or put it somewhere else? And what is the Java code to use in a servlet

I don't understand Async support in servlets 3.0 API

若如初见. 提交于 2019-12-18 10:07:26
问题 I come from a Java SE background, and I did some servlets tutorials and read Head First JSP & servlet. I'm reading the JavaWorld.com article about Async support now but I don't quite understand it. What's Async is simply about ? What is the difference between Ajax and Servlet Async? P.S I have a PHP background with ajax and I know the concept, but I haven't tried it with java 回答1: In the traditional Servlet model, it's normally the case that 1 request corresponds to 1 thread. These threads

How to improve Netbeans performance?

ぃ、小莉子 提交于 2019-12-18 09:54:54
问题 Is there a real way to get Netbeans to load and work faster? It is too slow and gets worse when you have been coding for some time. It eats all my RAM. I am on a Windows machine, specifically Windows Server 2008 Datacenter Edition x64, 4Gb of RAM, 3Ghz Core 2 Duo processor, etc. I am using the x64 JDK. I use the NOD32 Antivirus since for me it is the best in machine performance. In Task Manager netbeans.exe only shows no more than 20 Mb, java.exe more than 600Mb. My project is a J2EE web

How to call a web-service using JavaEE?

蓝咒 提交于 2019-12-18 09:45:49
问题 I've been using rpclib to auto-generate a WSDL and implement it in Python. Then I wanted to call a web-service* that has this WSDL using JavaEE, so I simply used the Web Service from WSDL option in the creation wizard in Eclipse (Indigo 3.7.1 with OEPE), but then the Ant build failed with the exception (in short): weblogic.wsee.tools.WsBuildException Error running JAX-WS wsdlc Caused by java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required() What should I do? How

How can I Monitor External files in Java

对着背影说爱祢 提交于 2019-12-18 09:43:25
问题 I have a .exe file, It takes .txt file as a Input and it returns .txt files as outputs. I have 2 folders names are InputFiles and ExeFolder . InputFiles folder have so many number of input files, which files are passing as a argument to .Exe file. ExeFolder have .exe file, output files and only one Input file(we will get this file from InputFiles folder). I want to build 1 web Application, It will work in the following way. step 1 : it checks, How many no of files are available in