Search Results

Search found 71 results on 3 pages for 'javabeans'.

Page 1/3 | 1 2 3  | Next Page >

  • JavaBeans and DSLs

    - by Aaron Digulla
    It's 2009 and we still all hold on the JavaBeans despite all their flaws, mostly because of the tooling support which we wrote in our own blood. But now we have method chaining and internal DSLs and some pressure to replace or extend JavaBeans with DSL classes. Has anyone an implementation that implements PropertyDescriptor for a DSL (where the getters and setter use the exact same name as the property) and a way to hook that into the Java RT so I don't need to create them all by myself?

    Read the article

  • can i use javabeans with hibernate ?

    - by Dilllllo
    Hello i'm using a plugin of hibernate2 in my webproject with jsp ,in my project i have a register page. Can i use javabeans to send information from a html <form> using hibernate class's ? with out hibernate i creat class with get and set like that package com.java2s; public class Lang { private String choix; private String comm; public String getChoix() { return choix; } public void setChoix(String choix) { this.choix = choix; //System.out.println(choix); } public String getComm() { return comm; } public void setComm(String comm) { this.comm = comm; // System.out.println(comm); } } but i know that hibernate generate a get and set class ! and recive it with that : <jsp:useBean id='user' class='com.java2s.Lang' type='com.java2s.Lang' scope='session' /> <jsp:setProperty name='user' property='*'/> any idea how to do that ?

    Read the article

  • Why javabeans framework create the IndexedPropertyDescriptor for the NON index method

    - by George Macus
    I'm not familiar with java beans framework, in the below scenario, I got the IndexedPropertyDescriptor for the method getFooWithX, could someone explain why? public class IntrospectorTest { public static void main(String[] args) throws IntrospectionException { BeanInfo info = Introspector.getBeanInfo(SubClass.class); PropertyDescriptor[] descriptors = info.getPropertyDescriptors(); for (int i = 0; i < descriptors.length; i++) { System.out.println(descriptors[i].getClass().getName() + ":" + descriptors[i].getName()); } } } abstract class BaseClass { public abstract Object getFoo(); } abstract class SubClass extends BaseClass { public Object getFooWithX(int x) { return null; } } and the result will be: java.beans.PropertyDescriptor:class java.beans.PropertyDescriptor:foo java.beans.IndexedPropertyDescriptor:fooWithX Why?

    Read the article

  • Oracle Enterprise JavaBeans (EJB) Developer Certification

    - by user33716
    I would like to gain the "Oracle Enterprise JavaBeans (EJB) Developer" certification. According to this page I have to take a number of classes each of which costs up to a couple of thousand GB£. Is this really the only way to obtain the certification? Can I not just buy a certification guide book from amazon and just sit the requisite tests? At the moment I have no Java EE experience and I'm finding it impossible to get interviews for the jobs I'm interested in. I'm hoping this will at least help me get my foot through the door.

    Read the article

  • Short survey on Enterprise JavaBeans usage

    - by Thomas Harris
    Hello, I would be very appreciative if anyone who has any experience with using Enterprise JavaBeans, or who considered, but rejected the use of EJBs would respond to a short survey. The survey consists of eleven (11) questions, and should take five (5) minutes or less to complete. I am collecting this data for a class that I am taking. The URL for the survey is http://cs.createsurvey.com/c/89/9089/survey/11793-UCyRqE.html Thank you very much in advance for your participation! Regards, Tom Harris

    Read the article

  • Technical Article: Oracle Magazine Java Developer of the Year Adam Bien on Java EE 6 Simplicity by Design

    - by janice.heiss(at)oracle.com
    Java Champion and Oracle Magazine Java Developer of the Year, Adam Bien, offers his unique perspective on how to leverage new Java EE 6 features to build simple and maintainable applications in a new article in Oracle Magazine. Bien examines different Java EE 6 architectures and design approaches in an effort to help developers build efficient, simple, and maintainable applications.From the article: "Java EE 6 consists of a set of independent APIs released together under the Java EE name. Although these APIs are independent, they fit together surprisingly well. For a given application, you could use only JavaServer Faces (JSF) 2.0, you could use Enterprise JavaBeans (EJB) 3.1 for transactional services, or you could use Contexts and Dependency Injection (CDI) with Java Persistence API (JPA) 2.0 and the Bean Validation model to implement transactions.""With a pragmatic mix of available Java EE 6 APIs, you can entirely eliminate the need to implement infrastructure services such as transactions, threading, throttling, or monitoring in your application. The real challenge is in selecting the right subset of APIs that minimizes overhead and complexity while making sure you don't have to reinvent the wheel with custom code. As a general rule, you should strive to use existing Java SE and Java EE services before expanding your search to find alternatives." Read the entire article here.

    Read the article

  • Servlet, JSP, JavaBeans and HTML form

    - by dedalo
    Hi, I'm working on a servlet that makes a connection to a database gets the information of one of the tables ans sends this information to a jsp file. This file will print on the brower the information table, adding radio buttons that allows us to choose one of the rows. The servlet looks like this: List<InfoBean> items = new ArrayList<InfoBean>(); if (!conexion.isClosed()){ Statement st = (Statement) conexion.createStatement(); ResultSet rs = st.executeQuery("select * from lista_audio" ); while (rs.next()) {items.add(getRow(rs));} conexion.close();} req.getSession().setAttribute("items", items); In the JSP file I can print a table with the information, adding radio buttons that the user will use to choose 1 row and send the selected info to a servlet using a form I can add: < form action="administ" method=get enctype=multipart/form-data> < table> < table border=\"1\">< tr>< th>Title< /th>< th>Author< /th>< th>Album< /th>< /tr> < c:forEach items="${items}" var="item"> < tr>< td><input type="radio" name="SongInfo" value=${item.title}> < td>${item.title}< /td> < td>${item.author}< /td> < td>${item.album}< /td>< /tr> < /c:forEach> < /table> In the field 'value' I should be able to send to the servlet the information stored in ${item.title}. When I set value = ${item.title} and title is, for example "The bodyguard", in the servlet the information I can retrieve is just "The". It looks like it sends the characters located before the first white space of the string. How could I get the whole string? Thanks

    Read the article

  • Newbie question about Java

    - by Rob Nicholson
    Okay, I know that Java is a language but somebody has asked me if they can write a web application to interface in with a web app I've written in ASP.NET. I'm implementing a web service to serve up an XML so it's pretty language agnostic. However, I'm not 100% sure whether going down the Java route makes a lot of sense. I was kind of expecting PHP or ASP.NET server side code with maybe some Ajax/JavaScript or maybe a heavier client JavaScript program using JScript. Could some kind sole explain the basic Java environment when it comes with webapps. I've inferred the following - am I barking up the right tree? Java when run like ASP.NET is called JSP JavaBeans is a bit like the .NET framework, i.e. it's a library of re-usable components Java EE is a bit like ASP.NET in that it's a framework for building web pages on a server Java can also run on the client but it needs the Java VM installing When running Java on the client, can you use JavaBeans and is there a framework? Can it also use JScript? I don't think so as JScript is JavaScript library. Whilst running Java on the server would be okay, this is a relatively small application and therefore Java sounds like a bit of overkill. PHP or ASP.NET feels a better fit. But I don't think they should go down the Java applet in the browser and it adds complexity that's not needed. Thanks, Rob.

    Read the article

  • JSP application scope objects in Java library

    - by FrontierPsycho
    I am working on a preexisting web application built with JSP, which uses an external Java library. I want to make some JavaBeans that were instantiated with jsp:useBean tags available to the Java code. What would be a good practice to do that? I suppose I can pass the objects in question to every function call that requires them, but I'd like to avoid that.

    Read the article

  • Can I pass data into a HashMap<String,Object> from JSP to a JavaBean?

    - by Parris
    Hi Everyone, I am just starting out with JSP, Java, etc web development... I would love to use some sort of framework, but for this project I can't do that. In any case I want to potentially pass essentially limitless data (for flexibility) to my javabeans. My idea was if I can have key value pairs that would really easy. The values will always be strings or integers. HashMap seems ideal in this case. Is this possible? Any ideas? Can I do this with JSP Bean tags or should I write scriptlets? Thanks!!!

    Read the article

  • [java bean]hibernate Session breaks a java bean?

    - by blow
    Hi all, i have a simple JPanel bean in my projects, now i want to drag my panel bean class into my jframe. My panel bean class is like this: public class BeanPanel extends javax.swing.JPanel { /** Creates new form BeanPanel */ public BeanPanel () { initComponents(); Session session=HibernateUtil.getSessionFactory().openSession(); } This code seem to break the bean: Session session=HibernateUtil.getSessionFactory().openSession(); When i try to drag the class into my JFrame bean i had this error message: This component cannot be instantiated. Please make sure it is a JavaBeans Component If i comment it all works fine. What is the reason of this? Thanks.

    Read the article

  • SUPER CSV write bean to CSV.

    - by ButtersB
    Here is my class, public class FreebasePeopleResults { public String intendedSearch; public String weight; public Double heightMeters; public Integer age; public String type; public String parents; public String profession; public String alias; public String children; public String siblings; public String spouse; public String degree; public String institution; public String wikipediaId; public String guid; public String id; public String gender; public String name; public String ethnicity; public String articleText; public String dob; public String getWeight() { return weight; } public void setWeight(String weight) { this.weight = weight; } public Double getHeightMeters() { return heightMeters; } public void setHeightMeters(Double heightMeters) { this.heightMeters = heightMeters; } public String getParents() { return parents; } public void setParents(String parents) { this.parents = parents; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public String getProfession() { return profession; } public void setProfession(String profession) { this.profession = profession; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public String getChildren() { return children; } public void setChildren(String children) { this.children = children; } public String getSpouse() { return spouse; } public void setSpouse(String spouse) { this.spouse = spouse; } public String getDegree() { return degree; } public void setDegree(String degree) { this.degree = degree; } public String getInstitution() { return institution; } public void setInstitution(String institution) { this.institution = institution; } public String getWikipediaId() { return wikipediaId; } public void setWikipediaId(String wikipediaId) { this.wikipediaId = wikipediaId; } public String getGuid() { return guid; } public void setGuid(String guid) { this.guid = guid; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEthnicity() { return ethnicity; } public void setEthnicity(String ethnicity) { this.ethnicity = ethnicity; } public String getArticleText() { return articleText; } public void setArticleText(String articleText) { this.articleText = articleText; } public String getDob() { return dob; } public void setDob(String dob) { this.dob = dob; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getSiblings() { return siblings; } public void setSiblings(String siblings) { this.siblings = siblings; } public String getIntendedSearch() { return intendedSearch; } public void setIntendedSearch(String intendedSearch) { this.intendedSearch = intendedSearch; } } Here is my CSV writer method import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import org.supercsv.io.CsvBeanWriter; import org.supercsv.prefs.CsvPreference; public class CSVUtils { public static void writeCSVFromList(ArrayList<FreebasePeopleResults> people, boolean writeHeader) throws IOException{ //String[] header = new String []{"title","acronym","globalId","interfaceId","developer","description","publisher","genre","subGenre","platform","esrb","reviewScore","releaseDate","price","cheatArticleId"}; FileWriter file = new FileWriter("/brian/brian/Documents/people-freebase.csv", true); // write the partial data CsvBeanWriter writer = new CsvBeanWriter(file, CsvPreference.EXCEL_PREFERENCE); for(FreebasePeopleResults person:people){ writer.write(person); } writer.close(); // show output } } I keep getting output errors. Here is the error: There is no content to write for line 2 context: Line: 2 Column: 0 Raw line: null Now, I know it is now totally null, so I am confused.

    Read the article

  • Cannot bind text field to selected item in JTable in NetBeans

    - by titaniumdecoy
    I am trying to use NetBeans to bind a JTextField to the selected element of a JTable. The JTable gets its data from an AbstractTableModel subclass which returns Cow objects. At present, each Cow object is displayed as a string through its toString method. The binding seems obvious but does not work; the bound value of the text field is always null. I bound the text property of the JTextField in NetBeans to: flowTable[${selectedElement.prefix}] This produces the following line of generated code: org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, flowTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.prefix}"), courseNameTextField, org.jdesktop.beansbinding.BeanProperty.create("text")); What am I doing wrong?

    Read the article

  • XStream JavaBeanConverter not serializing properties

    - by Steve Foster
    Hello All, Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng something simple, or not understanding XStream's converter handling well enough. @XStreamAlias("test") public class TestObject { private String foo; public String getFoo() { return foo; } public void setFoo(String foo) { this.foo = foo; } } public void test() throws Exception { XStream x = new XStream(new XppDriver()); x.autodetectAnnotations(true); x.processAnnotations(TestObject.class); x.registerConverter(new JavaBeanConverter(x.getMapper())); TestObject o = new TestObject(); o.setFoo("bar"); String xml = x.toXML(o); System.out.println(xml); /* Expecting... <test> <foo>bar</foo> </test> But instead getting... <test> <foo/> </test> */ } I tried adding a trace on the TestObject.getFoo() method and it appears it is being called by XStream, but the data isn't being written to the output stream. After looking at the source for JavaBeanConverter, it looks like my implementation should work, which leads me to believe I haven't configured something correctly during the XStream setup. Am I just missing something simple? Thanks! Edit Also, if it helps, I'm using the following Maven deps for this... <dependency> <groupId>org.apache.servicemix.bundles</groupId> <artifactId>org.apache.servicemix.bundles.xstream</artifactId> <version>1.3_3</version> </dependency> <dependency> <groupId>org.apache.servicemix.bundles</groupId> <artifactId>org.apache.servicemix.bundles.xpp3</artifactId> <version>1.1.4c_3</version> </dependency>

    Read the article

  • How to convert a Java object (bean) to key-value pairs (and vice versa)?

    - by Shahbaz
    Say I have a very simple java object that only has some getXXX and setXXX properties. This object is used only to handle values, basically a record or a type-safe (and performant) map. I often need to covert this object to key value pairs (either strings or type safe) or convert from key value pairs to this object. Other than reflection or manually writing code to do this conversion, what is the best way to achieve this? An example might be sending this object over jms, without using the ObjectMessage type (or converting an incoming message to the right kind of object).

    Read the article

  • Beans, Lists and JSP

    - by Luigi 1982
    Hi at All I have a little question... On my JSP page I have a List of beans. I want to extract a sublist of beans with a specific property (Ex. all Horror books). Can Apache Beanutils help me? Thanks in advance...

    Read the article

  • Java Interface Usage Guidelines -- Are getters and setters in an interface bad?

    - by user68759
    What do people think of the best guidelines to use in an interface? What should and shouldn't go into an interface? I've heard people say that, as a general rule, an interface must only define behavior and not state. Does this mean that an interface shouldn't contain getters and setters? My opinion: Maybe not so for setters, but sometimes I think that getters are valid to be placed in an interface. This is merely to enforce the implementation classes to implement those getters and so to indicate that the clients are able to call those getters to check on something, for example.

    Read the article

  • Place the business logic in Java Beans?

    - by Lirik
    I was reading this page and I found the following statement: MVC in Java Server Pages Now that we have a convenient architucture to separate the view, how can we leverage that? Java Server Pages (JSP) becomes more interesting because the HTML content can be separated from the Java business objects. JSP can also make use of Java Beans. The business logic could be placed inside Java Beans. If the design is architected correctly, a Web Designer could work with HTML on the JSP site without interfering with the Java developer. Interestingly in my textbook I pulled the following quote: In the MVC architecture... the original request is always handled by a servlet. The servlet invokes the business logic and data access code and creates beans to represent the results (that’s the model). Then, the servlet decides which Java Server Page is appropriate to present those particular results and forwards the request there (the JSP is the view). The servlet decides what business logic code applies and which JSP should present the results (the servlet is the controller). The two statements seem slightly contradicting. What is the best way to use beans: should we place business logic in them or should we only place results in them? Are there ways in which beans are inadequate for representing a model?

    Read the article

  • Recommended Bean Utility Libraries for Java

    - by Jim Ferrans
    I'm looking for a good, well-supported, and efficient Java library that uses reflection to automate JavaBean operations. These include making a deep copy of an arbitrary bean hierarchy (with nested lists and maps of beans), comparing two bean hierarchies for deep equality, and "transmorphing" one bean to another of a different class. Some possibilities include Apache Commons BeanUtils, Spring's BeanUtils, and Java's Bean support. Which libraries would you recommend?

    Read the article

  • Java - Custom PropertyEditorSupport to display units

    - by I82Much
    All, I'm trying to make the properties of my node have Units associated with the measure. ( I am using the JScience.org implementation of JSR 275) So for instance, public class Robot extends AbstractNode { // in kg float vehicleMass; @Override public Sheet createSheet() { Sheet s = Sheet.createDefault(); Sheet.Set set = s.createPropertiesSet(); try { PropertySupport.Reflection vehicleMassField = new PropertySupport.Reflection(this, float.class, "vehicleMass"); vehicleMassField.setValue("units", SI.KILOGRAMS); vehicleMassField.setName("vehicleMass"); set.put(vehicleMassField); PropertyEditorManager.registerEditor(float.class, UnitInPlaceEditor.class); } catch (NoSuchMethodException ex) { Exceptions.printStackTrace(ex); } s.put(set); return s; } } I want my UnitInPlaceEditor to append the units to the end of the string representation of the number, and when the field is clicked (enters edit mode) for the units to disappear and just the number becomes selected for editing. I can make the units appear, but I cannot get the units to disappear when the field enters editing mode. public class UnitsInplaceEditor extends PropertyEditorSupport implements ExPropertyEditor { private PropertyEnv pe; @Override public String getAsText() { // Append the unit by retrieving the stored value } @Override public void setAsText(String s) { // strip off the unit, parse out the number } public void attachEnv(PropertyEnv pe) { this.pe = pe; } } Here's a screenshot of the display - I like it like this.. but here's the value being edited; note the unit stays there. Basically I want one value (string) to be displayed in the field when the field is NOT being edited, and a different to be displayed when user starts editing the field. Barring that, I'd like to put a constant jlabel for the units (uneditable) to the right of the text field. Anyone know how to do this?

    Read the article

  • Between a jsf page and a managed bean, why the getter method is called twice

    - by Bariscan
    Hi, I have a jsf page with a form has an outputtext in it. The value of outputtext component is called from a backing bean (or managed bean). I know when I code it as #{MyBean.myString} Jsf rename it and calls getMyString() method. However the wierd thing is, when I put a breakpoint to the getter method of this component, I see it is called twice during the page is being rendered. The outputtext is in a h:form, and it is the only component wich is bind to a backingbean. I mean, it is so wierd that jsf should get the value when it first come to the getter method, however it needs to go to the getter method twice. Can you explain what is the reason of this behaviour in jsf? Any help would be appreciated, Best wishes, Baris

    Read the article

  • Have problem understanding the id/name of java bean

    - by symfony
    In an XmlBeanFactory (including ApplicationContext variants), you use the id or name attributes to specify the bean id(s), and at least one id must be specified in one or both of these attributes. Does it mean the following are legal? <bean id="test"> <bean name="test"> But this is illegal: <bean non_idnorname="test"> you may also or instead specify one or more bean ids (separated by a comma (,) or semicolon (;) via the name attribute. Does it mean I can specify multiple ids this way: <bean name="id1;id2,id3"> Can someone convince my doubt?

    Read the article

1 2 3  | Next Page >