java

Static Classes in Servlet

I make static classes in servlet, these classes are controllers for web pages. Requests are redirected to controllers by controller urls that are in static HashMap that contains all controllers. Are there any posibilities that user/session realted stuff could get messsed up with other users sessions? I will of course save all session rel...

ushort equivalent

I have an application in C# that I'm trying to convert to java. The C# app has a few variables that are of type ushort. Is there an equivalent in java? Thank you ...

widget to upload multiple files

Hi I'm developping an application using Gwt and Gxt (Ext GWT). There isn't any widget in Gxt to attach many files in a form before posting it. I'd like something like this widget in extJS: http://www.extjs.com/learn/Extension:UploadForm Does someone know a solution to add such a widget in my gxt project ? Thanks for yours answers. ...

Can panels communicate with each other?

I'm trying to call a method from a panel class, however it does not result in anything. Can panels communicate with each other? Or is there another reason why this isn't working? Calling the method name() in the leftInput class. ButtonPanel class. import model.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; publi...

How do i read from database with J2ME?

I am busy with a project that requires me to read from a database and display certain results on mobile(J2ME). For example: I must list all customers in the database (SELECT * FROM CUSTOMERS) and i must display that results on mobile(J2ME). So some how i need to connect the mobile to the database. How do i go about doing this? I really ...

Java Double to String conversion without formatting

I have the number 654987. Its an ID in a database. I want to convert it to a string. The regular Double.ToString(value) makes it into scientific form, 6.54987E5. Something I dont want. Other formatting functions Ive found checks the current locale and adds appropriate thousand separators and such. Since its an ID, I cant accept any for...

JPA Annotations in Android

Hello, We have a project that uses JPA/Hibernate on the server side, the mapped entity classes are in their own Library-Project and use Annotations to be mapped to the database. I want to use these classes in an Android-Project - is there any way to ignore the annotations within Android, to use these classes as standard POJOs? ...

Suggestions for JMS Queue and Topic naming conventions

For larger JMS deployments what are your best practice suggestions for naming conventions? Currently we're following the suggestions in the Sun Developer Network Blueprints. For example: jms/<resource-name>[Queue|Topic] I am concerned about scaling this as we get more and more queues and topics in the system. I'm particularly interes...

Creating a ISO-8859-1 string from a HEX-string in Java, shifting bits.

Hello experts! I am trying to convert a HEX-sequence to a String encoded in either, ISO-8859-1, UTF-8 or UTF-16BE. That is, I have a String looking like: "0422043504410442" this represents the characters: "Test" in UTF-16BE. The code I used to convert between the two formats was: private static String hex2String(String hex, String enc...

Two DropTarget in the same class does not work (Java) ?

I have two Jlist in the same class each with DnD drop enable. The problem is whatever file I DnD from my desktop to the JLists either number of or number 2 will populate ( and appear ) in JList1. Jlist2 accepts the drag and drop but it is like the content is going to Jlist1 automatically. Any idea on how to solve that ? ...

Problem selecting the value from a JComboBox binded to a list

I have a JComboBox binded to an observable list (result of a jpa query) in a java desktop application. It gets all the values from that list and displays them correctly, but I'm not able to select any particular value from the dropdown: that is, when I click on the widget the list of options gets displayed correctly, when I click on an i...

How to access map value when its key contains a dot in JSTL ?

Hi, when my Map contains key with dot in their name I cannot access the corresponding value directly with the usual code: ${recordForm.map['records.key']} Is there a way to escape the dot? Or do I have to resort to loop through all values and check against the key? (I know the iteration works). Thanks! ...

What's the easiest way to parse multi-line SQL statements in Java?

I'm pretty new to Java, but I'm looking for Java code that can take multi-line SQL statements, say something like this from a flat file: CREATE OR REPLACE TRIGGER REQ.TR_INPT_STAY_DETAI_SQ_BI BEFORE INSERT ON REQ.INPT_STAY_DETAIL FOR EACH ROW BEGIN SELECT REQ.SQ_INPT_DETAIL.nextval INTO :new.INPT_STAY_DETAIL_PID from DUAL; END; ...

Creating and using Multiple Filters/Searches using JTable or GlazedLists

I looked up how to use multiple filters on here with a regular table and the answers all pointed to GlazedLists. However, the answers didn't specify how to use it. I was able to get one filter to work but do not know how to get more than one. For one filter I used: // nameE is a BasicEventList containing classes (name) which // c...

Inheritance + Interface problem

I have an interface to describe when a class can create a "next" version of itself: public interface Prototypeable<Type extends Prototypeable<Type>> { public Type basePrototype(); // the zeroth raw instance of Type public Type nextPrototype(); // the next instance of Type } to be used with public class Prototyper { public static <...

Avoid using a DB for storing small set of data on a Java EE App

I have a small JSF app and would like to keep some state on the server, without using a DB. It will just be a small string for every user so I don't see the point in deploying an RDMS for that. ...

how to add different cell editors for one column in JTable?

I have a JTable with two columns and both are JComboBox, for this purpose I implemented my own Model and overrode methods. One of the method which I overrode is: public Class getColumnClass(int index) { return JComboBox.class; } Also created my own ComboBoxEditor and ComboBoxRender classes, and set cellEditor and cellRenderer: c...

Java constructor with large arguments or Java bean getter/setter approach

Hi, I can't decide which approach is better for creating objects with a large number of fields (10+) (all mandatory) the constructor approach of the getter/setter. Constructor at least you enforce that all the fields are set. Java Beans easier to see which variables are being set instead of a huge list. The builder pattern DOES NOT seem ...

Read/Write to linux Pipe using Java

My query is on what is the best way to read / write to a linux Pipe in Java? I already am using the java.io.RandomAccessFile like RandomAccessFile file = new RandomAccessFile("/dev/zap/16", "rw"); and then passing it to worker thread which reads it after every 2ms as byte[] buffer = new byte[16]; file.read(buffer); It does r...

Get Browser's Java Plugin Version?

Question Is it possible to get the version of the Java Plugin being used by the web browser, either through Javascript, or within a Java applet being run by the plugin? Background I'd like to run a Java applet embedded within the browser if the user is using Java Plugin2, or run it as a JWS application otherwise, because I need to contr...