java

Saxon XPath API returns TinyElementImpl instead of org.w3c.dom.Node

I have the following code: // xpath evaluates to net.sf.saxon.xpath.XPathEvaluator XPath xpath = XPathFactory.newInstance().newXPath(); XPathExpression expression = xpath.compile("/foo/bar"); Object evaluate = expression.evaluate(someXML, XPathConstants.NODE); Object evaluate2 = expression.evaluate(someXML, XPathConstants.NODESET); S...

GAE,can persist but cannot load(createQuery) entity

1.i able to persist entity, and in _admin , i able to see key, id/name. total 6 results. but why it not show all the property inside my entity class? 2. when i try use createQuery , i cannot load the object. there is no error in the console. the code just stuck afer hitting query.getResultList(); 14:41:31,047 DEBUG [DataNucleus.Persi...

How do I display a message if a jsf datatable is empty?

Using JSF1.2, if my datatable binding returns no rows I want to display a message saying so. How do I do that? And for extra points - how do I hide the table completly if it's empty? Thanks. ...

Problem in sending mail with Gmail SMTP using Java mail

I copied code from here only to send mails using the Gmail SMTP server. But I'm getting security exceptions. I achieved the target once I succeeded in sending 4 mails but later I made few changes in my code as per my application demand and it's throwing security exception. I'm sure it will work but having some problems. What is the trou...

Setting textfield value back to null for login j2me program

Below is some code which simply allows a user to log in, however i want to be able to reset the value of the text fields userName and password to nothing in the else statement if the user enters the name or password wrong so that is no longer displays their previously entered details. Can anyone tell me how i do this? Also how do you set...

Eclipse Generated Web Service Client Extremely Slow

A little up front info: I have a SOAP service (hosted using JAX-WS (Endpoint class), but I don't think that is important). I can connect to and use the web service just fine with Visual Studio generating the client (C#). I generated a java client using Eclipse Web Tools (new --> other --> web services --> web services client). Then...

equals() method of java.

I've the following test program. I create 3 Integer references. I create 2 Integer objects and make references i1 and i2 refer them respectively. I make reference i3 equal to i1. Now i1 equals() i3 should be obviously true as they both refer to same object on heap. But why should i1 be equal() to i2 ? They are refering to two different o...

how to use Pattern matcher in java?

lets say the string is <title>xyz</title> I want to extract the xyz out of the string. I used: Pattern titlePattern = Pattern.compile("&lttitle&gt\\s*(.+?)\\s*&lt/title&gt"); Matcher titleMatcher = titlePattern.matcher(line); String title=titleMatcher.group(1)); but I am getting an error for titlePattern.matcher(line); ...

Java: Is there a way to you enforce a implementation of private methods?

I have 5 or 6 classes that I want to have follow the same basic structure internally. Really most of those that the classes should follow are just for the use of the function itself, so I really want these methods to be private. Is there any way to achieve this? I know interfaces would work great but they won't take private members and...

Finding the default calculator (cross-platform)

How would I find and run the default calculator in java without making my program platform dependent. I could just hard-code all the paths for each major OS, and then find the OS the person is using and then use that OS's respective path. But, see I don't want to do it like that, is there anyway to do it without hard-coding the paths in?...

Spring Dynamic List Binding

I have a typical scenario - I have read many articles on this and dynamic addition seems to work fine. I could not get elegant solution for dynamic delete. A Web Form is simulating a User. User can have name and List of phoneNumbers. phoneNumbers can be added dynamically using Javascript at client side. Dynamic addition of phoneNumber...

Java AWT in .NET

Is there an equivalent for Java AWT that works on .NET? I usually use IKVM for Java bytecode translation, but IKVM AWT support is fairly limited. ...

How to implement the session compression in Java?

I was listening .Net Rocks! podcast (with Scott Hunter) where it was mentioned about session compression. I wonder how can I achieve the session compression in Java? ...

When should I create a new Exception class.

I notice that a number of Java exception classes differ only in the name of the class and do not add any new functionality. Most exceptions for example just seem to override Exception() or Exception(String message). This goes against the tenets of inheritance ie:- inherit to add new functionality. What are some good reasons to create a...

Intercepting the end of the HTTP Session with Seam

I need to intercept the end of each request a user does against a Seam web app. While Filters seem to be the right tool for catching requests before they hit your business logic, Interceptors seem to be useful as advices for individual classes... Thanks! ...

local development using tomcat, do I have to setup my IDE in a special way?

Just downloaded netbeans, and curious if I was to play around with JSP's etc., do I have to put my source files in a particular folder layout? How will I hookup tomcat? ...

installing netbeans says no compatible Java found

what do I need to install, the SDK? my program files folder has a java/jre6 installed? ...

can I run more than one JVM on my single PC?

Can I run more than one JVM? If yes then how can I find a particular class is loaded on which JVM? ...

CPD / PMD between projects?

Hi all, I am rephrasing this question to make it a little more straightforward and easy to understand, hopefully. I have roughly 30 components (internal) that go into a single web application. That means 30 different projects with their own separate POM. I use inheritance quite a bit in my POMs so one of the things they inherit is a ...

ListActivity with checkbox in Android

I am trying to use ListActivity and a SimpleCursorAdapter to check boxes based on a query from a database. The cursor is a list of questions and answers. If the user has already answered a question the checkbox should be checked but they aren't checked. The code looks like this: protected void onCreate(Bundle savedInstanceState) { s...