aspose file tools*
The moose likes Struts and the fly likes Holding values from a page to the next Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Holding values from a page to the next" Watch "Holding values from a page to the next" New topic
Author

Holding values from a page to the next

A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Hi all I have run into a slight issue creating one of my pages. I am trying to make a page that allows users to work their way through multiple levels in a tree structure. I have managed to get the code to almost work. The only issue being that I lose the value of the references that were made before the current one. To explain:
My tree can go to a possible 7 levels deep. Each level has 5 choices. The first level is always displayed on the screen (it's placed there when the form is created. The next level values will be determined based on which of the first level values is selected. When this happens I want show the first level as well as all the results that are below the choice from the first level. Then when the choose one from the second level I want to add on the third level values that are below the second level value that was selected.

My big issue is I haven't figured out a way to keep each of the variables around once they have been choosen. The only thing that I can think of is to throw them into session. Is there any other thoughts or manners in which to accomplish this ?

thanks in advance.

Sorry if this is run-on. Not sure how else to describe it.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
When the user selects a level are you submitting a form? If so then probably the easiest way to keep the values is to store them in hidden fields using the html:hidden tag. They way all the parent values will be submitted along with the current selection.

- Brent
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Originally posted by Brent Sterling:
When the user selects a level are you submitting a form? If so then probably the easiest way to keep the values is to store them in hidden fields using the html:hidden tag. They way all the parent values will be submitted along with the current selection.

- Brent


I had thought about that, but for some reason I thought the hidden fields would be cleaned up everytime.

thanks for the suggestion.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
A hidden field works pretty much just like a text field...well except it is hidden so the user cannot edit the value. When the page is loaded the hidden fields are populated with the values from your form and when the page is submitted the values of the hidden fields are submitted as well. During development you can try using html:text field to make it easier to see the values.

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Holding values from a page to the next