My JSP have around 50 fields for the user to input, so i thought of making div elements and having these fields in different div elements. But at a time only one div element should be visible and others should be hidden. On clicking next and previous buttons on the div we can hide/show divs.
So, how can i hide/show these div elements.
Also, should i use <s:div> element or normal HTML <div> element for this.
Richard : I know about document.getElementById("").style.display="none" , but <s:form> does not have any on page load function. So the first time, on page load how to hide these div elements.
In your situation:
Use the regular HTML div tag
His solution is problematic in that you'll no longer have labels, error messages, etc.
His original analysis, however, is correct; you can't wrap table rows in div tags--you would actually need to hide/show the table rows themselves. In order to do that you'd need to either use CSS selectors to find them, or enhance the template to give a useful ID or class to the rows themselves. This is something I've been meaning to do for a really long time but never get around to it--implemented it, but never checked it in :(
What David said is correct. Because of the Struts templates, there are some constraints about what you can do in your form. For this reason, I usually use the simple theme and handle the labels on my own.
The session error messages are legacy so I do what they always did and don't mess with it. The DWR is used for more extreme case, usually when there is some long running process and I want to provide feedback to the client so they can see what is happening on the server.