beans

Creating a java servlet web application

We have to create a web application for a school project and I'm wondering what best practices are when creating a web application using java servlets, beans and jsp. Specifically I'm curious about servlets. Should a single servlet be created with many methods depending on which page is requested (a single controller) or should a servle...

iterate over classes ie. beans for asp.net

Lets say I have a class that stores user information complete with getters and setters, and it is populated with data from an XML file. How would I iterate over all of the instances of that class like you would do with java beans and tag libraries? ...

java.beans.Introspector getBeanInfo does not pickup any superinterface's properties

I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example: public interface Person { String getName(); } public interface Employee extends Person { int getSalary(); } Introspecting on Employee only yields salary even though name is inherited from Person. Why is this? I wo...

JSP bean tag for property that might not exist

In JSP I can reference a bean's property by using the tag ${object.property} Is there some way to deal with properties that might not exist? I have a JSP page that needs to deal with different types. Example: public class Person { public String getName() } public class Employee extends Person { public float getSalary() } In J...

Word Wrap in Net Beans

I'm just learning to code in java. Netbeans is great but I just found there's no way to wrap text in it (or hopefully I haven't found it yet). Is there any way to do this, and if not, is there any similarly good IDE for Java with this functionality (hopefully free as well). Thanks. ...

Swing Matisse GUI - cannot add custom made bean to "Other components"

I made a custom ValueObject class with properties (getters/setters) and I need this class for data binding of elements on form. So I want to drag it to "other components" on matisse editor so I can bind it - and nothing happens.... Any similar experiences? The same issue is happening both on NetBeans 6.5 and MyEclipse 7.0M2 ...

java ee | ejb3 | runtime dispatch

Hi, I would like to call an ejb3 at runtime. The name of the ejb and the method name will only be available at runtime, so I cannot include any remote interfaces at compile time. String bean = 'some/Bean'; String meth = 'doStuff'; //lookup the bean Object remoteInterface = (Object) new InitialContext().lookup(bean); //search the meth...

Is there a tool to generate web pages based on Java beans?

Is there a tool that will take you java beans (pojos) and automatically make them a form for a webpage? To be more clear I have a bunch of Jaxb objects that I want to be able to display in a form without having to code a bunch of html. Is there a tool that will read the jaxb objects and generate the editable form for me? Also, this ne...

Using a jsp bean in a session.

I am using a JSP bean and when I do an assignment to a new object, it gets over-written on a submit to the previous object. <jsp:useBean id="base" class="com.example.StandardBase" scope="session" /> ... //base object id = 396 base = new Base() //base object id = 1000 and on a resubmit of the page I get <jsp:useBean id="base" class="...

Java Beans: What am I missing?

I'm wondering if I'm missing something about Java Beans. I like my objects to do as much initialization in the constructor as possible and have a minimum number of mutators. Beans seem to go directly against this and generally feel clunky. What capabilities am I missing out on by not building my objects as Beans? ...

spring bean configuration

Hi, I want to specify a file system path as part of a Spring bean configuration. I know that I can set a path such as: <bean id="myBean" class="com.example.BeanImpl"> <property name="path" value="/WEB-INF/jsp"/> </bean> An the path /WEB-INF/jsp is interpreted as being relative to the web application root. But how do I specify a pat...

jdesktop beans binding question

If I bind three properties (A on B and A on C) in READWRITE mode, and if C is changed shouldn't B also be changed in chain? I have a situation in which A is changed but change wouldn't propagate to B ...

How to map different Java-Bean structures onto one another

In our project we have to map one nested structures of beans onto another. (These are actually JAXB mapped Java-Representations of XML documents that, say, represent an incoming order document.) This has to be mapped onto the quite different order document structure of another system. What are the options to do this? I would prefer some...

How do I get my netbeans drag and drop widget to know whether it is rendering inside the netbeans design view window or the running application?

How do I get my netbeans drag and drop widget to know whether it is rendering inside the netbeans design view window or the running application? I'm trying to do some custom rendering. I think it has to do with the root container. ...

JavaBeans Comparison

Hi, Does anyone know about a free open source library (utility class) which allows you to compare two instances of one Java bean and return a list/array of properties which values are different in those two instances? Please post a small sample. Cheers Tomas ...

how to generically compare entire java beans?

Hi, I've been trying to grok the org.apache.commons.beanutils library for a method/idiom to evaluate for equality all properties between 2 instances i.e. a generic equals() method for beans. Is there a simple way to do this usnig this library? Or am I going about this the wrong way? Thanks. ...

getting a property of a java bean of unknown class

Hello, I'd like to be able to call "getProgram" on objects which have that method, without knowing which class they belong to. I know I should use an interface here, but I'm working with someone else's code and can't redesign the classes I'm working with. I thought BeanUtils.getProperty might help me, but it seems it only returns strings...

JGoodies Binding vs. JSR 295

Hello, What is the practical difference between JGoodies Binding and JSR 295, Beans Binding? They both seem to be intended for the same purpose and get their job done (with slightly different approaches). JGoodies Binding is more mature, but JSR 295 is eventually getting part of JDK in Java 7. Using a standard part of JDK is surely pre...

How can I create a class file dynamically?

I want to create a class file dynamically. Here it goes... With the given ResultSet, extracting the metadata I want to build a class file dynamically with getter and setter methods for all the columns that exist in ResultSet. Also I should be able to use this class file generated where ever I want in my later use. Can any body suggest me...

Common algorithm for generating a diff of the fields in two beans?

Let's say you have two instances of the same bean type, and you'd like to display a summary of what has changed between the two instances - for example, you have a bean representing a user's settings in your application, and you'd like to be able to display a list of what has changed in the new settings the user is submitting (instance #...