java

JSP <c:out> tag

Writing a JSP page, what exactly does the <c:out> do? I've noticed that the following both has the same result: <p>The person's name is <c:out value="${person.name}" /></p> <p>The person's name is ${person.name}</p> ...

Java Swing - Using JScrollPane and Having it scroll back to top

I'm using JScrollPane to allow scrolling in a JFrame that has a text component that's serving as a text editor. What I want to do, after setting the text in this editor, is have it scroll back up to the top, so you can see what's at the beginning of the file. Does anyone know how to do this? ...

Java Not Converting String to Long Object Properly

We're using Spring/Hibernate on a Websphere Application Server for AIX. On my Windows machine, the problem doesn't occur--only when running off AIX. When a user logs in with an account number, if they prefix the '0' to their login ID, the application rejects the login. In the DB2 table, the column is of numeric type, and there shouldn...

Which library/program can be used to generate Java-bytecode?

I know about BCEL, but this project seems to be dead, as it had no releases for two years. And the Java-world moves on. For example JDK 1.6 has a new class-file-format. So what library can be used to create bytecode for the JVM. If no library, a program is ok too, if I can manipulate the generated code in detail, for example a bytecode-...

Identifying different mobile handsets and redirecting to different websites

I have 3 mobile versions of a website and would like to present each to different handset models according to what they support. One version is monochromatic WML, another is color WML and another is XHTML for mobile. What's the best way to identify the device in the request and know if it supports a version or another? ...

How to assign Date parameters to Hibernate query for current timezone?

When you assign a date to a named SQL parameter Hibernate automatically converts it to GMT time. How do you make it use the current server timezone for all dates? Lets say you have a query: Query q = session.createQuery("from Table where date_field < :now"); q.setDate("now", new java.util.Date()); "now" will be set to GMT time, while...

Jasper exported to Excel ignoring background color?

Have you ever had alternating background colors in a Jasper report and then exported it to Excel? The Excel export seems to ignore the alternating color. I've got a Jasper report where the rows alternating background color using the procedure referenced HERE. When I preview it using the viewer or export to PDF it works -- but not whe...

Java Alert Framework

Are there any "Alert" (or Notification) frameworks in Java out there. In my web application I would like our users to be able to configure which (of the available alerts) they would like to receive and in which (e.g via email) form. As a simple example, a user chooses to be alerted only via email when his/her order has been shipped. ...

Consuming a web service in Java

I have a very simple soap web service that I need to consume from a Java client. What is the easiest way to accomplish this without using any third party libraries? A requirement is that the host anhd port is read from the web.xml before every call to the ws. ...

Groovy in Ant build.xml (with Java classes)

I have to include Groovy classes into existing Java apps , and include Groovy into Ant build.xml file. What is the best way to configure Ant build.xml for it? Thanks Tatyana I was suggested to update my question, but I am not exactly sure what it means. Tatyana Urs Reupke wrote: Please update your question to help future answers bec...

What package naming convention do you use for personal/hobby projects in Java?

I'm already familiar with the standard Java package naming convention of using a domain name to create a unique package name (i.e. package com.stackoverflow.widgets). However, I've never seen any recommendations for how to choose package names for personal projects. I assume because this is because this is really a matter of personal tas...

Populate JTable from a Hashtable in Java

I have a function which gets a key from the user and generates a Hashtable (on a pattern specified by the key). After creating a Hashtable, I would like to populate a JTable so that each each column represents a key and every rows represents the values associated with the key. I tried everything but couldn't get this work. I'm not creati...

Client Java vs (Adobe) Flash for web applications, what to choose and when

A few years ago client Java was unsuitable for web development because a remarkable part of web users did not have Java installed. ( I don't remember exact numbers, more than 10%). Now I see the Google Analytics stats for a big site and it tells that >98% of users have Java installed. Is these stats very biased by Javascript usage? As...

URL decoding

I want to decode string which is encoded using java.net.URLEncoder.encode() function. i tried using unescape() function in java script. but problem occure for blank space because java.net.URLEncoder.encode() converts blank space to '+' and unescape() function wont convert '+' to blank space. ...

Choosing when to instantiate classes

I recently wrote a class for an assignment in which I had to store names in an ArrayList (in java). I initialized the ArrayList as an instance variable private ArrayList<String> names. Later when I checked my work against the solution, I noticed that they had initialized their ArrayList in the run() method instead. I thought about this ...

What do I need to know to make a Java application that uses a database?

Since I've started using NetBeans, I've learned of some powerful ways to abstract away the process of creating Java database applications with automatically generated UI, beans bindings, and a bunch of other stuff I only vaguely understand the workings of at the moment (I hate being a newb). Problem is, how do I do the basic stuff I act...

How do you build an SWT application with Maven

I trying to learn swt, and I use maven for all my builds and eclipse for my IDE. When getting the swt jars out of the maven repository, I get: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3034 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709) at java.lang.Runtime.loadLib...

Interacting with UI threads in Java/J2ME

I'm writing a J2ME application. One of the pieces is something that polls the contents of a directory periodically, and, if there are any new things, paints them on the screen. I've done this by having the UI form launch a polling thread with a pointer back to itself, and when the polling thread finds something it calls back to the for...

How best can I isolate my application from an unreliable database?

I have a Java SOAP data service which sits on top of a Sybase database which, for reasons out of my control, has unreliable performance. The database is part of a vendor package which has been modified by an internal team and most of the issues are caused by slow response times at certain times of the day. The SOAP service provides dat...

Where can I download JSTL jar

Does anyone know because all the places I've tried seem to timeout! ...