beans

jsp:setProperty equivalent for servlet

Is there an equivalent to: <jsp:setProperty name="beanName" property="*"/> for servlets? Something that will auto-populate the bean from inside a servlet using the request parameters? I'm refactoring a JSP-only application and would like to move some of the code to servlets. For a bunch of tragic reasons, we are not able (right n...

Java Beans: Overglorified Associative Arrays?

I don't understand the nature of Java Beans that well. Well, at least how I see them used in some code-bases that pass through our shop. I found this question: http://stackoverflow.com/questions/315142/java-beans-what-am-i-missing The accepted answer there makes it look like programmers tend to abuse Java Bean (which I really don't do...

How do you load a bean into Spring MVC's application context?

As I understand it, Spring MVC application has two distinct contexts, the application context and the web context, which are controlled by applicationContext.xml and dispatcher-servlet.xml, respectively. Inside my controllers, how do I go about loading a bean into either of these contexts? Note that I am aware of Getting Spring Applica...

How to get the id of a bean from inside the bean in Spring?

What is the easiest way to retrieve a bean id from inside that bean (in the Java code) without using a BeanPostProcessor to set a field? The only way I can think of is something like this using a BeanPostProcessor: public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { ((MyBean)bean).set...

warning in faces-config.xml integrating spring with jsf

Hello, I am trying to integrate spring into a jsf application. In faces-config.xml I have included this: <application> <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> </application> but it shows a weird warning which I...

Stripes ActionBean URL bindings

I'm trying to set up the Stripes calculator example application using Eclipse. I'm able to run the .jsp on the server, but as soon as I invoke an ActionBean by clicking one of the buttons (such as "add"), I get: ActionBeanNotFoundException: Could not locate an ActionBean that is bound to the URL [/quickstart/Calculator.action] This ma...

Best way to manually pull a spring bean?

How do I pull a spring bean manually? I have a rather large web application, and in a given service, a transient object requires access to a bean that is machine specific (database connection info.) Since the application runs in a cluster, this transient object (which can bounce between servers) always needs to grab the correct connectio...

Threads in Session Beans

Hi, I have a session bean that uses Bean managed txns. This bean has one business method that simply delegates the control to a POJO which takes care of all the processing. Here this POJO starts and closes transactions (UserTransaction). Now the question is can I span new threads in the POJO so that I can create a new thread when I nee...

Spring MVC dynamically binding to and from a list of beans

Hi, I am new to spring MVC.In my application I need to bind dynamically generated textbox contents to a list of beans dynamically.I went through the spring mvc book for binding to lists.But before binding, we must not only initialize the collection, but populate it with objects. In my case I dont know the size of the list initially. ...

Monitoring Changes of a Bean to build deltas?

Hi StackOverflow! I have several Beans in my Application which getting updated regularly by the usual setter methods. I want to synchronize these beans with a remote application which has the same bean classes. In my case, bandwidth matters, so i have to keep the amount of transferred bytes as low as possible. My idea was to create delt...

Howto handle a POJO like a bean?

How can I access a simple java object as a bean? For example: class Simple { private String foo; String getFoo() { return foo; } private void setFoo( String foo ) { this.foo = foo; } } Now I want to use this object like this: Simple simple = new Simple(); simple.setFoo( "hello" ); checkSettings( ...

java beans: difference between persistent field and persistent property?

I got the impression that if we use persistent fields, there is no need for getter methods since the entity manager references the instance variables directly. However, when I removed the getter and setter methods from an entity to have persistent fields, the values for the corresponding instance variable was not retrieved from the datab...

Copy java object/class from one classloader to another classloader

Hi is there a way to copy one class loaded context (atrributes etc) from one classloader (for instance a 'made' class Point) to another classloader? Making clear, Example: I have an object Point on CL 1. Now running on another CL2, I want to creat this object in CL 3. Some obj: class Point { int x; int y; public Point() {} //getters...

Java Beans - creating an inspector window

I'm wondering whether there is an existing Java class that, given a Java bean, uses introspection to find all the publicly modifiable fields, and displays them using default PropertyEditors. I see a bunch of information about BeanInfo, PropertyEditor, Bean Customizers, but nowhere can I find actual examples. Basically I want the functi...

spring ioc injecting conrete implementation of interface to test

Hi, I have the following setup: @Component public class ImplOne implements IFace{ } @Component public class ImplTwo implements IFace{ } public interface IFace{ } I am trying to get a reference of ImplOne by type: @RunWith(SpringJUnit4ClassRunner.class) public class ImplOneTest { @Autowired private ImplOne impl; @Test publ...

JBoss Bean Statistics in Web-Console

I would like to use the JBoss web-console to view bean statistics. I read in a book ("JBoss: A Developer's Notebook") that bean invocation statistics are visible when drilling down through web-console's tree. There's even a tantalizing screenshot of individual bean data showing "the total number of invocations processed is recorded, al...

What is the need of a Custom Persistence Framework in Java?

We have a custom Persistence Framework wrapping the Entity Beans. I want to know why is this required or does it have any performance improvement when we already have Entity Beans (CMP) why the persistence framework is required. ...

Why creating protected properties in beans is counted a bad practice?

What I mean is: public class SomeBackingBean { protected String someString; public void setSomeString (String str) { this.someString = str; } public String getSomeString { return someString; } } It was just a general case for a general answer. Now second example: public abstract class AbstractBean<T ...

Call a method of session beans that deployed on the remote machine

I wrote a EJB session beans and deployed it on the GlassFish application server. i can call it easily with @EJB annotation from a local JSF web application but i dont know how to call it from a JSF web application that deployed on the remote machine (another machine). can i dot this with @EJB annotation and how ? ...

Accessing Spring beans from servlet filters and tags

I can access Spring beans in my Servlets using WebApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); in the Servlet's init method. I was wondering is there an equivalent of the WebApplicationContext for servlet filters? Also, is it possible to access Spring beans i...