java

How to display success message in Struts?

Hi, we could display errors in Struts by doing actionErrors.add(key, new Actionmessage("string")), addErrors(request, actionErrors); and then outputting it into a JSP page via I'm wondering, how do I output success messages in Struts? How do you normally/conventionally do it? ...

AJAX Using a REST API Without Server Side Framework

I am building a REST based API (Read only) for accessing services of my application. I plan on writing a web application that will leverage these APIs to provide basic information on the status of the application. I plan to use AJAX (using jQuery) to show the information. Originally I planned on using Grails, Spring MVC, RoR or one of t...

Determining if an Object is of primitive type.

I have an Object[] array, and I am trying to find the ones that are primitives. I've tried to use Class.isPrimitive(), but it seems I'm doing something wrong: int i = 3; Object o = i; System.out.println(o.getClass().getName() + ", " + o.getClass().isPrimitive()); prints java.lang.Integer, false. Is there a right w...

Problem using @SecondaryTable in Hibernate

Abridged version of my schema: utility_company id int not null -- PK name varchar(255) not null utility_settings utility_id -- FK to utility use_magic tinyint(1) not null default 0 There is a one-to-one mapping between these two tables. Setting aside the fitness of this design, I want to Map the data in both of these tables to one o...

mysql monitoring and management

hello friends! i want to monitor and manage mysql database sever with jmx. when i hit google it display connector/mxj. i get it and execute MysqldHtmlAdaptor file. it shows mysql server variables. but i can't rivet that instance into original mysql server running on other server. plz help. is there any good tutorial for JMX for mysql...

How do I implement inheritance using iBatis for Java?

Please point me to an example! iBatis documentation doesn't cover this. I have been struggling all morning getting my discriminator and subMap to work! ...

Why will there be no native properties in Java 7?

Is there any rational reason, why native properties will not be part of Java 7? ...

Java: Rationale of the Object class not being declared abstract

Why wasn't the java.lang.Object class declared to be abstract ? Surely for an Object to be useful it needs added state or behaviour, an Object class is an abstraction, and as such it should have been declared abstract ... why did they choose not to ? ...

Tiles won't parse Struts tags

Hi, I'm tried using tiles but it seems that it's not parsing the Struts tags, It outputs them directly e.g. instead of ... What seems to be the problem? ...

Using Spring IoC to set up enum values

Hi there, Given the followin enum : public enum Car { NANO ("Very Cheap", "India"), MERCEDES ("Expensive", "Germany"), FERRARI ("Very Expensive", "Italy"); public final String cost; public final String madeIn; Car(String cost, String madeIn) { this.cost= cost; ...

What are the benefits of JCA?

Our application often connects to different king of back-ends over web services, MQ, JDBC, proprietary (direct over socket) and other kids of transport. We already have a number of implementations that let us connect from our application to these back-ends and while all of these implementations implement the common java interface, they d...

Why is Tomcat doubling my log lines in the catalina.out logfile?

Every time I look at Tomcat's catalina.out log file, I see double lines for every log entry. Why is this happening? Has this happen before to any Java (Tomcat) users? ...

Launch .jar files with command line arguments (but with no console window)

I have to do a demo of an application, the application has a server.jar and client.jar. Both have command line arguments and are executable. I need to launch two instances of server.jar and two instances of client.jar. I thought that using a batch file was the way to go, but, the batch file executes the first command (i.e. >server.bat [...

Which Java framework works best with Google Web Toolkit?

GWT is the main reason I'm moving into java for web development. Which java framework will work best with it, while also maximizing code reuse for mundane tasks like form validation, database access, pagination, etc? Thanks. ...

How can I best implement a Fade Button Effect in Swing?

I have a JButton which, when pressed, changes background color from active to normal: final Color activeButtonColor = new Color(159, 188, 191); final Color normalButtonColor = new Color(47, 55, 56); I want to fade the active button color back to the normal button color when a specific task has finished executing. I'm using SwingWorke...

Are custom facelet functions dirty?

I have several places in my facelets web app where we are using custom facelet functions. For some reason they feel dirty and I can't quite peg why. What is StackOverflow's view of custom facelet functions? ...

How does Google Web Toolkits work with Servlets?

I'm considering building a web app using Java and Google Web Toolkit and I have some questions. I assume that when someone goes to a URL such as http://site.com/Signup, the Signup servlet will be loaded which will perform all the necessary work and forward the request to a JSP that would display the HTML and Javascript code. If there i...

Programmatically Controlling Windows Media Player, Preferably From Java

I'm adding functionality to an existing Java application that's already been deployed extensively. (So there are some design decisions that I can't touch unless I have a seriously compelling reason.) The app controls a PC broadcasting audio and visual to a small local TV network. Right now, it mostly broadcasts static slides, but it c...

Java home grown generics examples

Can anyone point me to good examples of using generics in Java? By this I mean examples of writing a generic class oneself? Most explanations read "You can define a generic class like this. Now see the Java Collections API and forget all that - just use it and be happy." What I want is more like "You can define a generic class like t...

Java Collection - Unique Key and Unique Value

I need a collection that can lookup a value based on the key and vice versa. For every value there is one key and for every key there is one value. Is there a ready to use data structure out there to do this? Thanks in advance. ...