java

Accessing the value of a Richfaces calendar during validation.

I am trying to validate a field based on another field's value. <h:form id="item"> <s:validateAll/> <h:selectBooleanCheckbox id="selected" value="#{bean.selected}" validator="selectedValidator"/> <rich:calendar id="startDate" value="#{bean.startDate}"/> </h:form> However, inside my validator. public void validate(FacesContext c...

how to do a system pause in java for debugging?

is there any system("PAUSE") like thing in java ...

Which java web technology to learn to develop Rich Internet Applications ?

Hi, I have developed web applications using JSF (myfaces components). But in these days of responsive UI, JSF doesnt fare well. I m hearing a lot about AJAX, GWT, etc. So i wanted your opinion on which web technology/framework should i learn inorder to develop web applications for enterprise products. Some of the web technologies that i...

ScheduledThreadPoolExecutor scheduleWithFixedDelay and "urgent" execution.

I have the following problem that the standard library doesn't solve well, and I'm wondering if anybody has seen another library out there than can do it so I don't need to hack together a custom solution. I have a task that is currently scheduled on a thread pool using scheduleWithFixedDelay(), and I need to modify the code to handle r...

Redirects in Glassfish (adding trailing slash)

Is it possible to add a trailing slash to the default context of an application? Example: http://www.uri.com/foo -> http://www.uri.com/foo/ I added the following redirect to the server properties: redirect_1: from=/foo url-prefix=/foo/ and this ends up in a loop... Several other configurations also didn't work :-/ I'm using glass...

Deploying Jersey-enabled servlet to Tomcat: Exceptions.

Hey guys, Here is what I'm trying to do: we are switching over to using JAXB and Jersey for all our REST services and XML/JSON serialization needs. So far, I have been able to get a simple test working where some beans are annotated, some test objects created and these are perfectly serialized to either XML or JSON and return to the c...

Why is Galileo update site empty?

I just installed Eclipse Galileo for Java developers and noticed that the update site list is empty. Does anyone else have the same problem? I don't know the URL's for the update sites. ...

Is it possible to write files to a remote directory using java?

I have the directory mapped on my machine so that I can browse and write to it via Windows explorer. I would like to write files via java. File f = new File("http://dev1:8080/data/xml/myTestFile123.xml"); f.createNewFile(); I am getting the following error: Exception in thread "main" java.io.IOException: The filename, directory ...

Using Maven to build separate JAR files for unit testing a custom class loader

As part of my current project I've created a custom class loader. Part of the unit tests for the custom loader involves using some JAR files to demonstrate the proper behavior of the loader. I'd like to build the test JAR files from Java sources ahead of running the actual unit tests. Further, the test JAR files cannot be on the class p...

How to check if internet connection is present in java?

How do you check if you can connect to the internet via java? One way would be: final URL url = new URL("http://www.google.com"); final URLConnection conn = url.openConnection(); ... if we got here, we should have net ... But is there something more appropriate to perform that task, especially if you need to do consecutive checks very...

java.lang.ClassNotFoundException: DataSource in Glassfish

I'm getting a weird problem in GlassFish 2.1 - I'm a beginner with this container and I'm having trouble pinning this down. I have a new install of GlassFish 2.1 with a JDBC connection pool defined called testDerbyPool. I then have a resource defined called jdbc/testDerbyPool pointing at that pool. The resource type is javax.sql.DataSou...

Compare two Java objects with a check for null

I feel like such a novice for asking this question, but is there a method in the JDK that compares two objects for equality, accounting for nulls? Something like this: public static boolean equals(Object o1, Object o2) { if (o1 == null) { return o2 == null; // Two nulls are considered equal } else if (o2 == null...

Question about Scope of Static Class Variables in Java

Hi Folks, I have a static object defined in my logging class, along the lines of: class myLoggingClass { static java.util.Properties properties; ... ... } According to my reference book, this means that the properties object is shared by all instances of my class. I find this definition insufficient. I'm writin...

urlrewritefilter problem with velocity template rendering

So after installing UrlRewriteFilter, I set up a rule and a corresponding velocity template. And when I go to the test page, the velocity script is shown as raw code instead of being compiled. example of the code for the rule: <rule> <from>/test/([0-9]+)</from> <to>/downloads/test.vm?Id=$1</to> </rule> example of the urlrewrite...

HTML Site Inside Java Portlets

I'm a complete noob when it comes to portlet development. I have a task which is to take a fairly small static html site and incorporate it into a portal/portlet environment. My first thought is to develop one portlet that contains the entire html site within it. Is this just a terrible idea? If not, then I know I could make a simple ...

Java errors and syntax. Any help appreciated

I am asking for help on self-help, which is kind of an oxymoron. How do I bug you nice folks less by solving more of my own problems? I am in my last week of Java programming and I am having a huge hurdle with learning Java. I have read all the books but I keep getting hung up on tiny little issues. It is like trying to build a house ...

Deciding on a language: Python or Java

I am part of a small (read: two programmer) startup, and we are about to start developing a large (we estimate it will be about a year before customers will see anything) web application… And it's come time to pick a language. Most of the experience I have is with Python, most of my co-worker's experience is in Java and C++, but they wo...

Removing Optional Elements from XML when invalid

I have a piece of xml that contains optional non-enumerated elements, so schema validation does not catch invalid values. However, this xml is transformed into a different format after validation and is then handed off to a system that tries to store the information in a database. At this point, some of the values that were optional in...

Internet Board Games

Hello I'm looking to create a web-page where users can play Gomoku live with eachother, kind of like instantchess.com, or yahoo's online pool. I would like to be able to.. 1) Have the players to chat with each other while they play. 2) Have registered users where a ranking can be kept track of. 3) Users can create 'rooms' where another ...

J2EE Download Link

Hi, I know this is a stupid question and I really have been looking around for a few hours... but how can I get J2EE? I would like the j2ee and j2eeadmin tools. What do I download I have downloaded and installed the jdk-6u16-windows-i586 (Java SE Development Kit 6u16 for Windows) Can someone point me in the right direction? Thanks....