java

Why and when to use EJB-based web services?

To transfer data from one system to another, through data interface, by web services, we normally get a result set by SQL query, and format them as a web service endpoint, and allow it to be retrieved by another side. With EJB 3.0, it seems we can replace the result set by stateless session bean. So are there any advantages over the SQL...

Getting the time in seconds in which the session will expire

I am building a web application that has a top thin frame which should show the time in seconds in which the servlet session will timeout. The problem is that a AJAX call to a servlet which returns the last access time, and the inactiveInterval itself updates the session. So is there a way I can get information about the session via a ...

java documentation from source ?

i know that we can create documentation from java source files. but how to do it?. thanks in advance. ...

Run a process on Linux remotely from a Windows machine

I would like to be able to run a process that exists on a Linux machine remotely from a JAVA application running on a Windows machine. What is the best way to do this? Or an online resource that might be of help to me? Thanks very much. ...

how to pass parameter to a javascript function using struts taglib?

Hi I have a javascript function updateHiddenField(value) that gets a value as parameter and then sets this value as the value of a hidden field. I have a JavaBean flight with parameters id and flightNo. Problem: How can I pass the parameter id of JavaBean flight to the js function updateHiddenField(value) when using <html:link> tag(s...

Java email sending queue - fixed number of threads sending as many messages as are available

I'm writing a message processing application (email) that I want to have an outgoing queue. The way I've designed this is having a singleton queue class, ThreadedQueueSender, backed by an Executor Service and a BlockingQueue. Additionally, a thread pool of javax.mail.Transport objects is used to obtain and release connections to the outg...

Does flex not support hashmaps?

I have a Flex object which collects a DTO from the server. All the fields arrive filled in correctly except for the one that is a HashMap. It arrives as null. I've tried giving it a type of both ArrayCollection and Dictionary, but that hasn't fixed it. Does anyone know if there's an inherent incomaptability between Java HashMap and Flex...

Remote Java development with Eclipse (or something else)?

I'm fairly new to Java development, and people have been suggesting I use Eclipse as an IDE for the work I'm doing. My code lives on a linux box (running Ubuntu of some fairly recent version), but I use a MacBook as my main computer. I've been ssh'ing into the linux box to work on the non-Java code, simply using vim and have done the sam...

How can I take fullscreen screenshot of website

I need to get fullscreen shot of website by URL, is there any PHP programs for that or services, if not, is there any Java programs for that purpose? ...

Print multiple variables with one command in jdb

How can I print multiple local primitives with one command in jdb (verison 1.4)? I've tried: print v1, v2, v3 but that only prints out the value of v1. Any suggestions? Edit: Effectively I need a watch in jdb. ...

How to configure and retrieve the value from a g:select in Grails?

I have a g:select in my view that displays a list of products: <g:form name="addproductform" action="saveProductToInventory" method="post"> <g:select from="${products}" name="product" value="${it?.id}" /> <g:hiddenField name="inventory.id" value="${inventoryInstance.id}" /> <input class="save" type="submit" value="Save produ...

How to replace � in a string

I have a string that contains a character � I haven't been able to replace it correctly. String.replace("�", ""); doesn't work, does anyone know how to remove/replace the � in the string?? ...

Schema validation, how to display user friendly validation messages?

Hello all , Is there a way to avoid or set up a schema to display better user friendly messages? I am parsing the string and using reg ex to interpret them, but there might be a better way. Ex. "cvc-complex-type.2.4.b: The content of element 'node' is not complete. One of '{\"\":offer,\"\":links}' is expected." Instead I want:...

java serialized messages dont contain the correct data in socket-client-server model

hello i have a basic client-server system running using java sockets. my problem is, that an object that i send from the client to the server does not contain the correct data after it has been sent once. the first time i send it, it arrives with the correct values, but when i send it another time with different values, it still arrive...

Why multiply by a prime before xoring in many GetHashCode Implementations?

I understand that multiplication by a large number before xoring should help with badly distributed operands but why should the multiplier be a prime? Related: Why should hash functions use a prime number modulus? Close, but not quite a Duplicate: Why does Javas hashCode() in String use 31 as a multiplier? ...

How should I handle having one identical form on many pages in Spring MVC

Title says it all really. I have a login form that has some validation on many pages in my website. How best do I structure my controllers to avoid repeating the validation logic etc. Bear in mind some of these pages have their own controller requirements e.g. reference data. So one exactly identical controller cannot be used. The ...

GWT + Spring: NullPointerException on getServletContext() call

Hi, I'm currently experimenting with GWT and Spring. More specifically I wanted to make the GreetingService sample to work with Spring on the server side. There are a couple of articles available for realizing this (I'm linking them here since some of you may be interested): http://ice09.wordpress.com/2009/05/25/google-app-engine-spri...

Web Services using J2ME and Java Version 1.4

Howdy, We are trying to program an MFP (Multi-function-printer) to communicate to our backend using Web Services. We are sending large images so using MTOM is important. Since we are dealing with a very constrained environment I would rather not use Axis. Does anyone know of another smaller WS library that will work with JDK1.4, or wou...

Implementing on-the-fly text styling in a JEditorPane

I have an idea to write a note-taking app in Java that does some simple text replacement as you type; probably a small subset of the Markdown syntax. So for instance, if you entered a line that was #sometext, it would get rendered: sometext Wikidpad is part of what I'm trying to do (I'm not just re-implementing that, just parts of the ...

What are some tools that can analyse memory usage outside of the heap in Java?

We have weird memory leak problem with a Java process running in linux has an ever growing swap usage. So naturally we looked at the heap dump and also used a profiler to monitor it over a period of time. We found that 1) The number of threads does not grow 2) The heap usage does not grow 3) Yet the (VIRT) usage keeps growing (which ca...