RE: Generate a Drop-Down ???

2003-11-17 Thread Bryan Hanks
There's a very easy way to generate a drop-down. From your example, I'm not
sure what ProdutoView does, so I'm going to assume you want to only create a
drop-down of "CSV" and "XML".

Forgive me for starting over, but there is a very easy way to do what you
want, but you must modify you ArrayList a bit.

In the action:

ArrayList formatosArquivos = new ArrayList();
formatosArquivos.add( new org.apache.struts.util.LabelValueBean( "CSV", "20"
) );
formatosArquivos.add( new org.apache.struts.util.LabelValueBean( "XML", "40"
) );
session.setAttribute("produtoView", formatosArquivos);

---

In the JSP:

  

  

---

Explanation:

Org.apache.struts.util.LabelValueBean takes two arguments: label, value.
These are assigned as "label" and "value", respectively (obvious, no?).
When the JSP runs html:options, it creates a drop-down with labels
labelProperty (="label") and corresponding values property (="value"). The
selected value is returned in the html:select property (="product_value").

In this example, if the user selects "CSV", then product_value=20.

See also: http://masterdev.dyndns.dk/dev/6.htm

Cheers,
Bryan

-Original Message-
From: Mauricio T. Ferraz [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 14, 2003 5:23 PM
To: Struts Users Mailing List
Subject: Generate a Drop-Down ???


I put the bean on the method execute on myAction

ArrayList formatosArquivos = new ArrayList();

formatosArquivos.add("CSV");

formatosArquivos.add("XML");

formatosArquivos.add("Algorithmics");

ProdutoView produto = new ProdutoView();
produto.setFormatosArquivos(formatosArquivos);

session.setAttribute("produtoView",produto);


So, How I generate a drop-down list on the next Jsp page???




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Reasons for using Struts

2003-09-28 Thread Bryan Hanks
I use it because it is much easier to maintain. 

If the front-end (JSP) needs to be updated only,
I can do that without accidentally messing with
the underlying business logic.

Conversely, if the business rules change (and
they always do...), I can change them without
worrying about having to change the front end.

Recently, It Was Decided that we would all move
to MS-SQL as the standard DB. This will be 
relatively easy, because the DB-accessing code
is isolated from the display and control.

Cheers,
Bryan

-Original Message-
From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 26, 2003 11:53 PM
To: [EMAIL PROTECTED]
Subject: Reasons for using Struts


What are the reasons for using Struts?
That is what are the Reasons for which Struts would be a more suitable
choice than say plain JSP/Servlet?

Thanks,

Martin


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]