bean

how to get http get request params in jsf 2.0 bakcing bean?

Hi all, I having trouble with passing http get parameters to jsf 2.0 backing bean. User will invoke URl with some params containing id of some entity, which is later used to persist some other entity in db. whole process can be summarized by fallowing: 1. user open page http://www.somhost.com/JsfApp/step-one.xhtml?sid=1 2. user fills s...

Best JDBC data source bean class

I see that some people use org.apache.commons.dbcp.BasicDataSource while other configurations have com.mchange.v2.c3p0.ComboPooledDataSource. Spring has its own: org.springframework.jdbc.datasource.DriverManagerDataSource There are probably even more. But which one is best? I have a JPA/Hibernate three tier application that needs co...

What is an Enterprise Java Bean really?

On the Tomcat FAQ it says: "Tomcat is not an EJB server. Tomcat is not a full J2EE server." But if I: use Spring to supply an application context annotate my entities with JPA annotations (and use Hibernate as a JPA provider) configure C3P0 as a connection pooling data source annotate my service methods with @Transactional (and use A...

What is an Eclipse Sprint STS "Config Set" good for?

I have the Spring STS plugin activated within my Eclipse project. Doing this enabled many cool Spring features including specialized management of Spring bean files. However, I noticed that the project settings for Spring allows for the creation of "Config Sets" -- which look like groups of bean configuration files. I cannot find do...

Are Java Beans as data storage classes bad design?

Usually JavaPractices.com is a good site with good idea's, but this one troubles me: JavaBeans are bad. The article cites several reasons, mainly that the term JavaBean means "A Java Bean is a reusable software component that can be manipulated visually in a builder tool." not Data storage, violates certain patters, and is more complex...

Injecting into Validator or EntityListener?

I'm trying to do some validation of complex constraints on Hibernate entities in a JBoss JEE system. For that purpose, I need my validator (whether it be an actual JSR303 validator or just an EntityListener for PrePersist/PreUpdate/PreRemove) to have access to my DAO beans. Much perusal of JSR303 stuff doesn't give me any indication that...

Injectin Session Bean to Session Scope Managed Bean

Consider that we inject a stateless session to a stateful session bean/seesion scoped JSF managed bean and the stateful session bean has multiple methods. Will the injected stateless session bean reference remain the same or will be available across multiple method calls? ...

Diff between two instances of same class

I have two instances of the same class. I need to find property(s) which are different amongst them (basically value of the property, say firstName might be different in both). The fields are primitive, complex as well as collections. Basically, I need to find differences between two instances and if the fields are different in both the...

How to change the value of an attribute of a bean in list?

I am having a list of bean, now i want to change the value of an attribute of all the beans in the list. For example: class Person{ String name; int age; String attrXYZ; /* accessors and mutators */ } List<Person> lstPerson = getAllPersons(); //set the attribute attrXYZ of all persons in the list to 'undefined' On...

Accessing a JSF managedBean from a Servlet

Hello all. I need to know what's the best method for accessing a JSF managedBean (which is defined having application scope) from a servlet. Currently I have something like this in my servlet: MyApplicationScopeBean bean = null; try { FacesContext fContext = FacesUtil.getFacesContext(req, resp); ServletContext sc = (ServletCon...

Java - Add custom event Listener to a eventSet in beanInfo with Netbeans

Hi all, i have a custom bean and a custom eventListener, i need to show my event Listener in the events tab of my bean. I think the solution is to add my event Listener to a beaninfo(i create it with netbeans, so it is auto-generated). There is a "wizard-way" to do this, or i have to hand-write my beaninfo? Thanks. ...

java bean property editor "Image chooser"

Hello, I am creating a java bean that extends JPanel. I have created a new property called 'backgroundImage'. I would like it to have an 'Image chooser' popup like the JLabel 'icon' property. a) My basic (possibly erroneous) understanding is that I need to define the Property Editor Class of 'backgroundImage' in the BeanInfo file. Is ...

Get field by field mapping in dozer

Hello! I am using dozer to map bean properties. The way I do it is : dozerMapper.map(sourceClass, destClass). This returns entire mapped class. However, Is there a way to get what individual property is mapped to? E.g if SourceClass has propA, is there a simple way to get the corresponding property in DestClass to which propA is mapped ...

JSF, postback and database alteration

Hi, I'm using JSF, Google App Engine, and OpenSessionInView (using Filter and ThreadLocal). My bean has a private field List<A> allElements; The property getAllElements() retrieves from the database the data, the first time, i.e. when allElements == null. In the page, I have a dataTable binded with {#MyBean.allElements}. Finally, the...

JSF - First steps - Bean doesnt work

Hi. Im moving first steps into JSF framework. I so make these jsp/bean : index.jsp : <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> <%@ taglib prefix="h" ...

binding form parameters to a bean using just Servlets and JSP - possible?

I am using Servlet and JSP without a framework to study for my SCWCD. I have a simple form that I want the parameters to bind to a bean automatically. Is this possible without writing binding code or using a framework? Thanks ...

Spring: Bean property not writable or has an invalid setter method.

Hi guys, I'm experimenting with Spring, I'm following the book: Spring: A developer's notebook. I'm getting this error: "Bean property 'storeName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?" .. and I'm quite lost. I have an ArrayListRentABike class wh...

java session bean - reload data?

Here's what I want to do. It seems simple, but I can't get it to work. JSP1 - user fills out form, submits to JSP2. JSP2 populates the form values in a Bean and displays data, and offers user option to return and modify (history.back()), or submit to Servlet. I've come up with three different options, and each has problems. OPTION 1: JS...

Calling bean functions from javascript

I have the following bean method signatures: public String foo(); public List<String> getList(String bar); public String getName(String baz); The following works for me: $("#div_id").append('<%= beanId.foo() %>'); The following is what I would like to do, but is a little more complex though, and I can't get it to work. var...

Dynamic java bean from xsd

Hello, I have two applications, one acting as client and the other as server. In server application I generate ObjectFactory and classes using xjc from Eclipse. As a result, one of this classes is called widgetEvenCall. From the xsd: ... <xs:element name="widgetEventCall"> <xs:complexType> <xs:sequence> <xs:elem...