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.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<!-- We need a doctype to allow us to use special characters like &nbsp;
         We use a "strict" DTD to make IE follow the alignment rules. -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
<body>
        <h1>Input (Using BeanEditForm) (2)</h1>
        
<t:beaneditform t:id="person" object="person" include="firstName,lastName,startDate" submitLabel="Save"/>

        <a t:type="actionlink" t:action="refresh" href="#">Refresh</a>&nbsp;
<a t:type="pagelink" t:page="examples/input/Input1" t:context="person.id" href="#">Return</a><br/><br/>

        <a t:type="pagelink" t:page="Index" href="#">Home</a>
</body>
</html>


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]


Reply via email to