permaculture playing cards*
The moose likes Struts and the fly likes [struts] using html:form across multiple divs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[struts] using html:form across multiple divs" Watch "[struts] using html:form across multiple divs" New topic
Author

[struts] using html:form across multiple divs

Jonathan Lister
Greenhorn

Joined: Feb 22, 2004
Posts: 12
My application presents multiple rows of data in the upper part of page, each of which has an html:multibox to allow user selection. The lower part of page has some controls built with e.g html:radio, html:checkbox, html:select and html:submit. The upper & lower parts of the screen are built via 2 calls to tiles ut. All is working well.

Next request from user's is to "fix" the controls across the bottom of the screen - so they don't have to keep scrolling down to find the controls.
I think there are 2 possible HTML approaches
a) frames
b) CSS positioning and DIV tags

There seems to be significant challenges involved in using frames together with struts, so I have investigated CSS and DIV tags. After jumping over several hurdles to find workarounds to the "bugs" in IE etc, I have a solution that looks nice on screen and is reasonably clean - keeping most of the detail in a tiles layout definition. However, I'm having some difficulty in nesting div's within a html:form or vice-versa. The only way I can find to keep the visual appearance ok is to nest a html:form within each div tag:
<div id="bodyContent">
<html:form ..>
<main content goes here>
</html:form>
</div>
<div id = "bottomFrame">
<html:form ....>
<toolbar, buttons etc. goes here>
</html:form>
</div>

but of course the form doesn't work, I assume because each form is independant of the other and selections made in the top form are invisible when a button in the lower form is clicked. Wrapping one html:form around the outside of both sections fixes that problem, but introduces other problems like making it difficult to use the multiple tiles ut sections and breaking the visual appearance.

Has anyone been down this or a similar path before - is there an easier way to acheive what the user's want?
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Then its better to with frames that will make use ur life easier even though frames is not that good idea in big applications .......if u use frames there is no quetsion of tiles at all u can give src="action.do" for evry frame and proceed

if u go with divs why do u need to have three forms i am not able to understand clearly ur req
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

You could ask the users about putting controls at both the top and bottom of the screen. They might like it.


A good workman is known by his tools.
Jonathan Lister
Greenhorn

Joined: Feb 22, 2004
Posts: 12
to answer sreenath, I don't want multiple forms, but doing it this way:
<html:form ..>
<div id="bodyContent">
<main content goes here>
</div>
<div id = "bottomFrame">
<toolbar, buttons etc. goes here>
</div>
</html:form>

breaks the visual appearance, at least in IE6, specifically I lose the vertical scroll bar and can't access lower parts of the page!

Getting back to struts - is there a way to combine the input from multiple <html:forms> without using e.g. javascript to write the combined data to yet another (hidden) form?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Can't you just wrap the divs with a single html:form???
<body>
<html:form...>
...
div
...
div
...
</html:form>
</body>
Jonathan Lister
Greenhorn

Joined: Feb 22, 2004
Posts: 12
Hi Marc, yes, I can wrap the divs in a single html:form (that is waht my post above was trying to show). Using a single html:form is GOOD from struts / functional perspective (it works), but BAD from a visual perspective - putting the divs inside the form upsets the rendering badly, at least in IE6.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [struts] using html:form across multiple divs