wood burning stoves
The moose likes JSP and the fly likes Struts-Design Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Struts-Design Problem" Watch "Struts-Design Problem" New topic

Struts-Design Problem

Kumar Kartik

Joined: Jun 14, 2002
Posts: 10
I am new to Struts and desiging a web application. I have problem designing ActionForm bean for one of my JSP form.
The problem is, Attributes Name of the JSP form is dynamic, It comes form session of previous pages.
So, How do I create ActionForm for my dynamic page?
Any help?

David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
I'm not sure exactly how dynamic the content of your secondary form is, but it seems to me that you should probably have multiple beans with multiple pages. i.e. currently you're trying to do this:
form 1 --> action --> problem form
where what you really want to do is
form 1 --> action --> form 2a || 2b || 2c
based on the input from form 1. This is the cleanest and most easily maintainable design. The other (and much less preferred) option is
to design a form bean with all possible input fields. But this is very difficult for someone else to read and understand.

"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Kumar Kartik

Joined: Jun 14, 2002
Posts: 10
Hi David,
Thanks for reply.
But, I have problem defining get/set method for my FormBean cause, Application can only know the HTML Textfield (or Option List) name during runtime. ( I have a Hastable object in my session that have field name and value..and I render HTML (or JSP) using this name and value (if value is String I create HTML TextField and if Vector I create Option List.))
Pls ask if you did,nt get the problem..I think I am not good at explaining my problem.
Yan Zhang

Joined: Dec 26, 2002
Posts: 4
Can struts frame work handle multiple forms in one jsp page?


<img src="rolleyes.gif" border="0">
I agree. Here's the link: http://aspose.com/file-tools
subject: Struts-Design Problem
It's not a secret anymore!