Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 92149 invoked from network); 21 Apr 2008 09:55:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Apr 2008 09:55:51 -0000 Received: (qmail 63712 invoked by uid 500); 21 Apr 2008 09:55:41 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 63680 invoked by uid 500); 21 Apr 2008 09:55:41 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 63669 invoked by uid 99); 21 Apr 2008 09:55:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Apr 2008 02:55:41 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.227.126.188] (HELO moutng.kundenserver.de) (212.227.126.188) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Apr 2008 09:54:57 +0000 Received: from [192.168.0.234] (host86-147-237-44.range86-147.btcentralplus.com [86.147.237.44]) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis) id 0ML25U-1Jnsjs2Lyg-0001Uc; Mon, 21 Apr 2008 11:55:08 +0200 Message-ID: <480C647B.8060605@cyberspaceroad.com> Date: Mon, 21 Apr 2008 10:55:07 +0100 From: Adam Hardy User-Agent: Icedove 1.5.0.14pre (X11/20080305) MIME-Version: 1.0 To: Struts Users Mailing List Subject: Re: Best practise for populating a select from database so that it works for all result types References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V01U2FsdGVkX1/FVLm7U+vx9ENGb2F7gtKCSfxF67uZsT3JXXI DL0yy5v+qgBxPnrvfCx/R9XrJzaYjYIorPw/kred72wTen5Pwh 3KJ8zh1Ll0KEtdrPSVHEcbcM7qPQ+Lz X-Virus-Checked: Checked by ClamAV on apache.org Hi Toni there are several different approaches. The one I use has an Edit action and a Save action. The Edit action fetches the dropdown list and puts it in the request and results in the form jsp. The form submits to Save and if validation fails, the Input result is resultType="chain" and pipes the request back to the Edit action. HTH Adam Toni Lyytikäinen on 21/04/08 10:05, wrote: > Hello, > > What is generally regarded as the best practise for populating a select > element in a form from database so that it works regardless of the action > and the result from which the form is displayed? > > I've tried this: > > action configuration: > > /WEB-INF/jsp/admin/userForm.jsp > > > > list > > /WEB-INF/jsp/admin/userForm.jsp > > > > jsp page: > > > > ... > > > where listIntoRequest looks like this: > > public String listIntoRequest() { > List list=dao.getListFromDatabase(); > request.setAttribute("list", list); > return SUCCESS; > } > > but the problem is with validation. If the validation fails, and the input > result is returned in the in the form processing page (save), then the > action tag never executes the method listIntoRequest (see WW-2599), and the > form will not display correctly. > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org