Re: problem beaneditform and external ejb3
PROBLEM FOUND! The beaneditform component can't understand this type of setter methods: public String getUsername(){return username;} public Operator setUsername(String username){this.username=username;return this;} I changed the setter in this way: public void setUsername(String username){this.username=username;} and everything is working now. I usually define setters in this way in order to write something like this: Operator operator = new Operator().setUsername().setPwd().setThis(..).setThat(..); So, how can I manage this kind of setters in Tapestry 5? any suggestion? do I really have to change all my setter methods?!?!? :,( -- View this message in context: http://www.nabble.com/problem-beaneditform-and-external-ejb3-tp19769807p19797874.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem beaneditform and external ejb3
I think I'm really close to the solution, after some modifications I can see the beaneditform in my page, but it's completly empty (I mean, only the Create/Update button is shown). Here my complete code: //DuckBeanRemote represents the Remote Interface of one stateless session bean. --- AddOperator.tml --- http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> Add Operator Add Operator [Back to Index] -- AddOperator.java public class AddOperator{ private DuckBeanRemote dao; @Persist private Operator operator; public AddOperator(){ // obtaining a dao from the context try {dao = (DuckBeanRemote)new javax.naming.InitialContext().lookup("DuckBean/remote"); }catch(Exception e){e.toString();} } public void setOperator(Operator operator) {this.operator = operator;} public Operator getOperator() {return operator;} // I create an instance of Operator void onActivate(){operator= new Operator();} Object onSubmitFromOperatorEditor() { dao.addOperator(operator); return ShowOperators.class; } } This is what I can see in the jboss logs --- 09:57:27,979 INFO [STDOUT] [DEBUG] pages.AddOperator Dispatch event: ComponentEvent[activate from (self)] 09:57:27,980 INFO [STDOUT] [DEBUG] pages.AddOperator Invoking: sittingduck.pages.AddOperator.onActivate() (at AddOperator.java:21) 09:57:27,982 INFO [STDOUT] [DEBUG] pages.AddOperator Dispatch event: ComponentEvent[prepareForRender from operatorEditor] 09:57:27,983 INFO [STDOUT] [DEBUG] pages.AddOperator Dispatch event: ComponentEvent[prepare from operatorEditor] 09:57:27,985 INFO [STDOUT] [DEBUG] pages.AddOperator Dispatch event: ComponentEvent[prepare from operatorEditor] 09:57:27,985 INFO [STDOUT] [DEBUG] pages.AddOperator Dispatch event: ComponentEvent[passivate from (self)] 09:57:27,986 INFO [STDOUT] [DEBUG] pages.Index Dispatch event: ComponentEvent[passivate from (self)] 09:57:27,987 INFO [STDOUT] [DEBUG] pages.AddOperator Executed 89 rendering commands (max queue depth: 37) in 0.005 seconds -- View this message in context: http://www.nabble.com/problem-beaneditform-and-external-ejb3-tp19769807p19793534.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem beaneditform and external ejb3
Em Thu, 02 Oct 2008 05:39:12 -0300, mdes <[EMAIL PROTECTED]> escreveu: The problem with the beaneditform is that I want Tapestry to create an "empty" instance of my entity bean, but at the moment he can't understand what type he has to use (in this case, Operator). Maybe the problem is exactly how BeanEditForm instantiates your entity. One option is to instatiate it yourself in a method that handles the Prepare event. That method would check if your entity is null then instatiate your object directly. The other one I'm trying to find in this mailing list archives . . . -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor Consultor, desenvolvedor e instrutor em Java http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: problem beaneditform and external ejb3
This is one of those cases where the source would help. Re-reading your error message, it sounds like you are missing t:type="beaneditform" from your template. This doesn't have anything to do with your entity (yet). > -Original Message- > From: mdes [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2008 04:39 > To: users@tapestry.apache.org > Subject: Re: problem beaneditform and external ejb3 > > > @Thiango: I use the ejb3 business logic as a stand alone project (I mean, > another folder in the workspace), separeted by the Tapestry one. I deploy > it > indipendently in JBoss and than a war for the Tapestry project. > > @Geoff: thanks for the jumpstart examples, but I already read them, but my > problem is a bit different. > > Let me explain: > I can use entity beans without any problem with the grid component and > other > components that can obtain a specific instance of the object. > In particular, I call a page with a PageLink and I do something like > dao.findOperator(username) in the onActivate() method, and the grid (for > example) works perfectly. > > The problem with the beaneditform is that I want Tapestry to create an > "empty" instance of my entity bean, but at the moment he can't understand > what type he has to use (in this case, Operator). > > > Geoff Callender-2 wrote: > > > > Does this example help? > > http://202.177.217.122:8080/jumpstart/examples/input/edit1/1 > > > > Cheers, > > > > Geoff > > > > On 02/10/2008, at 8:00 AM, Thiago H. de Paula Figueiredo wrote: > > > >> Em Wed, 01 Oct 2008 18:47:37 -0300, mdes <[EMAIL PROTECTED]> > >> escreveu: > >> > >>> Hello everybody, > >>> I'm new to Tapestry 5 and I need help to solve a problem. > >>> > >>> I defined an entity bean "Operator" in my ejb3 project, and I want > >>> it to be the object of a beaneditform in a Tapestry 5 project. > >> > >> One common error for newbies is to put entity beans in packages > >> controlled by Tapestry: pages, components, mixins, base. Maybe it is > >> your error. Check this in your project. > >> > >> Thiago > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: http://www.nabble.com/problem-beaneditform- > and-external-ejb3-tp19769807p19775400.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem beaneditform and external ejb3
I was thinking about adding an example of Input (Using BeanEditForm). Here's a first cut that I've just tested. It creates a Person. http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd "> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> Input (Using BeanEditForm) (2) include="firstName,lastName,startDate" submitLabel="Save"/> Refresh t:context="person.id" href="#">Return Home package jumpstart.web.pages.examples.input; import jumpstart.business.domain.examples.Person; import jumpstart.business.domain.examples.iface.IPersonServiceLocal; import jumpstart.web.commons.ExceptionUtil; import jumpstart.web.services.IBusinessServicesLocator; import org.apache.tapestry5.annotations.Component; import org.apache.tapestry5.annotations.InjectPage; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.corelib.components.BeanEditForm; import org.apache.tapestry5.ioc.annotations.Inject; public class Input2 { @Property private Person _person; @Inject private IBusinessServicesLocator _businessServicesLocator; @Component(id = "person") private BeanEditForm _form; @InjectPage private Input1 _page1; void setupRender() throws Exception { _person = new Person(); } void onValidateForm() { try { getPersonService().createPerson(_person); } catch (Exception e) { // Display the cause. In a real system we would try harder to get a user-friendly message. _form.recordError(ExceptionUtil.getRootCause(e)); } } Object onSuccess() { _page1.set(_person.getId()); return _page1; } Object onActionFromRefresh() { return this; } private IPersonServiceLocal getPersonService() { // Use our business services locator to get the EJB3 session bean called "PersonServiceLocal". return _businessServicesLocator.getPersonServiceLocal(); } } Is that closer to answering your problem? Cheers, Geoff On 02/10/2008, at 6:39 PM, mdes wrote: @Thiango: I use the ejb3 business logic as a stand alone project (I mean, another folder in the workspace), separeted by the Tapestry one. I deploy it indipendently in JBoss and than a war for the Tapestry project. @Geoff: thanks for the jumpstart examples, but I already read them, but my problem is a bit different. Let me explain: I can use entity beans without any problem with the grid component and other components that can obtain a specific instance of the object. In particular, I call a page with a PageLink and I do something like dao.findOperator(username) in the onActivate() method, and the grid (for example) works perfectly. The problem with the beaneditform is that I want Tapestry to create an "empty" instance of my entity bean, but at the moment he can't understand what type he has to use (in this case, Operator). Geoff Callender-2 wrote: Does this example help? http://202.177.217.122:8080/jumpstart/examples/input/edit1/1 Cheers, Geoff On 02/10/2008, at 8:00 AM, Thiago H. de Paula Figueiredo wrote: Em Wed, 01 Oct 2008 18:47:37 -0300, mdes <[EMAIL PROTECTED]> escreveu: Hello everybody, I'm new to Tapestry 5 and I need help to solve a problem. I defined an entity bean "Operator" in my ejb3 project, and I want it to be the object of a beaneditform in a Tapestry 5 project. One common error for newbies is to put entity beans in packages controlled by Tapestry: pages, components, mixins, base. Maybe it is your error. Check this in your project. Thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/problem-beaneditform-and-external-ejb3-tp19769807p19775400.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem beaneditform and external ejb3
@Thiango: I use the ejb3 business logic as a stand alone project (I mean, another folder in the workspace), separeted by the Tapestry one. I deploy it indipendently in JBoss and than a war for the Tapestry project. @Geoff: thanks for the jumpstart examples, but I already read them, but my problem is a bit different. Let me explain: I can use entity beans without any problem with the grid component and other components that can obtain a specific instance of the object. In particular, I call a page with a PageLink and I do something like dao.findOperator(username) in the onActivate() method, and the grid (for example) works perfectly. The problem with the beaneditform is that I want Tapestry to create an "empty" instance of my entity bean, but at the moment he can't understand what type he has to use (in this case, Operator). Geoff Callender-2 wrote: > > Does this example help? > http://202.177.217.122:8080/jumpstart/examples/input/edit1/1 > > Cheers, > > Geoff > > On 02/10/2008, at 8:00 AM, Thiago H. de Paula Figueiredo wrote: > >> Em Wed, 01 Oct 2008 18:47:37 -0300, mdes <[EMAIL PROTECTED]> >> escreveu: >> >>> Hello everybody, >>> I'm new to Tapestry 5 and I need help to solve a problem. >>> >>> I defined an entity bean "Operator" in my ejb3 project, and I want >>> it to be the object of a beaneditform in a Tapestry 5 project. >> >> One common error for newbies is to put entity beans in packages >> controlled by Tapestry: pages, components, mixins, base. Maybe it is >> your error. Check this in your project. >> >> Thiago >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > ------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/problem-beaneditform-and-external-ejb3-tp19769807p19775400.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem beaneditform and external ejb3
Does this example help? http://202.177.217.122:8080/jumpstart/examples/input/edit1/1 Cheers, Geoff On 02/10/2008, at 8:00 AM, Thiago H. de Paula Figueiredo wrote: Em Wed, 01 Oct 2008 18:47:37 -0300, mdes <[EMAIL PROTECTED]> escreveu: Hello everybody, I'm new to Tapestry 5 and I need help to solve a problem. I defined an entity bean "Operator" in my ejb3 project, and I want it to be the object of a beaneditform in a Tapestry 5 project. One common error for newbies is to put entity beans in packages controlled by Tapestry: pages, components, mixins, base. Maybe it is your error. Check this in your project. Thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem beaneditform and external ejb3
Em Wed, 01 Oct 2008 18:47:37 -0300, mdes <[EMAIL PROTECTED]> escreveu: Hello everybody, I'm new to Tapestry 5 and I need help to solve a problem. I defined an entity bean "Operator" in my ejb3 project, and I want it to be the object of a beaneditform in a Tapestry 5 project. One common error for newbies is to put entity beans in packages controlled by Tapestry: pages, components, mixins, base. Maybe it is your error. Check this in your project. Thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem beaneditform and external ejb3
Hello everybody, I'm new to Tapestry 5 and I need help to solve a problem. I defined an entity bean "Operator" in my ejb3 project, and I want it to be the object of a beaneditform in a Tapestry 5 project. So, I wrote this in the AddOperator.tml page: and I get this Tapestry error: Embedded component 'operatorEditor' has no type. You should specify a type in the component template, or define the component inside class sittingduck.pages.AddOperator using the @Component annotation on a private instance variable. In my understanding, my AddOperator.java seems to be ok because I defined: @Persist private Operator operator; and both setter and getter methods. I tried different ways, like setting a new instance of Operator to the AddOperator page via page injection, or assigning a new instance of Operator to the property field during the onActivate() method of AddOperator page, but no success. Please advise. -- View this message in context: http://www.nabble.com/problem-beaneditform-and-external-ejb3-tp19769807p19769807.html Sent from the Tapestry - User mailing list archive at Nabble.com.