java

Difference between Apache Tapestry and Apache Wicket

Apache Wicket ( http://wicket.apache.org/ ) and Apache Tapestry ( http://wicket.apache.org/ ) are both component oriented web frameworks - contrary to action based frameworks like Stripes - by the Apache Foundation. Both allow you to build your application from components in Java. They both look very similar to me. What are the differen...

struts-tiles

I have developed a simple struts application which retrieves and manipulates customer data from the database. Now I want to include an image at the top of all the pages. I know tiles is the best way to do it. Since I'm a newbie can anyone help me to include an image in my existing project using tiles. Thanks in advance ...

Struts & bean

I have two questions : 1) Where do we call a bean in struts (what is the exact line through which we call the bean and from which file) and how the getter and setter methods are called? 2) Also we are fixing the scope as request or session or something else, I can understand that the values will be stored in the request object or ses...

Unsetting a variable in Velocity

Is it possible to set a Velocity reference to 'null' or 'undefined'? The Velocity template language reference says #set - Establishes the value of a reference Format: # [ { ] set [ } ] ( $ref = [ ", ' ]arg[ ", ' ] ) Usage: $ref - The LHS of the assignment must be a variable reference or a property reference. ...

Best way to rearrange an ArrayList in Java

What is the best way to rearrange elements in an list? I need the ability to move elements to move elements in the list, one step back or forward in the index. I was thinking of getting the index of the item, adding it at index -1 / +2 and removing the old reference. Is there a faster way to handle rearranging without creating duplicat...

Java WebServiceException: Undefined port type with JBoss

I am new to Web Services with JBoss. A client is connecting to an EJB3 based Web Service With JBoss AS 5 and JDK 6 using JAX-WS. I am stuck with the following exception: Exception in thread "main" javax.xml.ws.WebServiceException: Undefined port type: {http://webservice.samples/}HelloRemote at com.sun.xml.internal.ws.client.WSServiceDe...

How can I take links from a user and display them in my page properly?

I am developing a Java project in which I will take the text from a user in a textArea and generate an HTML page with that text. I want to allow the user to add links in the generated HTML Page. As I am taking the page contents from the user, I also need to take the link name and the URL from the user. How can I provide this functiona...

Is there an easy way to Calculate and format time/date intervals in java?

I'm familiar with the the date and time classes in the JDK and their associated formatting methods. I may be blind, but I cannot find an equivalent set of classes for processing time intervals. For example, I would like to display the number of days for a given long value of milliseconds. I realize that the method to do these conversions...

Where are java classes stored in Oracle?

Where is the java bytecode for loaded java classes stored within an oracle database? Specifically, is there a view or table I can use to obtain the raw bytes for java class schema objects within Oracle? ...

Another JQuery encoding problem, on IE

Hi all, I'm coding an italian website where I need to validate some input data with an xhr call. My code for the ajax request's like this (I'm using JQuery 1.3.2): $.ajaxSetup({ type: "POST", timeout: 10000, contentType: "application/x-www-form-urlencoded; charset=iso-8859-1" }); $.ajax({ url: "ajaxvalidat...

How to stream mp3 using pure Java

Is it possible to stream mp3s using pure Java? If so, what are the best resources to implement this. If not, are any other music formats streamable using Java only? ...

A non-deprecated exact equivalent of Date(String s) in Java?

I have old code that uses new Date(dateString) to parse a date string. Compiling the code produces the deprecation warning Date(java.lang.String) in java.util.Date has been deprecated. The javadoc unhelpfully advises me to use DateFormat.parse(), even though the DateFormat class does not have a static parse method. Now, I know how to u...

How do I organize my java packages in our web mvc project?

Do you have any good tips on how should i organize class packages for my java project? We are usually building web MVC projects and our structure is something like this com.company.project.model.* - all model classes com.company.project.service.* - all service classes com.company.project.service.entity.* - service classes related to pa...

Open-closed principle and Java "final" modifier.

The open-closed principle states that "Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification". However, Joshua Bloch in his famous book "Effective Java" gives the following advice: "Design and document for inheritance, or else prohibit it", and encourages programmers to use the "...

Graphics.drawImage() in Java is EXTREMELY slow on some computers yet much faster on others

I'm having a strange problem, basically in Java Graphics.drawImage() is extremely slow on some computers and faster on others. This isn't related to the computers power either, some weaker computers run it fine while some stronger ones seem to choke up at the drawImage call. It may or may not be related to the width and height, I have a...

Installing Tomcat + Solr problem

Hi, I'm trying to install Tomcat + Solr on my Ubuntu machine. I was using ubuntu repo: http://packages.ubuntu.com/intrepid/web/solr-tomcat5.5 http://packages.ubuntu.com/intrepid/tomcat5.5 When i launch tomcat, solr do not work: sudo service tomcat5.5 start The webpanel do not find solr, and give me this error: HTTP Status 404 - /...

Seam: Stream File Contents To Area On Page

HI all, I was just wondering if someone could give me some guidance on the best way to output the contents of a file to a user using a Seam application. I've got a proportion of my application that I would like to display the contents of a log file in. This log file could be quite large so I don't want to load it into memory - I want ...

Java: What is the best way to find elements in a sorted List?

I have a List<Cat> sorted by the cats' birthdays. Is there an efficient Java Collections way of finding all the cats that were born on January 24th, 1983? Or, what is a good approach in general? ...

Static methods

I've just had an argument with someone I work with and it's really bugging me. If you have a class which just has methods like calculateRisk or/and calculatePrice, the class is immutable and has no member variables, should the methods be static so as not to have to create an instance of the class each time. I use the following example: ...

use eclipse classpath in ant tasks

Hi there, I want to use Ant to deliver a JAR file, how can I use the Eclipse classpath in my Ant task? Greets, Tobias ...