java

How to display a date as ISO8601 with JSTL?

something like? <fmt:formatDate value='${event.starttime}' type='both'/> ...

Doing an embedded HTTP server with Comet

I love the idea of Grizzly, but I can't find any good examples to work with. Well, any good tutorial... I want to have an embedded HTTP server that I can talk to from Dojo. I don't want a J2EE server and I want to use Java. What do you folks think? ...

Init method invocation in filter

Could anyone please tell me why the following line about filter init method invocation is incorrect: The init method on a filter is called the first time a servlet mapped to that filter is invoked. ...

How to write an application that reads text and produces speech

I'm an IT student. I want to write an web browser for blind people. How can I use C# or java to write an application to pronounce some text from a XML file (Text to Speech)? ...

Maven - Archiva - Setting up Archiva for different geographic locations

We have developers working in different geographic locations and we want to set up Archiva for each of those geographic locations (just to make sure that the round trip in getting the artifacts is less). Is it possible that whenever an artifact is uploaded/deleted from Archiva at location G1 then the same change gets pushed to Archiva ...

Text Extraction from HTML Java

Hi. I'm working on a program that downloads HTML pages and then selects some of the information and write it to another file. I want to extract the information which is intbetween the paragraph tags, but i can only get one line of the paragraph. My code is as follows; FileReader fileReader = new FileReader(file); BufferedReader buffR...

how to make java JPanel and graphics2d transparent?

Hi all, Well the title is quite self explanatory. I want to build two panels one on-top of each other in layers using java. I want the top layer to contain a JPanel which will contain a graphics2d object. I'd like both the JPanel and graphics2d to have transparent background (I still want the content drawn by the graphics2d visible). Do...

[JAX-B] How can I ignore a superclass?

I'm trying to write a web service for the java.util.logging api. So I wrote a class MyLogRecord that inherits from LogRecord. I annotated this class with JAX-B annotations, including @XmlAccessorType(XmlAccessType.NONE) so it would ignore non-annotated fields and properties. When I start up tomcat, I get errors that java.util.logging.Lev...

Why Java Vector class is considered obsolete or deprecated?

Why Java Vector is considered a legacy class, obsolete or deprecated? Its use isn't valid when working with concurrency? And if I don't want to manually synchronize objects and just want to use a thread-safe collection without needing to make fresh copies of the underlying array (as CopyOnWriteArrayList does), then it is fine to use Ve...

Resources with sample questions for testing knowledge about Java (collections, swing, etc)

I need sites that provide a lot of sample questions about collections and generics and swing and etc. I have checked a lot but I couldn't find those sites. Can you help me? ...

Quickly create class from an interface in eclipse

Is there a plugin for eclipse which allows me to quickly generate a new class from an interface? Rather than having to do the typing in the new class dialog Ideally letting me choose a standard name like Impl for it to generate ...

Help me implement a rewindable buffer

This is where I'm so far: I have the following the following use case (as impartial jUnit test) to show what I want to achieve: buffer.add(o1); assertEquals(1, buffer.size()); buffer.mark(); buffer.add(o2); assertEquals(2, buffer.size()); buffer.add(o3); assertEquals(3, buffer.size()); assertSame(o1, buffer.get()); assertSame(o2, buffe...

Struts 2 and locale question

I've got forms that I display on almost every pages of a website (a login form, for example), so I don't use an action for those. The "post" of those forms just goes to an action and if there is a validation error, it displays another "central" page. The only thing that doesn't seems to work in the form page is displaying a message in di...

How can I find the intersecting point of three planes?

I'm trying to build render the raw data from a Quake 3 .map file with Java. The .map format stores brush (shape) information as a series of planes, but I'd like to convert them to points of the form (x,y,z). The math involved is a bit beyond me at this point, so does anyone have any advice on how I can do this? I'm fine with using ext...

Java's setPreferredSize won't resize JPanel

Hi all, I am struggling ( ! ) with java GUI development. All these small things that make obvious sense just don't work. I'll explain what I am trying to do and where I am failing (this is quite frustrating): I've got this graphics2d object which resides inside a panel. Now this graphics draws an image, it can go on and draw forever. t...

trouble making polymorphism defeat those switch/case statements

Continuing on previous questions (here, and here), I implemented a basic command pattern, created my command classes and coded to an interface, so when any command is used, to call the execute() method. However, I am still finding myself unable to shake those case statements: I am reading each character from a master/decision String, w...

What's the easiest way to expose a SQL interface to my application?

I'm working on an application which stores data in tables, similar to an RDBMS. I'm looking for a way to let my users query this data using SQL. Ideally, I'd like to do this without having to implement my own SQL parser, query optimizer, etc. So far, ripping parts out of something like Apache Derby is looking like the best option, but...

JButton needs to change JTextfield text

This is homework. Beginning Java class. Still wrapping my head around this stuff. The project is to make an Inventory Management System. I have everything figured out except how to make this button change the text in a JTextField. It needs to add info from an array of a product (DVD's in this case). The book talks about different wa...

Displaying XHTML in Swing (JEditorPane)

I'm writing a Java application with GUI using Swing. One of the GUI components is a JEditorPane that renders HTML. All the rendering is fine except that it shows in the first line the XML header: ?xml version="1.0" encoding="UTF-8" standalone="no"?> I've googled a little bit and I've found the same question here and there, but never any ...

Copy a directory from a jar file

Hi. I recently finished and application and created a jar file. One of my classes creates an output directory populating it with files from it's resource. The code is something like this: // Copy files from dir "template" in this class resource to output. private void createOutput(File output) throws IOException { File template ...