File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes question on struts page design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "question on struts page design" Watch "question on struts page design" New topic
Author

question on struts page design

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Hi,
I am a newbie to struts. I have something like this:
-2 dropdown lists:
college:[college list]
school:[school list]
-search results: once college and its scholl are selected, its departments will be displayed at the bottom of the page. The results may displyed across sevaral pages if number of depts is huge, users can
get more results using next/previous links.

How should I design this page? Should I use frames, or use tables to do
this? As for two dropdown lists (criteria), shouls I write oneactionForm or two?
Thanks,
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Hi, Guys:
I really need your insights on this. Do you think it will be nice to choose frames to do the job? I am not very clear about the struts tags, if I have two dropdown lists as stated above, do I need two actionForms to achieve what needs to be done? One html:form corresponds to one actionForm, right? I am
so eager to know these basics.
Thanks,
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
just create one form class which contains two collections. One for schools and one for the other. Then use the tags
<html:select ....>
<html ptions ..../>
</html:select>
To use these options tag you must insert a LabelValueBean into the collection (when you use
Struts 1.1 there should be one included).
Then you just need a single form. And if you need this selection on different pages you can also think about putting the form into the session.
Hope that helped
Oliver
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Thank you so much, Oliver,
I am just very new to this. So, how do I use these two collections in my JSP page? Just do something like the following twice? As for labelValueBean, any sample I can follow?
regards,

Originally posted by Oliver Refle:
Hi,
just create one form class which contains two collections. One for schools and one for the other. Then use the tags
<html:select ....>
<html ptions ..../>
</html:select>
To use these options tag you must insert a LabelValueBean into the collection (when you use
Struts 1.1 there should be one included).
Then you just need a single form. And if you need this selection on different pages you can also think about putting the form into the session.
Hope that helped
Oliver
Sundar Narasimhan
Greenhorn

Joined: Jul 19, 2003
Posts: 2
Rick: I had a similar problem recently.. but I've found that one has better luck if you separate "design" type questions away from "implementation" type questions. (i.e. how to design such a thing is a very different sort of beast than the actual mechanics of doing it with forms or valuebeans).
Having said that, I had a similar problem recently.. and took the approach of a single form with the collections as Oliver was suggesting. But in my case rather than using forms, the other option was to use a "open in another window" (i.e. the results of my query were going to be used as in put in another form, and people didn't want to track "back" to that form once they found what they've looked up -- so opening the query page in a separate window worked better). So that's another option.
For your case, you have to have a single form that displays the collection dispatches to an action that does the query, and populates a result set in the form. If you use the pager or display tags, then you'll be able to automatically paginate the result set. See.
<a href= "http://jsptags.com/tags/navigation/pager/pager-taglib-2.0.html">Pager</a>
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Thank you very much, Sundar:
The idea of using pager is cool, I will look into it closely. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question on struts page design
 
Similar Threads
First struts app help! Drop-down lists
Struts with ajax help?
Expandable h:selectOneMenu
ComboBox using JSP
Best Approaches