javabeans

JavaBeans validation in a desktop application

人盡茶涼 提交于 2019-12-13 05:12:59
问题 I'm looking for a non-trivial validation support for my desktop java application. In JavaEE6 there is a new validation model. Is there a way to use it in a desktop application? 回答1: I haven't used them personally in a pure Java SE environment, but JSR 303 Bean Validation has a reference implementation in Hibernate Validator. Also, the Spring Framework provides JSR 303 validation support: 6.7 Spring 3 Validation 来源: https://stackoverflow.com/questions/9693656/javabeans-validation-in-a-desktop

How to set nodevalues to Bean and add to ArrayList of Beans

我的未来我决定 提交于 2019-12-13 03:24:41
问题 I am parsing a rss feed based on the elements of node and set it to a bean object. Later, I need to store this in an ArrayList of beans. Looks like I am doing wrong at setting the bean value and also adding it to ArrayList of beans. Here is my code: public static void main(String arg[]) { ArrayList<RssBean> list = new ArrayList<RssBean>(); RssBean bean = new RssBean(null, null, null); String xmlRecords = "<rss>" +"<channel>"+ " <item>" + " <title>John</title>" + " <description> Desc1 <

Custom form new user error in Alfresco

梦想的初衷 提交于 2019-12-13 02:21:50
问题 How can I make a custom user profile ? I want to add a new field to the users in Alfresco... I try to use this : http://ecmarchitect.com/archives/2012/02/27/1555, the code : http://ecmarchitect.com/images/articles/alfresco-people/someco-people.zip... Important code: SignUserFactory.java package com.someco.share; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.Map; import org.alfresco.web.site.SlingshotUserFactory; import org.json.JSONException; import org

JavaBeans Introspector does not correctly find property with interface hierarchy type

本秂侑毒 提交于 2019-12-13 02:11:41
问题 I read the JavaBeans specs but I found nowhere this behavior. Is it a bug ? testPropertyType fails because expects Data class testPropertyReadable succeed because DefaultBean.getMyData returning Data method exists testPropertyWritable fails because no DefaultBean.setMyData(Data) method does not exists Tested on JavaSE 6 import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import org.junit.Test; public class DefaultBeanTest { @Test public void

The value for the useBean class attribute is invalid [duplicate]

耗尽温柔 提交于 2019-12-13 01:43:26
问题 This question already has answers here : JasperException: The value for the useBean class attribute is invalid (6 answers) Closed 3 months ago . I am new in JSP and trying to to simple power calculater. So I take 2 numbers from user and later I get result of calculation and show on page. Here is my bean class: package org.mypackage.power; public class MyPow { private double base; private double pow; private double result; MyPow() { base = 0; pow=1; } /** * @return the base */ public double

JSF - Why setter is not called this time?

青春壹個敷衍的年華 提交于 2019-12-13 01:28:30
问题 As usual, i've some trouble by using some ajax call on a requested scoped bean. I've this Bean : @ManagedBean @RequestScoped public class ArticlesSelector implements Serializable { @ManagedProperty(value="#{param.type}") private String type; private String zone; private String order; @PostConstruct public void init() { if(type==null || type.trim().isEmpty()) { this.type="1"; } if(zone==null || zone.trim().isEmpty()) { this.zone="list"; } if(order==null || order.trim().isEmpty()) { this.order=

Getting DataSource resource in a Java web app

孤街浪徒 提交于 2019-12-12 20:46:46
问题 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.jdbc.Driver" url="jdbc:mysql://localhost:3306/myDB" /> </Context> I am developing a Java web app using the Stripes framework in NetBeans. How can I get this resource from within

Is there a good way to diagnose spring bean/service creation problem?

爱⌒轻易说出口 提交于 2019-12-12 19:10:32
问题 My project uses spring and spring-dm for bean/service configuration. When I try to import an old project which also use spring for DI, bean will not be created. An example to make clear, I first define a url-alias in spring-appContext.xml <bean name="xxxx" class="XRegistry" init-method="init"> <property name="webRoot" value="/WebContent"></property> <property name="alias" value="/test"></property> <property name="cAliasPattern" value="/test/*.do" /> <property name="conConfigFile" value="ddd

JSP cant find bean Class using “” modifiers

不问归期 提交于 2019-12-12 15:17:05
问题 Hey I'm using Netbeans for my IDE and I'm getting an error when I try to run my EJB program. I get an error when I declare and give the path of the class in my JSP to a bean. <jsp:useBean id="book" class="BookBean.Book" scope="application" /> <jsp:setProperty name="book" property="*" /> When I run the program I get this error javax.servlet.ServletException: java.lang.InstantiationException: class BookBean.Book : java.lang.IllegalAccessException: Class java.beans.Beans can not access a member

Instantiation of bean failed : Specified class is an interface

牧云@^-^@ 提交于 2019-12-12 13:32:47
问题 I am facing an issue while creating a bean for dependency injection. Here is the scenario. I am dealing with MongoDB repository, I have also created a class which uses it. I am trying to instantiate bean instance of both. MongoDB reporsitory: @Repository public interface ProductGlobalTrendRepository extends MongoRepository<ProductGlobalTrend,String>{ public ProductGlobalTrend findByPid(@Param("pId") String pId); } The class which is using it: @Service @Scope("singleton") public class