beans

Having spring bean properties refreshed automatically from properties file

I'm using Spring 2.5.6. I have a bean whose properties are being assign from a property file via a PropertyPlaceholderConfigurer. I'm wondering whether its possible to have the property of the bean updated when the property file is modified. There would be for example some periodic process which checks the last modified date of the pro...

How to enumerate and initialise beans in spring/jsf

After my user logins, i'd like to enumerate all of the beans faces-config and initialize selectivly some of the beans, what is the best way of doing this? The beans are initialized by spring when the application session starts, but not just after the login process (via JAAS) finishes. I guess I'm asking how to enumerate the beans liste...

Json <-> Java serialization that works with GWT

I am looking for a simple Json (de)serializer for Java that might work with GWT. I have googled a bit and found some solutions that either require annotate every member or define useless interfaces. Quite a boring. Why don't we have something really simple like class MyBean { ... } new GoodSerializer().makeString(new MyBean()); new...

Do I need to worry about concurrency with tomcat spring beans?

Not quite understanding enough about java, do I need to worry about concurancy issues when listing, and changing DTO objects in my spring java beans in a single server tomcat application? ...

Serialize Object in GWT

What's the simplest way to serialize a bean to a string using GWT? I prefer not to use GWT.create() invocations. ...

What is the namespace to use for adding JSP taglib support into facelets pages?

Something like the following xmlns:jsp="http://java.sun.com/JSP/Page" seems to not work, any hint? alternatively how can I inject beans into JSF lifecycle flow at startup without the filter usage? ...

Auto-cast Spring Beans

Is there a way to auto-cast Spring beans to the class defined in the application context XML? I'd like to avoid putting type information about the beans in 2 places.... in the xml configuration file and also in the code as a cast. For instance, given this config file <bean id="bean-name" class="SimpleSpringBean" scope="prototype"> ...

How to copy properties from one Java bean to another ?

I have a simple Java POJO that I would copy properties to another instance of same POJO class. I know I can do that with BeanUtils.copyProperties() but I would like to avoid use of a third-party library. So, how to do that simply, the proper and safer way ? By the way, I'm using Java 6. ...

Access managed bean from separate web application on same server?

I have two applications. The first called app1 is a JSF 1.2 application. The second called app2 is a basic Servlet application. Is it possible to access a specific managed session bean in app1 from app2? Both are deployed on the same server. Thanks Tom ...

In a Tomcat cluster, how to share beans in an application?

This might sound like a dumb or a simple question, but I really have little to no experience with clustering of any kind and I'm just curious if and how a certain scenario is possible. Let's say I've set up a cluster of N Tomcat instances, and I've deployed my application App1 across all N instances. What would I need to do to be able ...

How to bind a bean property to another one and observe changes in Spring Framework

Hi, I'm wondering that if there is a way for binding a spring bean's property to another bean's property so if any change on binded property occurs in runtime, what i expect is referencing bean's property also changes. I'll explain more with a little code snippet. <bean id="johnHome" class="example.Contact"> <property name="phone...

How to have a class use applicationContext beans?

I'm working on my first java struts2 webapp and want to be able to inject bean parameters into any arbitrary class that is called. But I find that I can only do this with struts action classes... Let's say I have this bean in my applicationContext.xml file: <bean id="BeanTest" class="BeanTest"> <property name="test" value="someval...

Should I add support for PropertyChangeSupport and PropertyChangeListener in a Java bean for a web application?

I noticed that some people write beans with support for the Property Change observer pattern. import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.Serializable; public class SampleBean implements Serializable { public static final String PROP_SAMPLE_PROPERTY = "sampleProperty"; priva...

How to access another bean form in an Struts Action?

I have a form bean named "SearchForm" that I use to display search results. The user then clicks on one of the element. I populate a "ElementForm" with the details of the element and generate a JSP page with it. (so far so good) What I would like however is to display a column on the left of the JSP page with the same search results (so...

Can you program Java collections to an interface and use Serializable?

I've gone through and programmed all my domain level logic to interfaces. Now I find that when I want to put data in a bean, the bean doesn't work because the Collection interfaces (Collection, List, Set, etc) do not implement Serializable. Do I need to refactor all my code to use concrete types or is there a better course of action her...

How to read in Database Connection parameters?? Web.xml or via Managed Bean??

I have a web application that will be run on a windows 2003 server box. A http link will launch the web application(a jsp form) and that application opens up an oracle database(in the constructor). Different users will be using this application and each user will be sending his or her own username, password as well as the servername and ...

How many Beans should be enough ?

Hi . I'm a undergrad Student at a German University. I have a team Programming Course .. where we have to use JavaEE/JSF to make a social networking site .. like LinkedIn. Anyway my group has created a lot of beans. Which IMHO is too much . <?xml version='1.0' encoding='UTF-8'?> <!-- =========== FULL CONFIGURATION FILE ============...

problem with dbConnection, reading in context-params from web.xml

i have some jsp code that reads in Servlet Context parameters from a web.xml file. these parameters hold database connection information so each time the SID or user/password or servername changesm, the programmer doesnt have to go re-code; the user can just change the web.xml file. <context-param> <description>database user name</des...

How to change the Entity EJB mapping in RAD back-ends folder.

We are maintaining a J2EE enterprise application that uses EJB Entity beans and we use IBM Rational Application Developer as development platform. The application currently has a few Entity beans so a corresponding back-ends folder has already been created by somebody and is available. Oracle 9i was used for creating the back-end folder...

Backing bean scopes. How they works?

I have some misunderstanding with JSF backing bean scope. I am newbie in JSF and now write simple project and all my beans mostly have session scope. But if my site will have many users that's mean my session will be very very big and this kill my server. Some people said my that solution is use request scope beans. But, for example, whe...