javabeans

MVC Model to View event dispatch implementation

The MVC pattern wants that Model dispatches change status events to View. Which is the best implementation of this comunication if the Model is a simple javabean with setter and getter methods? ...

Problem creating subreport for Javabeans datasource in iReport 3.7.0

Hi, I am using iReport 3.7.0. The subreport wizard screen do not show my any Javabean class to select. Please let me know if anybody has encountered this problem and got a solution. Creation of PersonDatasource: Source code for the Javabeans avialable at http://www.brucephillips.name/jasperreports/examplesource.zip ...

Non-trivial Dozer mappings

I'm struggling to get Dozer to bend to my will for something that I feel should be quite simple. I have two similar models that I wish to map between, however one has a 'deeper' hierarchy than the other and this is causing me problems when dealing with collections. Consider the following classes: Source classes: class Foo { String ...

What is a "Java Bean"?

The name really throws me off. I'm hoping someone can explain it in a way I won't forget :) ...

Where is the JavaBean property naming convention defined?

The Spring Framework API doc says: The convention used is to return the uncapitalized short name of the Class, according to JavaBeans property naming rules: So, com.myapp.Product becomes product; com.myapp.MyProduct becomes myProduct; com.myapp.UKProduct becomes UKProduct. I looked at Suns website to find a definition, but didn't ...

jsp, servlets, faces and beans?

i´ve read a little about java's structure and could someone tell me if my view of all these components are correct: JSP corresponds a View Servlet corresponds a Controller Bean corresponds a Model Faces correspond layouts to render display is this roughly correct? ...

Eclipse ignoring source when deploying webapp

Hey, I'm running eclipse with tomcat 5.5. For some unknown reason from one day to the other eclipse stoped compiling my beans and java files that are in the source folder. If I go to the work directory, I find all the JSP compiled, the folders of the packadges i have, but no classes compiled inside of them. Neither eclipse, nor tomcat ...

Java beans, annotations: What do they do? How do they help me?

Here is what what I understand so far: Java beans are just to help other things (visual things?) interact with your code. I think that this is mostly for UI stuff because it is easier to design this visually. Is it bad practice to use Java beans for non-UI things? Java beans have getter and setter methods (bad OOP practice) and are...

Dynamic injection of bean properties based on a locale variant in Spring

Consider the following class DialgBean.java, which defines the properties of a dialog box on a web page. Below is the class and its bean definition public class DialogBean{ private int height; public void setHeight(int height) ... } <bean id="dialogBean" class="org.springhelp.DialogBean"> <property name="height" value="${dial...

how can I integrate formBean to my Spring MVC?

My application is using Spring MVC. On the way from the Controller to the view we are taking adventage of this framwork by creating a bean of the model that is used to display the relevant properties through the JSP. On the way back however, meaning after submitting a form back to the controller, it is using a raw HTTPRequest instead o...

Using a bean class from a servlet in a Java EE application

Hello all, I just started to study Java EE and made some examples (Just Hello World and some a bit more complicated). Now I'm doing a small application myself for learning purposes. I made an EAR, an EJB and an WAR just like in this example but, instead of working with interfaces, I'm working with real classes. In summary, EJB and WAR ...

Why doesn't my JavaBean icon display?

I'm using Netbeans 6.7.1 on Windows Vista, I've got a JavaBean component that works as it should and this has an associated BeanInfo class where I've set Icon 32x32 Color property to a 32x32 gif file located on the classpath. I've also set the 16x16 Color property similarly. I've added the bean to the palette but the icon displayed is t...

Getting DataSource resource in a Java web app

I have the following resource tag in my context.xml file: <?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/myApp"> <Resource name="jdbc/myDS" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="1000" username="user" password="passwd" driverClassName="com.mysql.jdb...

OpenCms - periodically change content of a file

Hi! I'm customizing my OpenCms installation and have created an object that delivers part of my content. The object changes this content once in an hour. Could you please advise me as to how to load this bean at OpenCms startup so that it resides in memory and is able to set up its timer? ...

How do you display an array of objects using JavaBeans in JSP

public class Controller implements Serializable { private Admin[] users; private String[] names; public String[] getNames() { names = new String[] {"Joseph", "Lawson", "Shylet", "Norest"}; return names; } public Admin[] getUsers() { List<Admin> usersList = retrieve(); users = new Admin[usersList.size()]; int z = ...

How to use a single JavaBean in many pages accross a JSP frameset

Hi I have a bean declared on a page that holds a frameset <jsp:useBean id="pos" class="MyBeanscope="page"> <jsp:setProperty name="a" property="a"/> </jsp:useBean> [some initialisation of MyBean] <frameset ... > <frame src="/myframe1.jsp"...> <frame src="/myframe2.jsp"...> </frameset> My question is, how do I access MyBean i...

Why use javabean bound properties instead of events?

What exactly is the point of bound properties? To me they seem to be a less type-safe version of events using EventObjects - it seems a bit weak to be using string equality checking for event.getPropertyName(). Why would you use one over the other? ...

use the c:out tag on a String

Inside my jsp page, I have a string I want to show, but it might contain '<' or some other character that I want to escape so it will not mess up the rest of the HTML. I know c:out can do this, but as far as I understood, it can only work on bean properties, and not on a simple string. Is there a way of doing something like <c:out va...

Why are Managed Beans not loaded in Tomcat?

Hi, I created a JSF 2 web application with facelets. The libs for JSF where stored at tomcat/lib, to share it between several applications. I thought maybe it would be better to store the libs inside the WEB-INF/lib folder of the application, to get the application more independent from server configurations. Now when I start tomcat vi...

How do I set JSP UseBean values from a servlet

I am writing a web application that uses a JSP usebean tag in the session scope as shown below <jsp:useBean id="userSession" class="project.session.UserSession" scope="session" /> I have also written a filter which does some processing and needs to set some values on the userSession bean. How do I get a handle onto the object and set ...