java

struts2 StringTemplate support

I'm looking for a struts2 StringTemplate result type. Given an action result I'd like to render the html using StringTemplate. There are struts2 result types for Velocity, FreeMarker etc but I haven't been able to find one for StringTemplate, Google doesn't help. Has anyone seen such result type? Or perhaps this is something that mysteri...

java 1.4 -sql server2000:is it safe to append text to String in java of size in gbs.

i am dynamically creating sql query for inserting multiple records in one hit.Suppose no of record to be inserted is 1000.in that case sql query will be generated as below in code String insertBatchSqlQuery=""; for(int currentRecordIndex=0;currentRecordIndex<totalNoOfRecords;currentRecordIndex++) { insertBatchSqlQuery+=getSQL...

Question about return statements.

import java.util.Scanner; public class GregorianYear { private int year; public GregorianYear(int a) { year = a; } public void SetYear() { System.out.println( "The year is: " ); Scanner kbd = new Scanner( System.in ); year = kbd.nextInt(); } public int getYear() { ...

Open containing directory in Windows Explorer from IntelliJ

Is there a way (keyboard shortcut?) to open the folder of the currently opened file in Windows Explorer? What I mean is this: When a java source file is open in IntelliJ, I'd like to open Windows Explorer on the folder containing that file. Is there a short way of doing that? ...

Installing IBM JRE on Windows (a non-IBM machine)

I'm developing a Java 5.0 application that connects to Websphere Application Server default messaging queues. My application will be deployed on Windows server (with sun JDK installed by default), in order to connect to the Websphere queues I have two choices: Using IBM JRE Using sun JRE, copying some IBM JRE's jars, setting some JVM ...

How to follow the origin of a value in Java?

I have a variable that very rarely gets an incorrect value. Since the system is quite complex I'm having trouble tracing all the code paths that value goes through - there are multiple threads involved, it can be saved and then loaded from a DB and so on. I'm going to try to use a code graph generator to see if I can spot the problem by ...

Accesing an remote enterprise bean within a simple Java class

Here's my Java class import endpoint.NewSessionRemote; import javax.naming.Context; import javax.naming.InitialContext; public class HelloClient { public static void main(String[] args) { try { Context ctx = new InitialContext(); NewSessionRemote hello = (NewSessionRemote) ctx.lookup("endpoint.NewSe...

AccessControlException when using Spring Security with OpenID

Hello, I try to implement Spring Security with OpenID in Google App Engine but I am getting a 'java.security.AccessControlException: access denied' for the RequestURI /j_spring_openid_security_chec It is working fine if I use '-D--enable_all_permissions=true' as VM Argument. Any ideas? Thanks, Ralph ...

Suggest Web Host for Java in windows environment

Hi, Please suggest the good and cheap web host with java language support in windows env. I am familiar with windows,apache tomcat,mysql,java and searching for best deal. ...

Which method should I use?

I'm an intermediate java coder, writing a librarian Java app, and for some reason I just can't figure out whether I should use dueDate.after(today) OR dueDate.before(today) method as to deciding if the book is overdue. I've gotten quite some contradictory values by typing both the methods. Hence, I'm also assuming there is some other bug...

Play single midi woodblock note on Java?

I'm planning to create my own metronome (woodblock instrument) using Java that could set its bpm, volume, etc. And I have tried over 16 channels (MIDI 1.0 specification) obtained from getChannels() but there is no woodblock heard at all. Here's the code taken from http://www.jsresources.org /* * Turn the note on on MIDI channel 1...

Properties for dev and production

I have a GlassFish/j2ee application, and I develop on one box, and production is a remote box. I have a function that makes files, and I need the files' location to be different based on my dev box or production. What is an automatic way to do the switching so I do not have to edit the source file based on where it is being deployed? ...

How to iterate over plain text segments with the Jericho HTML parser

Hi, For a Jericho Element, I am trying to find out how to loop over all child nodes, whether an element or plain text. Now there is Element.getNodeIterator(), but this references ALL descendants within the Element, not just the first descendants. I need the equivalent of Element.getChildSegments(). Any ideas? Thanks ...

Not thread safe Object publishing

Reading Java concurrency in practice, section 3.5: Claim is raised that public Holder holder; public void initialize() { holder = new Holder(42); } Besides the obvious thread safely hazard of creating 2 instances of Holder the book claims a possible publishing issue can occur, further more for a Holder class such as public Hold...

alternative to if statement in java

I am curious to see any alternative(s) to the regular if statements such as if(x) do a; if(y) do b; if(z) do c; so as you see all if statements are seperate and no else condition. Please notice that X Y Z are totally seperate conditions so switch wouldn't fit. ...

If more than one thread can access a field should it be marked as volatile?

Reading a few threads (common concurrency problems, volatile keyword, memory model) I'm confused about concurrency issues in Java. I have a lot of fields that are accessed by more than one thread. Should I go through them and mark them all as volatile? When building a class I'm not aware of whether multiple threads will access it, so s...

Request-reply model for hybrid SOAP over HTTP/JMS over middleware

One of our products implements the following one-way web service structure: Server <--------------------- Middleware <---------------- Client SOAP over JMS (queue) SOAP over HTTP In this model, clients send SOAP messages over HTTP to our middleware (Progress SonicMQ). The messages get pushed into JMS queues by Son...

2D Drawing in Netbeans 6.x

How can i draw 2d in a JPanel that i have on my GUI? I can do it in eclipse but am having trouble doing it in netbeans. I've looked for some tutorials but the only good one i found was for netbeans 5.5 (world's fasted java netbeans 5.5 tutorial) and i guess netbeans removed some of the things needed for that tutorial. ...

What's the coolest thing you've used Bytecode injection/insertion (BCI) for?

What's the coolest thing you've used Bytecode injection/insertion (BCI) for? * Dumb logging doesn't count (unless you've managed to made it unique in some creative way). ** Not only in Java. ...

recommendation for choosing a new web development stack

I work in a medium to small team ( 10 people ) developing and supporting several web enterprise applications. We have a dozen of them built with a house-made framework with asp-classic working against ms-sql server. We are evaluating the migration to a new development stack. We'd like it to be open (free) and simple. I've been look...