java

problem with JSF h:commandButton

Hello everybody. I really need help on this one. I am having a simple login form in jsp file, and i try to use JSF and managed beans with it. When i first fire page it is displaying it content, however when push the submit button (h:commandButton) i am getting an error. Can somebody tell me what is wrong with my code ? error: javax.s...

getResourceAsStream not working for every class?

Hi, I have a jar file that uses some txt files. In order to get them it uses Class.getResourceAsStream function. Class A { public InputStream getInputStream(String path) throws Exception { try { return new FileInputStream(path); } catch (FileNotFoundException ex) { InputStream inputStream = getClass().getResou...

Netbeans/Eclipse extracting GUI code

Is there a plugin that would allow me to design the GUI in eclipse or netbeans and then extract the source code to be used in another environment? I am much more comfortable using emacs for my development but gui design is much easier with a WYSIWYG environment. What i am looking for is design the frame in eclipse/netbeans and then extr...

JPA: Should I clean up my entity classes using orm.xml?

I currently use JPA annotations only, but I really don't like that I'm polluting my entity classes with so many ORM details which really aren't relevant to their behavior (e.g. table name, id generation strategies, join columns...). I see that DataNucleus recommends putting ORM-related annotations in XML instead (those colored in pink),...

Crystal Report DB authentication in java

Dear All, I'm facing a problem in Crystal Report with Eclipse. I am using a servlet to render the crystal report viewer by writing the viewer object to the response like: public class ReportViewer extends HttpServlet { @SuppressWarnings("deprecation") public void doGet(HttpServletRequest request, HttpServletResponse response) ...

Android project using httpclient --> http.client (apache), post/get method

Hi all, I'm doing a Get and Post method for an android project and I need to "translate" HttpClient 3.x to HttpClient 4.x (using by android). My problem is that I'm not sure of what I have done and I don't find the "translation" of some methods... This is the HttpClient 3.x I have done and (-->) the HttpClient 4.x "translation" if I hav...

where i can learn about JVM debugger protocol ?

Hello all i want to do test and build simple debugger GUI in c++ that debugging Java as i read from view docs i will have to work with the JVM debugger protocol do any one here have experience with it? where can i learn about it ? Thanks ...

java printing on paper - formating output for print

Hello, I have a java desktop application with information about several entities. There is a "print" button than WHEN pressed various information should be collected and printed. The question is: How can i select WHAT will be printed ON a specific location on the paper? A more general question would be: How can i format information t...

Jibx: Integrate base class output into extending class output

I have this class model: abstract class A { int a; } class B extends A { int b; } class C extends B { int c; } And I'd like to get jibx to output this XML: <B b=1 a=0> <children> <C c=2 b=1 a=0/> </children> </B> I have this binding xml: <binding> <mapping class="A" abstract="true"> <value nam...

Swing: Creating a draggable component...?

Hello! I searched the web for examples of draggable Swing components, but I found either incomplete or non-working examples. What I need is a Swing component that can be dragged by the mouse inside an other component. While being dragged, it should already change its position, not just 'jump' to its destination. I would appreciate ex...

Thinking about naming of utility classes in java

I am looking for naming guidlines for non functional (utility) extensions of the common classes. In C# I used to use some of this: 1) ListExtensions, too long but with extension methods ListExtensions never appears. Usage is just. var productList = new List(); productList.MyExtendedMehod(); 2) ListHelpers. This was in old C# 2.0 era,...

how to add without DUPLICATION?

How can i add new characters in my JTextArea without duplication…it is when i pressed my add JButton using JAVA..here’s my code i made 2 classes (Form and FormRunner) looking forward for someone who could HELP thnx in advance… SORRY FOR long code -PaLoS(newbie) in JButtons i really need the HelP most public class Form extends JFrame{ ...

Why don't Java Wrapper Classes have no-arg constructors?

What is the rationale of not providing no-arg constructors in Wrapper Classes? I know that they were inherently built for Wrapping primitive types, so the right way is to provide a primitive type for constructors. But considering primitive types have no-arg constructor, why don't they have one? Besides, if they had no-arg constructors,...

How/where to deploy my webapp

hi, I have a built small web app using java/j2ee. I want to host it my self in my own servers (i have none now). I have already downloaded ubuntu server OS. I am complete new Bee. I am just learning things now. I prefer to host my app my own servers (preferably using Linux, Apache and MySQL) rather than google app engine or anyother ho...

Sectioned List in Java/Swing?

I have a list of items in a JList for the user to select. Since it's a lot of items (say, cities in states), I want to divide the list into sections. The section headings should not be selectable, though. So for my cities/states example, this might look like this: State 1 City 1 City 2 City 3 State 2 City 4 City 5 City 6 It would...

Most specific subclass for a Java object?

I have two classes A and B, where B is subclass of A and A is not abstract. Therefore I can have objects that are instance of A and objects that are instance of B (and therefore of A). How can I distinguish objects that are only instance of A? Sure, I can write something like "object instaceof A && !(object instance of B)" but this is...

How can I force Java's HttpClient to accept invalid cookies?

I'm working on a script that logs into WordPress, however, HttpClient's cookie policy identifies the cookies set by WordPress to be invalid: May 17, 2009 12:07:43 PM org.apache.commons.httpclient.HttpMethodBase processCookieHeaders WARNING: Cookie rejected: "$Version=0; wordpress_dce2080bc042b2e639e4f5b3b704aa43=admin%7C1243786064%7C4c5...

String and Final

What is difference between in the following statements String name = "Tiger"; final String name ="Tiger"; Although the String class is final class, why do we need to create a String "CONSTANT" variable as final? ...

Getters/setters in Java

I'm new to Java, but have some OOP experience with ActionScript 3, so I'm trying to migrate relying on stuff I know. In ActionScript 3 you can create getters and setters using the get and set keywords, meaning you create a method in the class and access data through a property of an instance of that class. I might sound complicated, but...

Regex for tree structures?

Are there regular expression equivalents for searching and modifying tree structures? Concise mini-languages (like perl regex) are what I am looking for. Here is an example that might clarify what I am looking for. <root> <node name="1"> subtrees .... </node> <node name="2"> <node name="2.1"> data </node> oth...