java

jsp:include in netbeans

I'm using JSF in NetBeans. All I want to do is to include a page within another page. But whatever I tried, and when I run the main page, I get no error but I can't see my included page in a main page. Why? My main page is: <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xm...

ANTLR (field=value), how to express this?

I'm a total lexer and parser newbie, so please have some patience. Eventually I want to be able to express LDAP style Query strings, e.g. '(foo=bar)', '(!foo=bar)', '(&(foo=bar)(!zip=zap))' and have a tree in the end which I could use to create the actual database query (or whatever) So I thought to start with the simplest form, to pars...

How to drag from browser area and deposit to the explorer area?

Sometime ago I was facing the problem the other way around: how to drag an item (folder/file) from an explorer window (be it windows explorer, linux nautilus etc.) to the browser window - that is, the drag starts in one application and ends in the browser. Since I had control over the browser, I was able to intercept the dragend event: t...

java.nio channels buffers streams terminology

Does anybody have a good analogy (or, failing that, a good resource) for describing the relationships between buffers, streams, readers, channels, selectors etc. in java.io and java.nio? Thanks ...

AppFuse Generic/Universal DAO and Manager usage

I've been using AppFuse to create my projects for a while now. And I'm already aware that there are two approaches to developing your DAO and Manager classes: GenericDao/GenericManager approach UniversalDao/UniversalManager approach I often find that using the Universal approach to be more convenient, because I just need one class t...

Why are life-cycle listeners in Hibernate Serializable?

The Hibernate interfaces that you implement to provide event listeners, for example: org.hibernate.event.PostInsertEventListener; all extend Serializable. However, it doesn't seem to explain anywhere why your listeners need to be serializable. We've been injecting DAOs with database connections into them for a while, and it hasn't faile...

How do I debug silent failures in Java applications?

I'm trying to debug a problem in my Java application that throws no errors, no exceptions and doesn't even crash the app (it seems the failure happens in a separate thread). The problem seems to be inside a call to a library function (it's JAXBContext.newInstance(String) if that matters). The program will reach the line just before the ...

Is multiple inheritance in Perl and Java the same?

Is the multiple inheritance in Java and Perl the same? ...

How to Write Java server logs to separate log file

Hi, Right now we are using a customized logger method for our application but now we have a stand alone code for which we need to write to a separate log file. We have little idea about log4j. I just want to know where to change properties if any so that i don't disturb the existing logger application as well as we write our logs into...

Post a message to a remote JMS queue using JBoss

This looks simple but I can't find a simple answer. I want to open a connection to a remote JMS broker (IP and port are known), open a session to the a specific queue (name known) and post a message to this queue. Is there any simple Java API (standard if possible) to do that ? EDIT Ok I understand now that JMS is a driver spec jus...

Is there a way to declare an annotation attribute for *any* enum?

At the moment I am developing an annotation-based binding-framework for Java Swing that uses JGoodies Binding under the hood. Unfortunately I am stuck with an annotation for a JRadioButton-binding. What I want to do is specify a property-name of a model which holds a special value (enum). The radio-button shall be selected if this proper...

Which Cipher Suites to enable for SSL Socket?

I'm using Java's SSLSocket to secure communications between a client and a server program. The server program also serves up HTTPS requests from web browsers. According to "Beginning Cryptography with Java", page 371, you should always call setEnabledCipherSuites on your SSLSocket / SSLServerSocket to ensure that the cipher suite that e...

Java with information Flows, output to screen.

I know that the audience of JIF is very small in numbers, but that's that Stack Overflow is for. My question has to do with if anyone has a snipset with which I can declassify a String and send it as output to screen. Example: String data{Alice:} = "123"; output.println("this is it" + data); note: more appropriate tag would be JIF, b...

Open port in linux with java application

Hi, i've a java application that create a socketserver in a port. I test my application in a windows machine, and run correctly, but when i test it in a linux machine, the port is not listening. Is there any way to open port specifically in a linux machine? I run 'netstat' command, and the port i use in my application doesn't appear. i...

JPA/Hibernate: code based validation of jpa queries.

What is the right way do validate a jpa query programmatically. Hibernate validates all annotation based named queries on entities. But how can I call this validation routine on programmatically builded jpa queries, to check for errors? @Entity public class Foo { @Id public int id; public String name; } main(...) { Query q = ...

include directive

Hi, Head First book says about include directive as include code from any other file into the JSP file at translation time, which can't be changed dynamically. However, I included a JSP file in the include directive, which generates a number randomly every time I access the page with include directive. And every time a new number gener...

APIs that allow status updates to be posted to several sites?

Does anyone know of an API that will allow for posting status updates to Twitter, LinkedIn and Facebook? ...

Secure XML Parsers

In typical Java applications, the XML parsers is XALAN/XERCES but they were not written with security in mind. I am curious to know if there are parsers that are more robust when it comes to security. ...

Rewriting Binary Streams using Java

I have been studying Netty and Mina but am confused as to the best way to rewrite binary streams. For example, I would like to create a proxy that will allow for replacement of XML and forward along. Examples appreciated. ...

How to hide RuntimeException details from EJB client ?

I have a JEE5 application that exposes services using (local) session beans. When an internal fault occurs during service execution, a RuntimeException is thrown and encapsulated by JBoss(5.0.1) in a javax.ejb.EJBTransactionRolledbackException. The problem is that client applications receiving this EJBTransactionRolledbackException can...