java

Data type used in action forms

Hi can somebody explain that if i declare variables of other types (except string) in the form beans what problems I might face ? ...

Problem when unit-testing the stop method of my RMI Server

Hi all, I have implemented a RMI Server and now I wanted to test if the method to start and stop this server are correcly implemented, using a JUnit test. Here is the (simplified) code of my RMI server: public void startServer() { try { ... registry = LocateRegistry.createRegistry(serverPort); registry.rebi...

How can produce a DOCTYPE declaration with DOM level 3 serialization API?

I have a DOM Document created from scratch and I need to serialize it to an output stream. I am using DOM level 3 serialization API, like in the following example: OutputStream out; Document doc; DOMImplementationLS domImplementation = (DOMImplementationLS) DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplement...

Invoking Java webservice from dot net client

Hi all, When I try to access a webservice hosted in Tomcat from C# code, I get error message like this. There was an error in serializing body of message searchRepositoriesRequest: ' Unable to generate a temporary class (result=1). error CS0266: Cannot implicitly convert type 'object' to 'object[]'. An explicit conversion exists (are y...

Displaytag: Controlling the placement of the paginator

Hi According to the docs, Displaytag can be configured to put a paginator before or after the generated table element via the "paging.banner.placement" property. However, I would like to place the paginator in it's own row in the table footer. Does anyone have an idea how to do this within the displaytag framework? The only solutio...

Where does JSP initialize?

I have a project which works fine. bookstore example I didn't understand where it initialize JSP's variable? There is no beans. All we have is Java class. JSP calls java class's variable but how? I searched into all the configuration files but nothing found. public class Bookstore { private final Map<String, Item> items = new Tr...

Difference between Socket.connect(Adreess,timeout) and FTPClient.setSoTimeOu

We are doing FTP connection through our applicaion which is a JAVA aplication. We have set timeout for connection using Socket.connect(Adreess,timeout) method before calling FTPClient.connect() method. During retriving files from the FTP site under same connection we havent set any timeout. Is it mandatory to call method FTPClient.setSo...

Invoking an external process with a different user in java

We have a java application running as a windows service. A particular functionality needs to execute a binary but with a different user then which started the application. Is there any way by which we can invoke an exe with 'Run as a different user' style. I checked API of ProcessBuilder but didn't found anything related to user. Is th...

Can you tell me a good Java Date formatter to parse a Javascript Date object?

Hi, clientside I have some scripts that send to the server some strings... one of which comes from a Javascript Date object. Now, it has it own formatting and I was just wandering if is there a class that does the right conversion, as I am experiencing problems with SimpleDateFormatter... ...

XML hierarchy with Java properties

Let's say I have a class Foo with some primitive instance variables. I initialize these with properties in XML files. Now every Foo also has a Bar as a variable, which in turn has its own properties. Since these are tied to the enclosing object, it would make sense to keep them in the same file. How should I format the XML so that it can...

Extract data with regex from html

I would like to extract items from this sample html, more specificly, i would like to isolate the following ones: algp1, PRODUCTION 50733 GEN_APPL KANTOOR <table width="95%" border="1"> <tr><td colspan=3><a name="algp1"></a><img src="menu/db2inst.jpg"> <font color="#FF0000" size="+1">algp1</font> (PRODUCTION, 50733)</td></tr> <tr><...

How to Parse Negative Long in Hex in Java

We have a J2ME application that needs to read hex numbers. The application is already too big for some phones so We try not to include any other codec or write our own function to do this. All the numbers are 64-bit signed integers in hex, when we use Long.ParseLong(hex, 16), it handles positive numbers correctly but it throws exception...

Testing for multiple exceptions with JUnit 4 annotations

Is it possible to test for multiple exceptions in a single JUnit unit test? I know for a single exception one can use, for example @Test(expected=IllegalStateException.class) Now, if I want to test for another exception (say, NullPointerException), can this be done in the same annotation, a different annotation or do I need to wr...

Oracle ResultSetMetaData getPrecision/getScale

I'm using Oracle's JDBC thin driver (10.2.0.3) for connecting to an Oracle 10g database. I'd like to get information about the database columns, so I use ResultSetMetaData. The most important information I need is the type of the column and the length, so I use getColumnType, getPrecision, and getScale methods. It works for a simple que...

Java - Graphics to image

Hi all, Well I am a junior java programmer, in the last week I've been facing the following problem: I've got an image and a panel. Both image and panel are inside a ScrollPane, and they both need to move in the same time. When I try moving them together I get a flickering effect. Moving each of them alone though, works fine. I've read ...

creating a manifest file

Hello everyone, How can I create a manifest file for a group of .jar file I' ve already created. I used eclipse to create my .jar file, is there any better way of creating a .jar file that has a manifest? Thanks ...

Clustering with shared session - object not serialized error

I have an environment where 2 load-balanced clustered tomcats pointing to same application. When they run under sticky session and not shared session, they works fine. Now I am implementing failover for tomcat. ie If one one fails other handles the sessions that handled by the failed one. And I am trying in-memory session replication. ...

Natural Language date and time parser for java

Hey guys, I am working on a Natural Language parser which examines a sentence in english and extracts some information like name, date etc. for example: "Lets meet next tuesday at 5 PM at the beach." So the output will be something like : "Lets meet 15/09/2009 at 1700 hr at the beach" So basically, what i want to know is that is ther...

Where can I find JSF 1.0 sources ?

Only JSF 1.1_01+ and 1.2 sources seems to be available. Links are dead for 1.1 and 1.0 sources : javaserverfaces.dev.java ...

Enabling logging of a third party component

In one of codes I am using Jetty. I am using the Jetty jar and imports the Classes from my Java code. Jetty's default log level is INFO if not configured specifically. We can enable DEBUG mode by code. The logger seems to be a log4j one. org.mortbay.log.Logger jettyLogger = org.mortbay.log.Log.getLog(); jettyLogger.setDebugEnabled(true...