java

Spring syntax for setting a Class object?

Is there a way to set a property in spring to, not an instance of a class, but the class object itself? i.e. Rather than <bean> <property name="prototype" class="a.b.c.Foo">... giving you an instance of "Foo", something like: <bean> <property name="prototype" class="java.lang.Class" value="a.b.c.Foo.class"... edit: best (wor...

Relative paths in spring classpath resource

Hi all, I have a bunch of spring config files, all of which live under the META-INF directory in various subpackages. I have been using import like the following... <import resource="../database/schema.xml"/> So a relative path from the source file. This works fine when I am working with a local build outside of a jar file. But ...

JDBC DatabaseMetaData.getColumns() returns duplicate columns

I'm busy on a piece of code to get alle the column names of a table from an Oracle database. The code I came up with looks like this: DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@<server>:1521:<sid>", <username>, <password>); DatabaseMetaData m...

Vim omnicompletion for Java

I've read heaps of blogs on Vim's supposedly great omnicompletion, and yet no matter what I do I can't get it to work satisfactorily. It took me ages to figure discover that the version of ctags that is preinstalled on my system was the emacs one, and didn't have the --recurse option, but now that I've run ctags-exuberant on my copy of t...

java scripting API - how to stop the evaluation

hi, i have writen a servlet that recives a java script code and process it and returns the answer. for that i have used the java scripting API in the code below if script = "print('Hello, World')"; the code will end properly print "hello world". but if script = "while(true);" the script will loop endlessly. import javax.script.*; pub...

Manipulating namespace prefixes in SAAJ / raw xml access within SAAJ

My SAAJ-based client generates the following XML and sends it to a .NET web service: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt; <SOAP-ENV:Header> <AuthenticationHeader xmlns="http://www.w3.org/2001/XMLSchema-instance"&gt; <Password xmlns="http://schemas.datacontract.org/2004/07/"&gt;temp123&lt;/Pas...

Problem with dbUnit: java.sql.SQLException: Closed Statement

Hi, I have a strange problem with dbUnit. I use dbUnit 2.4.4, java 1.6, Spring (as db connection pool), Oracle 9 for my project with about 50 unit tests. For some of them (when I run whole set of tests) I get such exception: Closed Statement [junit] junit.framework.AssertionFailedError: Closed Statement [junit] at com.myproj.DataAcc...

How can I get started recognizing character input via a touchpad?

I want to write a piece of software that could convert a touchpad into a writepad. For example, if you write 'A','B' or 'C' on the touchpad with your finger, the software should enter that character to stdin. I don't know how to get started with this project. What would you suggest? ...

Where can I learn about using Struts in Java?

Where can I learn about using Struts in Java? ...

Java Overload method with inherited interface

Hi all, i'm trying to understand java behaviour. Using this interfaces : public interface IA {} public interface IB extends IA {} public class myClass implements IB {} I'm overloading a method like this : public void method(IA a); public void method(IB b); When calling method with the following object : IA a = new myClass(); met...

rtf to text including headers and footers

we need to get the contents of RTF documents as plain text. we were using RFTEditorKit for it, but many of the RTF documents we need to handle contain \headerf or other header fields, and RTFEditorKit doesnt parse these (silently ignores). is there another lightweight solution to get these documents parsed to plain text? ...

Mapping both static and dynamic files in Tomcat/Spring?

I was using the following in web.xml to configure a servlet to dynamically generate PDFs. <servlet-mapping> <servlet-name>pdfServlet</servlet-name> <url-pattern>*.pdf</url-pattern> </servlet-mapping> Now, I also have to serve a few static PDF files. What's the cleanest way to configure that? I'm currently only serving four o...

What are common java web development practices?

I'd like to learn more about/better understand common java web development practices of development groups that have at least two teams - web designers and web component developers. Particularly, I'm interested in understanding things like: Assuming there is a code repository, do all teams checkout a local copy of all code? If yes, why...

Java and .NET interop on (RSA) signatures

Hello, I'm signing some data on a .net-based smartcard and trying to verify that signature in a java environment - but without success. Smartcard (c#): RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); // In a different method, rsaParams.Exponent and rsaParams.Modulus are set rsaProvider.ImportParameters(rsaPa...

How to use thread pool in WebLogic 8?

How is it possible to get/use/return a thread from an execute queue ( = thread pool) in WebLogic 8.1.6? ...

Java Web Service project deployment

I need a place to store files for several application systems. The following is how I make this system. Use FTP to upload a file. Set up an FTP server first using FileZilla. Open a count for a client to connect and upload files. Use Java to build web service which can store file’s information including: file name, version number, file ...

How do I specify a file to pass to a java process run by an Ant task?

I have an Ant task to call a java process that takes a file on the command line. I can pass the file directly to the java program but I can't figure out how to make Ant take the file on the command line. Here's what I've got: <target name="FileProcessor" description="Process a specified file"> <run-standalone name="CheckClearer" ma...

Hibernate on Oracle AND SQLServer

I'm introducing a DAO layer in our application currently working on SQL Server because I need to port it to Oracle. I'd like to use Hibernate and write a factory (or use dependency injection) to pick the correct DAOs according to the deployment configuration. What are the best practices in this case? Should I have two packages with dif...

JDBC, MySQL: getting bits into a BIT(M!=1) column

I'm new to using JDBC + MySQL. I have several 1/0 values which I want to stick into a database with a PreparedStatement. The destination column is a BIT(M!=1). I'm unclear on which of the setXXX methods to use. I can find the references for what data comes out as easily enough, but how it goes in is eluding me. The values effectivel...

How do you make a dropdown list that displays images to the user instead of text?

The ObjectChoiceField field meets all my requirements but it is not pretty. This is what I have: String pets[] = {"Dog", "Cat", "Duck" }; ObjectChoiceField dd = new ObjectChoiceField("My Pet",pets,0,ObjectChoiceField.FIELD_LEFT); But I would prefer to have pictures in the dropdown. My understanding is that the object array must conta...