javabeans

Head start JavaServer Faces

霸气de小男生 提交于 2019-12-12 02:24:52
问题 I have a couple of probably common thoughts on JavaServer Faces (JSF) which I want to clear up. Is it possible to just add a Java Class and Call methods inside it from a JSF (x) Page? I can't see how this even could be an issue knowing to do when you program Java and develop webapplications. However, I can't seem to find a concrete and straight forward guide on this. As a side-note I am using JDeveloper from Oracle. I want to be able to just create a JSF Page as easy as I create a ASP.NET

Javabean Introspector - what is in my List?

北城以北 提交于 2019-12-12 01:47:00
问题 I use this code to find out all Java List in a given class: BeanInfo beanInfo = Introspector.getBeanInfo(classx); PropertyDescriptor[] propertyDescriptors = beanInfo .getPropertyDescriptors(); for (PropertyDescriptor pd : propertyDescriptors) { Class<?> ptype = pd.getPropertyType(); if ((ptype+"").contains("java.util.List")) { System.out.println("list class property: " + pd.getName() + ", type=" + ptype); } } This is the output: class property: value, type=interface java.util.List The

struts 2 bean is not created

你离开我真会死。 提交于 2019-12-12 01:46:18
问题 At first some precondition to my question, I'm using struts2 + tiles2 + toplink. NO spring at all. The simplest scenario - is to display list of entities on the page. To optimize resolving JPA's EntityManager I would like to create helper (JPAResourceBean) that implements lazy load of entity manager. For this purposes I'm going to use struts2's bean declaration: <bean name="myfactory" class="my.model.JPAResourceBean" scope="session" optional="false"/> Why bean is not instantiated neither in

Pass a bean like a property of another bean (struts 1.x)

◇◆丶佛笑我妖孽 提交于 2019-12-12 01:33:23
问题 I have two forms (and the corresponding form beans), one on page1.jsp and another on page2.jsp (this second form is dinamically created via json). The form1 is of mypackage.MyActionForm1 type, while the form2 is of mypackage.MyActionForm2 type. In the Action executed when the first form is submitted, I create a MyActionForm2 and set the MyActionForm1 form as its property: MyActionForm2 secondBean = new MyActionForm2(); secondBean.setBeanProp(form1); request.setAttribute("secondbean",

Spring AOP, declare-parents cast exception

余生颓废 提交于 2019-12-11 23:54:17
问题 I have: an interface GenericDao a class GenericDaoImpl implements GenericDao a class UserDao What I want to do is: UserDao userDao; public void setUserDao(UserDao val) { userDao = val; } ... ((GenericDao) userDao).update(user); My Beans.xml looks like: <bean id="genericUserDao" class="dao.GenericDaoImpl"> ... <property name="sessionFactory" ref="hibernateSessionFactory" /> </bean> <bean id="userDao" class="dao.user.UserDao"> <property name="sessionFactory" ref="hibernateSessionFactory" /> <

Invoke bean method from jsp

好久不见. 提交于 2019-12-11 23:29:27
问题 I would like to know how to Invoke bean method from jsp. something like. On click of button [Hey] i would like to print "Hello world". Thank you. 回答1: Go ahead with JSF. Here's how your requirement would look like: View ( test.xhtml ) <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" > <h:head> <title>JSF Hello World</title> </h:head> <h:body> <h:form>

How does Struts create an action bean?

北城余情 提交于 2019-12-11 20:58:00
问题 I use Struts2.x and I know that Struts creates the declared bean objects in the action based on the request so that it is available to the action. I have been researching to understand which interceptors/classes does Struts use internally to create the bean object. I am trying to understand the logic that is used internally for creation of the bean objects. Does it use PropertyUtils to populate properties for the beans or some other way? Any suggestion or pointers for reading will be helpful.

'Field required a bean of type that could not be found.' Spring can't find my repository interface

 ̄綄美尐妖づ 提交于 2019-12-11 17:49:00
问题 I'm trying to get my skeleton Spring webapp up and running so I can start testing POST requests etc. However, the builder throws an exception: Description: Field repository in com.internal.signing.model.SigningOrder.SigningOrder required a bean of type 'com.internal.signing.model.SigningOrder.SigningOrderRepository' that could not be found. Action: Consider defining a bean of type 'com.internal.signing.model.SigningOrder.SigningOrderRepository' in your configuration. I do indeed have a class

Putting a JavaBean into a HttpSession in JSP

可紊 提交于 2019-12-11 16:46:27
问题 I was trying to do a "simple" application about a survey. Where you have some options (checkboxes) and then the results (votes) are shown in other page. I have this class where I can keep the results all time (I want to update this class, using HttpSession). I was using the class HashMap, but I changed, I think it doesn't matter: package beans; import java.util.ArrayList; import java.util.List; public class SurveyBean { private List<String> keys; private List<String> values; public SurveyBean

Java Bean calling Java function and passing it to Jsp

余生颓废 提交于 2019-12-11 16:31:53
问题 hi all I have a LoginServlet that has the functionality to log in a user however I have a jsp page with the styling I'd to use. I am unsure how I can use the functionality from my LoginServlet in my login.jsp here is the entirety of my code for the LoginServlet, I am aware I have coded to display a page but I need to use this jsp page to display. This is a uni assignment I have been given and it's part of the requirement that we use JSP for display. import java.io.IOException; import java.io