java

[JAXB] Set annotation @XMLTransient if id==1

Hi. I have class that represents users. Users are divided into two groups with different id. Could i make something like "if statement", so if (id==1) set annotation on field @XMLTransient Or the only one way to do this is to create two separate classes ? ...

Disable Outlook Email Forwarding in Java

In Outlook there are options to disabled replying to and forwarding of emails. Granted this is only a rudimentary level of security as someone can always copy / paste the email content, but it does prevent accidental forwarding of confidential emails. My question is how can these options be disabled when sending a mail using Java? I a...

GWT and Spring, is it worth it?

Is there any reason to use Spring (or other similar frameworks) as a server for GWT RPC? As far as I can tell, 99.9% features of Spring will not be used. Yet, lots of people are looking for best ways to use them together. Could someone please explain, what are the benefits of using MVC frameworks (on server) with GWT, when all you need ...

Is there an equivilent of C# Anonymous Delegates in Java?

In C#, you can define small pieces of code called delegates anonymously (even though they are nothing more than syntactic sugar). So, or example, I can do this: public string DoSomething(Func<string, string> someDelegate) { // Do something involving someDelegate(string s) } DoSomething(delegate(string s){ return s += "asd"; }); D...

(C#) DataTable equivalent in JAVA

Is there a C# DataTable equivalent in Java? ...

Closing a connection

I am using a class DBConnection which has a static method createConnection.I create a connection object like Connection con=DBConnection.createConnection(); I don't forget to close it along with statements and resultsets. Now how different is it having the same DBConnection having a normal method createConnection and create a new Con...

El expression doubt

Hi, in EL expression in JSP we can use ${"1"+"2"} but not ${"Dark"+"Knight"}. Why? ...

OSGI - handling 3rd party JARs required by a bundle

I'm just getting started with OSGI development and am struggling to understand how best to handle dependant JARs. i.e. if I'm creating a bundle the likelyhood is that I will need to use a few 3rd party JARs. When I create my bundle JAR to deploy to OSGI, obviously these 3rd party JARs are not included and thus the bundle will not run. ...

captcha Image link on html page

HI, I am using a bot program in which i want to find out the link of captcha image so that i can display on a Jframe. When i am looking to page source their is no image link of captcha on it.It is generated on by javascript. Please some body help me. Thanks in advance. ...

How to use the APT tool to create exercises in course material

I'm in the process of creating exercises in how to write a plug-in to a system integration tool. We will have the correct answers implemented for demonstration after exercises, but the students will receive source where some methods are empty and just have a comment with a TODO in them describing what they should do. To avoid duplicati...

Are there any good Tapestry 5 components for implementing tabs/ tabbed navigation?

Also, if there are, which would you recommend? ...

iText nested table inside a cell

I'm creating a PDF with iText version 2.1.0. I have to create a "detail" cell in a cell of a table. I did this nesting a table inside that cell. The problem with this approach is that the borders of the nested table don't touch the borders of the container cell. What I am looking for is for a table nested inside a cell whose borders don'...

Alternative ways to open a file for writing on J2ME?

I've inherited a bit of J2ME code where a single class has the following two methods in it: public DataOutputStream getOutputStream(String filePath) throws IOException { return Connector.openDataOutputStream(filePath); } public DataOutputStream createOutputStream(String filePath) throws IOException { FileConnection fc = (FileC...

Solaris 5.10: How do I hide a JWindow button on the task bar?

I am using a JWindow object in my Java application to simulate a mouseover dropdown menu. When the user mouses over a JLabel, the window appears and remains until the mouse exits either the label or the newly visible window. My problem is that each time the user performs this action, a new entry in the task bar at the bottom of the scr...

How to call a TieLine (Cisco VOIP phones) using Java

I have been playing X-lite for awhile now. It is extremely useful when I need to call a Tieline within our office environment. The only detail I know about it is, it connects to a domain server and that's it. I would like adapt the same logic into Sametime that IM we use internally. Anybody have any related links for the same ? ...

How to periodically poll some value using Java (Swing)?

I am using swing based model.My form contains one Jbutton its called "polling(function name is getvalue())".I have a function name as "getvalue()".This function does retrieve values(this value will change after some span of time) and print it in console. I want code and idea about, that function will call automatically every 5 minutes ( ...

How many actions should a servlet perform?

Hi, I'm new to web development and am just wondering about best practices for java servlets. Should each servlet perform exactly one action, ie a servlet for login, a servlet for registration etc, or should I look to combine similar actions by passing a different parameter to tell the servlet which action to perform? Cheers ...

Memory leak when calling java code from C using JNI

Hi, I have a C program that stores some object in java store using JNI. (Before someone ask, using java store is a requirment here and I have to write a client in C which would be able to add and retrieve objects from this store). I made the program and tried to add 100000 object of size 1KB. But after adding only 50000 objects I am get...

Should I still be using JDOM with Java 5 or 6?

I've been using JDOM for general XML parsing for a long time, but get the feeling that there must be something better, or at least more lightweight, for Java 5 or 6. There's nothing wrong with the JDOM API, but I don't like having to include Xerces with my deployments. Is there a more lightweight alternative, if all I want to do is rea...

Using HTTP Basic-Auth with Google App Engine URLFetch service

How can I specify the username and password for making Basic-Auth requests with App Engine's URLFetch service (in Java)? It seems I can set HTTP headers: URL url = new URL("http://www.example.com/comment"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("X-MyApp-Version", "2.7.3")...