java

Displaytag library - detecting a paging request

Hi, I'm currently developing a portlet for Liferay (using the Spring MVC framework). Now I just used the displaytag library for implementing paging on a list I'm displaying on the portlet. My problem now is that I would need to detect whether the current request has been started by the paging control of the displaytag library. What I ...

jQuery is adding servlet name twice to URL

I am trying to complete the tutorial at http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=438 It seems that the servlet is trying to POST the data to http://localhost:8080/WeatherServlet/WeatherServlet ... (WeatherServlet is the name of the servlet - duh). I have the following index.jsp page (which displays fine) <%@ page l...

Why are there so few open source GWT apps?

Something I have found strange since I started working on GWT is how few open source projects there are in this technology. Initially I was surprised to discover this mainly because GWT itself is open source. But after puzzling over this, my suspicion is that it is mainly used for internal projects by large corporations who already use...

Setting the a Property to what maven.compile.classpath Contains WITHOUT Ant

Hi, I'd like to set a property in my pom to a classpath containing all the project's dependencies. The ant plugin does something like this, so I know it's definitely possible. I basically want to use ${maven.compile.classpath} wherever I like in my pom and have it 'just work'. I don't mind using plugins or anything else to achieve this...

Eclipse SWT - Java Programming Dilemma

I am writing an Eclipse Plugin that opens a file and displays all the images contained within the file. This image display is part of a GUI application. Each image is rendered by associating it with an SWT Canvas widget. When I open the file I have all the information I need to determine the number of images I will have to display. I...

What Java Library can I use to search for colours, with a tolerance, in an image?

I would like to find a Java library that will allow me to search for colours within an image with a tolerance. Preferably quickly. I know how I would do it if I had to write it myself, and it's not super difficult, but I'm hoping to find a library with features other than that principle one. I'd like to be able to also: Find another im...

Application using Pooled JDBC Connections

I'm working with a legacy WebLogic application that contains a web-service application and a standalone, command-line application. Both need access to a common database and I would like to try and get the command-line application use a pooled connection to the web-server's JDBC connection. (The standalone application can only be run wh...

How do I include jsp pages in a Java web app without duplicating code?

Let me just start out by saying I am completely new to Java web apps, so I'm sorry if this is a very basic question. I am writing an app that has the ability for users to login to an account. The top part of each page contains an info bar (kind of like the top bar in GMail) with something like: Logged in as <userid> | Settings | Help ...

Character Encoding Detection Algorithm

I'm looking for a way to detect character sets within documents. I've been reading the Mozilla character set detection implementation here: Universal Charset Detection I've also found a Java implementation of this called jCharDet: JCharDet Both of these are based on research carried out using a set of static data. What I'm wonderin...

Java: Can't get incremented value to print.

I'm learning to do some Java 101 syntax stuff. In an exercise I'm trying to do, I can't get the incremented value to print. Any ideas? Here is my code: class StaticTest { static int i = 47; } class incrementable { static void increment() { StaticTest.i++; } } class DataOnly { int i; double d; boolean b; ...

In Swing use an InputVerifier to check dates and time

I'm currently working on a Swing app and I've got a few JTextAreas that are going to be parsed, turned into dates and then added to a MySQL database. One is a Date field, the others are DateTime, what I'm trying to do is use InputVerifier to make sure they're entered correctly. I've created an InputVerifier that tries to turn the text i...

Load Java classes based on a classpath in a properties file

My application uses JDBC database drivers. I load these from a jar file, db2jcc.jar in the case of DB2 which I'm currently working with. With this jar in the classpath, everything is fine, but I have a requirement to find the jar from a property in the application's config file instead - for example, database.driver=/opt/IBM/db2/V9.5/j...

Printing Multiple PDFs from Java as a single print job (physical printing)

I would like to print multiple pdfs from java (using the java print service) in a single print job. I would like to send multiple pdfs as a single job to the printer. This is so that all the documents in my 'batch' print together and are not interleaved with someone else's print jobs when I go pick them up from the printer. A batch po...

How do you write a search function that is easy to comprehend (/maintainable)? Maybe in a modular manner?

Every time I see a search function, the code behind it is a mess. Several hundreds of lines, spaghetti code, and almost ALWAYS as one huge method. A programming language (Java/C#/PHP/etc) is used to construct one big fat SQL query. Many, many if else's. There must be more elegant ways to do this than this? Or is this what you get when ...

How to deal with java threads.

I have a class called communicator. This class is a listener of a thread receiving events from another program. Also this class has a method call refresh that sends and action to the program a waits for the response that comes through the listener. Both methods are in the same class but called by diferent threads. public void processRe...

RMI-How does passing a remote object through a remote method work?

As I understand it, once I've set up an RMI communications link between two systems, I can pass an object that implements "Remote" into one of the remote methods that takes an object of that type and the far-end will just get the remote interface for the new object (in other words, it will become a new remote connection as opposed to jus...

Cyclic dependency of two eclipse projects

Hello! I am trying to implement some sort of MVC in Java. Actually it's more of a MVP but this doesn't really matter to my problem. Following situation: I've got a GUI, made with Netbeans (because of the better GUIeditor) which is updated and changed frequently. As my main project is easier to maintain in Eclipse I chose to import the...

Containing drawing to a panel area

I want to draw an array of X and Y integers to a panel in a Java frame. What is the best way to draw the line (currently I'm using Graphic's drawPolyline)? How can I efficiently scale the integer values so they all fit in the panel area without knowing the max (Y) value? Update, for example public void paint(Graphics g) { int heigh...

Mapping of Oracle Date to Java type to return the number of seconds since epoch?

I have a table with an oracle date column when I do a select on sqlplus on the column it gives me the value like this 10-JAN-2007 Is this the precision of date in an Oracle column i,e does it not have hour sec, millisec in the date column. How can I map this to a java timestamp and get seconds since epoch. ...

ResultSet method "last" is this an optimal way?

I have this java code which does this ResulSet rs = stmt.executeQuery(); while (rs.next()) { .... //do regular processing if (rs.last()) { //do last record processing } } ...