|
From: Kopylenko, D. <dko...@ac...> - 2003-04-24 12:07:23
|
Isabelle, can you please change KeyBinder.Bind() method name to begin with the lower case letter. Thanks, Dmitriy. |
|
From: JP P. <jp....@ti...> - 2003-05-31 05:39:04
Attachments:
spring-beans_0_8.dtd
pagedlist-servlet.xml
|
As it seems access issues and I cannot check it now, I send the files in the list as they are tiny, __________________________________ Jean-Pierre Pawlak jp....@ti... |
|
From: Jean-Francois C. <cor...@ro...> - 2003-07-07 01:27:48
|
Hi,
I have been lurking on this list for a while. And I am currently
experimenting with Spring 0.9.
In a recent email, Juergen asked for feedback from people using Spring.
Here goes.
In my application, I wanted to have something like a Wizard when a user is
filling a form. I used the AbstractWizardFormController.
My form object contains a collection. Using the wizard, I would like that
one step allowed the user to add an arbitrary number of items to the
collection. So each time a user adds an item, the same step is displayed so
that he can continue adding. When he is finished he just presses the Next
or Finish Button.
I have modified the petclinic application to see how I could do this with
Spring. I modified the AddOwnerForm so that when a Owner is Added his pets
can also be added. What I did is add a second step where a Pet can be
created. On this steps there are the standard Prev, Cancel and Finish
Buttons. But there is also a Add button to add the pet to the owner. The
add button points to the current wizard step.
I modified the onBindAndValidate() method to check for the presence of the
_target1 attribute for page1. If it is there, it means that the user has
pressed the Add button. I create a pet and add it to the owner. It kinda
works, but is a bit klunky. I do not like the fact that I had to hard code
"_target1" to make this work.
Is there a better way to do this?
English is not my first language, so my explanation may not be clear. Just
ask and I will explain further.
Thanks
Jean-Francois Cormier
Here is the code to the AddOwnerAndPetForm
/*
* Created on 2-Jul-2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package petclinic.web;
import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import petclinic.Clinic;
import petclinic.Owner;
import petclinic.Pet;
import com.interface21.validation.BindException;
import com.interface21.validation.Errors;
import com.interface21.web.servlet.ModelAndView;
import com.interface21.web.servlet.mvc.AbstractWizardFormController;
/**
* @author jxc170
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class AddOwnerAndPetsForm extends AbstractWizardFormController {
private Clinic clinic;
public AddOwnerAndPetsForm() {
setCommandClass(Owner.class);
}
/* (non-Javadoc)
* @see
com.interface21.web.servlet.mvc.AbstractWizardFormController#validatePage(java.lang.Object,
com.interface21.validation.Errors, int)
*/
protected void validatePage(Object command, Errors errors, int page) {
// TODO Auto-generated method stub
logger.debug("Validate Page:" + page);
}
/* (non-Javadoc)
* @see
com.interface21.web.servlet.mvc.AbstractWizardFormController#processFinish(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, java.lang.Object,
com.interface21.validation.BindException)
*/
protected ModelAndView processFinish(HttpServletRequest
request,HttpServletResponse response,Object command,BindException errors)
throws ServletException, IOException {
Owner owner = (Owner) command;
getClinic().insert(owner);
List pets = owner.getPets();
Object[] petArray = pets.toArray();
for ( int i = 0; i < petArray.length; i++) {
Pet pet = (Pet) petArray[i];
pet.setOwner(owner);
getClinic().insert(pet);
}
return new ModelAndView("ownerRedirect", "ownerId",
Integer.toString(owner.getId()));
}
/* (non-Javadoc)
* @see
com.interface21.web.servlet.mvc.AbstractWizardFormController#referenceData(javax.servlet.http.HttpServletRequest,
java.lang.Object, com.interface21.validation.Errors, int)
*/
protected Map referenceData(HttpServletRequest request,Object
command,Errors errors,int page) throws ServletException {
Map model = new HashMap();
System.out.println("\n\n\n+++++++++++++++++++++++++++++++++++++++++++\n\n\n")
;
System.out.println(" GETTING TYPES ");
Map types = clinic.getTypes();
System.out.println("\n\n\n+++++++++++++++++++++++++++++++++++++++++++\n\n\n")
;
model.put("types", types);
return model;
}
/* (non-Javadoc)
* @see
com.interface21.web.servlet.mvc.AbstractWizardFormController#processCancel(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, java.lang.Object,
com.interface21.validation.BindException)
*/
protected ModelAndView processCancel(
HttpServletRequest request,
HttpServletResponse response,
Object command,
BindException errors)
throws ServletException, IOException {
// TODO Auto-generated method stub
logger.debug("Wizard Canceled");
return null;
}
/* (non-Javadoc)
* @see
com.interface21.web.servlet.mvc.AbstractWizardFormController#onBindAndValidate(javax.servlet.http.HttpServletRequest,
java.lang.Object, com.interface21.validation.BindException, int)
*/
protected void onBindAndValidate(HttpServletRequest request,Object
command,BindException errors,int page) throws ServletException {
logger.debug("On Bind and Validate Page:" + page);
switch (page) {
case 0:
break;
case 1:
if ( request.getParameter("_target1") != null ) {
String petName = request.getParameter("name");
String petBirthDate = request.getParameter("birthDate");
String type = request.getParameter("typeId");
if ( petName != null ) {
Pet pet = new Pet();
pet.setName(petName);
int year = Integer.parseInt(petBirthDate.substring(0,4));
int month = Integer.parseInt(petBirthDate.substring(5,7));
int day = Integer.parseInt(petBirthDate.substring(8,10));
pet.setBirthDate(new Date(year, month, day));
pet.setTypeId(Integer.parseInt(type));
Owner owner = (Owner) command;
owner.addPet(pet);
}
}
break;
default:
break;
}
}
/**
* @return
*/
public Clinic getClinic() {
return clinic;
}
/**
* @param clinic
*/
public void setClinic(Clinic clinic) {
this.clinic = clinic;
}
}
|
|
From: Naokatsu H. <na...@so...> - 2003-07-20 14:06:11
|
|
From: Lars F. <lar...@gm...> - 2003-08-26 10:00:20
|
Finally I've managed to get the whole thing working with Hibernate and
WebLogic.
There are still a few newbie questions left:
In applicationContext.xml from the Hibernate skeleton I've defined this
part:
<bean id="exampleDataAccessObject" class="example.ExampleDataAccessObject">
<property name="sessionFactory"><ref bean="mySessionFactory"/></property>
<property name="exampleParam"><value>someValue</value></property>
</bean>
1.) When do I need the part defining (do I need it at all?)
<bean id="exampleBusinessObject" class="example.ExampleBusinessObject">
<property name="transactionManager"><ref
bean="myTransactionManager"/></property>
<property name="dataAccessObject"><ref
bean="exampleDataAccessObject"/></property>
<property name="exampleParam"><value>someOtherValue</value></property>
</bean>
2.) In my DAO implementation I use HibernateTemplate. I assume that those
methods
are transaction safe with only the first part ("exampleDataAccessObject")
defined (?).
3.) Spring provides a "Controller" and a "MultiActionController". For sure
there are lots
of architectural reasons for providing both. But wouldn't it be easier just
to provide one
kind of controller ? E.g. in WebWork 1 you can make a class ActionAware,
SessionAware, etc.
which is very easy to understand (when to use what even without
documentation).
Thanks again
Lars
|
|
From: <tri...@tr...> - 2003-09-30 17:58:45
|
Rod & All, Spring got a nice plugg from Gavin King in the interview on the ServerSide that has just been posted. ( http://www.theserverside.com/events/index.jsp ) Q: One of the reasons why transparent persistence may not be getting as much attention is because a lot people just arent writing domain models. Why do you think people are not yet adopting such a good object-oriented paradigm yet? A: Firstly, not every application needs a domain model. There are lots of applications for which a domain model is absolute overkill. There are lots of applications for which a view of sets of data coming out of the database is absolutely appropriate. And theres all kinds of good tools in Java, in the open source community, for writing that kind of application well, things like the Spring Framework give you great ways of getting away a bit from very messy JDBC code, but writing those kind of applications which pull some stuff form the database and display it on the screen, or insert a row of data into the database. You dont need a domain model to do those kinds of things. Thomas |
|
From: Dmitriy K. <dko...@ru...> - 2004-01-19 23:06:51
|
Everyone, how about getting rid of "grant all to public" schema in JPetstore's oracle schema script and creating a separate schema, let's say 'jpet'? Regards, Dmitriy. |
|
From: William L. <wi...@ly...> - 2004-02-12 14:50:09
|
confirm 722607 |
|
From: Linco M. <lin...@ms...> - 2004-04-17 12:39:09
|
DQo= |
|
From: xuhw <me...@ya...> - 2004-09-24 04:42:46
|
--------------------------------- Do You Yahoo!? 嫌邮箱太小?雅虎电邮自助扩容! |
|
From: Qazi, K. <kq...@ed...> - 2004-11-02 01:51:29
|
I am getting the following exception when accessing a proxy that is set
up as following, I have tested this and it worked when I deployed my ejb
module standalone and used
"SimpleRemoteStatelessSessionProxyFactoryBean" instead of
"LocalStatelessSessionProxyFactoryBean". =20
=20
I pretty much just followed the ref. doc on the spring website. I know
the EJB has been deployed to the container and that the JNDI is working
because the bean I have that is using this "vehicleProxy" is getting it
just fine. Just when I try to call a method on the "vehicleProxy" is
when my exceptions start coming up.=20
=20
I am NOT implementing the interface VehicleServiceProxyI in my
LocalInterface only in my EJB BeanClass.
=20
Any ideas on why I am getting this exception would be greatly
appreciated!!!
=20
<bean id=3D"vehicleProxy" name=3D"vehicleProxy"=20
=20
class=3D"org.springframework.ejb.access.LocalStatelessSessionProxyFactory=
B
ean">
<property
name=3D"jndiName"><value>com.edmunds.common.vehicles.service.VehicleServi=
c
eLocalHome</value></property>
<property
name=3D"businessInterface"><value>com.edmunds.common.vehicles.service.pro=
x
y.VehicleServiceProxyI</value></property>
</bean>
=20
public interface VehicleServiceProxyI extends ServiceProxy{
//Methods are defined here.
}
=20
public class VehicleServiceBean implements SessionBean,
VehicleServiceProxyI {
}
=20
Caused by: java.lang.IllegalArgumentException: object is not an instance
of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invoke(LocalS
lsbInvokerInterceptor.java:60)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:138)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo
pProxy.java:152)
at $Proxy13.getModelByID(Unknown Source)
at
com.edmunds.insideline.web.struts.TestProxyAction.execute(TestProxyActio
n.java:45)
... 16 more
|
|
From: Colin S. <col...@ex...> - 2004-11-02 04:29:22
|
Karim, First of all, this is a list for development of Spring itself. You should be using the forums at forum.springframework.org, for help... As to your problem, I think your Local Interface does not actually implement your business interface... The proxy is blowing up at: ejb = getSessionBeanInstance(); return invocation.getMethod().invoke(ejb, invocation.getArguments()); basically the local interface that the ejb stub which comes back has, does not match the class on the actual Method object, which is coming from what you declared on the proxy... Colin Qazi, Karim wrote: > I am getting the following exception when accessing a proxy that is > set up as following, I have tested this and it worked when I deployed > my ejb module standalone and used > “SimpleRemoteStatelessSessionProxyFactoryBean” instead of > “LocalStatelessSessionProxyFactoryBean”. > > I pretty much just followed the ref. doc on the spring website. I know > the EJB has been deployed to the container and that the JNDI is > working because the bean I have that is using this “vehicleProxy” is > getting it just fine. Just when I try to call a method on the > “vehicleProxy” is when my exceptions start coming up. > > I am NOT implementing the interface VehicleServiceProxyI in my > LocalInterface only in my EJB BeanClass. > > Any ideas on why I am getting this exception would be greatly > appreciated!!! > > <bean id="vehicleProxy" name="vehicleProxy" > > class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean"> > > <property > name="jndiName"><value>com.edmunds.common.vehicles.service.VehicleServiceLocalHome</value></property> > > <property > name="businessInterface"><value>com.edmunds.common.vehicles.service.proxy.VehicleServiceProxyI</value></property> > > </bean> > > public interface VehicleServiceProxyI extends ServiceProxy{ > > //Methods are defined here. > > } > > public class VehicleServiceBean implements SessionBean, > VehicleServiceProxyI { > > } > > Caused by: java.lang.IllegalArgumentException: object is not an > instance of declaring class > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:324) > > at > org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invoke(LocalSlsbInvokerInterceptor.java:60) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) > > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) > > at $Proxy13.getModelByID(Unknown Source) > > at > com.edmunds.insideline.web.struts.TestProxyAction.execute(TestProxyAction.java:45) > > ... 16 more > |
|
From: Chris P. <ch...@rs...> - 2004-12-15 10:47:00
|
-- Chris Parsons ch...@rs... |
|
From: Hariharan, V. (IE10) <Har...@ho...> - 2005-03-02 15:14:34
|
|
From: Hariharan, V. (IE10) <Har...@ho...> - 2005-03-22 17:35:11
|
------------------ Hari Haran 9886484326 26588360 ext: 3134 ------------------ |
|
From: Damian G. <qs...@ya...> - 2005-05-27 23:14:05
|
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
|
From: Ben K. <big...@ya...> - 2005-08-25 17:38:53
|
confirm 602020 ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs |
|
From: Edgar A. C. C. <edc...@ho...> - 2005-10-12 18:57:08
|
<html><div style='background-color:'><DIV class=RTE><FONT color=#0000ff></FONT></DIV></div></html> |
|
From: Victor G. <vic...@gm...> - 2005-12-12 11:03:13
|
|
From: Lin d. <tx...@ho...> - 2006-03-31 03:56:52
|
confirm 387758 _________________________________________________________________ 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn |
|
From: Brian L. <bl...@gu...> - 2006-05-18 03:47:29
|
=20 |
|
From: Andrew G. <gu...@gm...> - 2006-05-19 14:34:43
|
|
From: <cha...@gm...> - 2006-09-15 14:57:08
|
|
From: <cha...@gm...> - 2006-09-15 14:58:31
|
|
From: reza a. <r_a...@ya...> - 2006-12-26 08:11:21
|
=0A=0A=0A=0A__________________________________________________=0ADo You Yah= oo!?=0ATired of spam? Yahoo! Mail has the best spam protection around =0Ah= ttp://mail.yahoo.com |