java

How to use the anchor system with a <h:commandLink /> ?

Hello everyone, Env : IE7 & FireFox3.5, jsf1.2, richfaces3.3.X, seam2.2.0, jboss5.1 I have a very long xhtml form, and somewhere in the middle, the user have to fill a dataTable, then click a button (i use here a commandLink) that will post the dataTable, compute things, and validate the data. Then, the user wants to continue filling ...

How to use @GeneratedValue in a non pk field

Hello, I would like to know how we could use a sequence in JPA. We have a non-pk field which value must come from a sequence in DB. How could I update that value updating the entity? Thanks in advance. ...

How to remove non digits?

private String removeNonDigits(final String value) { if(value == null || value.isEmpty()){ return ""; } return value.replaceAll("[^0-9]+", ""); } Any better way to do this? Does StringUtils of Apache has a similar method? ...

How to check the end of the array

I have an array of type int matrix[][] and it has values of 0 and 1 000000000 101010111 000010100 110011001 the values are different to the above, however this is a random example. What i need to do is, loop through the first row when column = 0 and row = 0 adding 1 to row to loop if a one is found add it to a variable when i ...

Why Java language does not offer a way to declare getters and setters of a given "field" through annotations ?

I actually happily design and develop JEE Applications for quite 9 years, but I realized recently that as time goes by, I feel more and more fed up of dragging all these ugly bean classes with their bunch of getters and setters. Considering a basic bean like this : public class MyBean { // needs getter AND setter private int m...

Check if a String only contains digits and the digits are not the same using REGEX?

111111111 - Invalid A121278237 - Invalid 7777777777 - Invalid 121263263 - Valid 111111112 - Valid ...

question based on installer

How to make an installer for java application in mac what are the different steps for it ...

Java Exception Hierarchy problem

I have a curious issue here In my ejbCreate() method from where i insert the front-end populated field vales into the database , there is Null checking done, so the nullable fields are converted to ""(empty space) fields and the row is inserted properly into the Database. Now my ejbstore() method doesnt have the same null checking so...

Java Remove empty XML tags

I'm looking for a simple Java snippet to remove empty tags from a (any) XML structure <xml> <field1>bla</field1> <field2></field2> <field3/> <structure1> <field4>bla</field4> <field5></field5> <structure1> </xml> should turn into; <xml> <field1>bla</field1> <structure1> <field4>bla</fi...

From Java code to UML diagram

Is there any software that can make UML diagrams from my Java code? ...

wsdl2java ant task: howto include wsdl file name in java file comment

We're generating Java files from WSDL descripitons using the axis-wsdl2java ant task. <axis-wsdl2java url="${src.dir.etc}/wsdl/BLAH.wsdl" output="${build.dir.generated_src}" timeout="240000" testcase="false" verbose="true" skeletondeploy="false" serverside="false" debug="false" helpergen...

Log4J Custom Fields

Introduction: I'm trying to get additional fields to log with log4j, and its working but only when I create an appender in code and not in the log4j.properties Progress: Used this article Adding Conversion Characters to PatternLayout for log4j 1.1.3 Made a sample app for log4j 1.2 Problem: using the properties file it will run but...

xjc binding file for <extension base = "anyType"/> throws error

I have xsd defination <element name="primaryKey" nillable="false"> <complexType mixed="false"> <complexContent mixed="false"> <extension base="anyType"/> </complexContent> </complexType> </element> and i using binding file to <jxb:bindings node="//xs:extension[@base=...

java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment issuses faced while running our applet based app on linux

Hi. We have built applet in our application extending javax.swing.JApplet. of late we have been facing issue of X11GraphicsEnvironment while running in linux environment, browsing through various forums we came across solution of this issue by setting -Djava.awt.headless=true in JAVA_OPTS of run.conf file. but this results in HeadlessE...

Why am I getting handshake_failure with Java SSL cert?

I'm trying to use Hudson (which uses SVNKit) to access a Subversion repository that requires a client certificate to access it. I can access the same repository using the same client certificate via Eclipse (also using SVNKit). When Hudson tries to check out the repository, it fails with: org.tmatesoft.svn.core.SVNException: svn: Recei...

How to properly catch RuntimeExceptions from Executors?

Say that I have the following code: ExecutorService executor = Executors.newSingleThreadExecutor(); executor.execute(myRunnable); Now, if myRunnable throws a RuntimeExcpetion, how can I catch it? One way would be to supply my own ThreadFactory implementation to newSingleThreadExecutor() and set custom uncaughtExceptionHandlers for the...

Converting Json to Java

Hi all, I want to be able to access properties from a json string within my java action method. The string is available by simply saying myJsonString = object.getJson(); Below is an example of what the string can look like: {'title': 'Computing and Information systems','id':1,'children': 'true','groups': [{'title': 'Level one CIS','id...

Maven Assembly Problem

Hi, I have a maven multiple-module project, which is giving me headaches in the assembly:assembly phase. I have a module which has an assembly defined in it which works fine when I invoke mvn assembly:assembly using that pom. The problems start when I go up one level to the parent pom and invoke assembly:assembly ... everything goes f...

TreeMultimap in Google Collections

Has anybody used TreeMultimap in Google Collections? I understand that with a TreeMultimap, its keys and values are ordered by their natural ordering or by supplied comparators. I was wondering if there is a function that allows user to supply a key and returns all the values whose keys are greater than the user-supplied key. This can be...

ClassFormatError: 56 while using hessian in j2me

I am trying to use the hessian j2me implementation @ http://hessian.caucho.com/ using java me sdk 3.0. http://hessian.caucho.com/doc/hessian-overview.xtp#Hessian%20Client%20for%20a%20cell-phone mentions the usage for j2me. The application builds without any errors/warning. But, the moment the line where MicroHessianOutput is instantia...