On 4/19/05, Rafael Taboada <[EMAIL PROTECTED]> wrote: > yeap. i have that... But i want to know what i have to do in the > detail jsp. I mean, how can i populate in the detail jsp using that > id. > > i have an lstCustomer object in my actionform. when i'm in detail jsp, > is it still populated? or it depends on the scope?.
You either have to write a scriptlet, or to go through action. The latter is the recommended approach. On the other hand, because all you need is to load data from database and to show it, you can stick it in validate() method of output form bean, and use standard ForwardAction instead of creating custom action class. This may not look like "by book" coding, but it works: request goes through Struts, which is good, and you save on one class, which is good to. If you cannot load data from database, you create error message right away, you are already in validate() method. In the action class you would load data from database, corresponding to item ID, and fill out item form bean. Then you forward to JSP, which would show fields from your form bean: <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <html:html locale="true"> <!-- Show item: ID and value --> ID: <bean:write name="itemFormOutput" property="id"/><br> Value: <bean:write name="itemFormOutput" property="value"/> </html:html> Don't forget to define form bean in struts-config.xml I prefer to use separate actions and form beans for input and for output. See this article: http://www.theserverside.com/articles/article.tss?l=StrutsActionMapping I like "Two actions, two forms" approach. If you decide to use it with redirection, please read the discussion for the article, where I explain how do I handle error messages. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]