As I understand the implementation of html:select, I would have to return a
collection of something. Collection of beans? One of my select lists has
370 school names in it. The last thing I want to do is to create/pass
around a collection of 370 objects instead of one StringBuffer (actually
converted to String at the end of the tag class).
If there's another way to use html:select as I have used the tag, please let
me know. Plus, how is it a breach? Doesn't struts use custom tags? Why
can't I use a combo of struts and my own tags?
I actually have to do a repost with this page too so I even use a usebean
tag along with my struts form tag at the top so that I can have a selected
option. Basically the user picks a school name and the form reloads with
the school's address filled in for the user.
Suggestions welcome.
Here's my code snipet:
<jsp:useBean id="schoolAddressForm"
class="edu.cccs.energizer.SchoolAddressForm" scope="session"/>
<html:form name="schoolAddressForm"
type="edu.cccs.energizer.SchoolAddressForm" action="forms/schoolSave.do" >
....
<select name="suffix" onChange="getAddress();">
<%
//only select it if it exists
String suffix = "";
suffix = schoolAddressForm.getSuffix();
if (suffix != null)
{
if (suffix.length() > 0)
{
%>
<option value="<%= suffix %>" SELECTED><%= schoolAddressForm.getName()
%></option>
<option value="">--------------------------</option>
<option value="">Select One Below:</option>
<% }
} else {
%>
<option value="" SELECTED>Select One Below:</option>
<% } %>
<ene:optionlist
sql="SELECT school_suffix, name FROM schools ORDER BY name"
value="school_suffix"
item="name" />
</select>
>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: Pre and Post Processing
>Date: Tue, 12 Feb 2002 12:49:16 -0500
>
>
>
>Serious breach of MVC though!
>
>What don't you like about the select implementation? I think it's cool!
>
>Dave
>
>
>
>
>
>Sarah Farrell <[EMAIL PROTECTED]> on
>02/11/2002
>10:19:26 PM
>
>Please respond to "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
>
>To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
>cc: (bcc: David Hay/Lex/Lexmark)
>Subject: Re: Pre and Post Processing
>
>
>
>I'm relatively new to struts too. But I really don't like the HTML select
>implementation. So I use a custom tag to fill in select/option lists. In
>fact
>I have to use this tag throughout my application so I made it very generic.
> My
>select/option lists almost always come right from my database. So I made a
>tag
>that takes a SQL statement as an attribute, the name of the field that I
>want
>as the option value as the 2nd attribute, and the name of the field I want
>displayed in the list as the 3rd attribute. The tag class builds a
>stringbuffer with "<option value=[field1]>[field2]</option>" strings for
>each
>row returned from the SQL statement.
>
>Then I use the struts form/action classes to verify the result of
>submitting
>the form.
>
>
>
>
>At 05:35 PM 2/11/2002 +0000, you wrote:
> >Hello.
> >
> >I'm new to struts, and I'm having a discussion with one of our designers
> >about pre and post processing in web pages.
> >
> >Previously, we have used the standard JSP way of creating pages, with
>lots
> >of code in the top and body of pages, in order to access functionality we
> >have exposed in some Java beans. These Java beans wrapper XML services
> >provided by our Forte 4GL back end.
> >
> >Say we have a form which accepts customer details. I can see how the
>Struts
> >mechanism allows us to put the code that was previously at the top of the
> >next JSP page into an ActionHandler, which decouples the flow of pages
>quite
> >nicely, and we have a nice way of doing post processing on the contents
>of a
> >page.
> >
> >However, if we have a page that has to display a list of addresses for a
> >customer, and we have to run some code to get the list before we can
>display
> >it, where should this code live? Should it be in the ActionHandler with
>the
> >previous page's post processing, or is there a better place to put it?
>Or
> >would you suggest writing a custom tag to perform the pre-processing?
> >
> >Thanks for any thoughts,
> >
> >Tim.
> >
> >
> >This e-mail and its attachments are for the use of the addressee only.
> >It may contain information that is legally privileged, confidential and
> >exempt from disclosure. It is not a contract, and prices, data
> >and other information are not warranted as to completeness or accuracy.
> >Any comments or statements made herein do not necessarily
> >reflect those of PanCredit Systems Limited. If you are not the intended
> >recipient you must not copy, distribute or disseminate this e-mail
> >or attachments to anyone other than the addressee.
> >If you receive this communication in error please advise us by telephone
> >at once.
> >PanCredit Systems Limited
> >Tel: +44 113 250 0260
> >Fax: +44 113 250 0621
> >
> >
> >--
> >To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>