Hi,
I'm using struts for my web application. I have a tree structure
displayed by using JSP. I have implemeted the functions that can expand
and clap the tree. The only problem is that the tree is big. If I
scroll down a page to the middle and expend a node there, how can I
stay there after the node is expended? I know for html page, you can
use <a name="xxx"> and append #xxx to the end of the URL. How can I
implement that using JSP and struts? In other word how can I make a JSP
page remember the scroll position of a frame?
Thank you very much.
B.
Heiner Kücker - 14 Dec 2005 18:21 GMT
> how can I
> stay there after the node is expended?
For this task is using JavaScript useful.
<script language="JavaScript" type="text/javascript">
<!--
document.forms[0].elements[' *selectedNODE* '].focus();
window.scrollTo( elements[' *selectedNODE* '].offsetLeft , elements['
*selectedNODE* '].offsetTop );
// -->
</script>
The expression
elements[' *selectedNODE* ']
means your expanded node.
I dont know, whether a struts tag is instantly useful for
this task or not.

Signature
Heiner
www.heinerkuecker.de
Beecie - 14 Dec 2005 21:01 GMT
Heiner:
Thank you very much for your reply. Would you please let me know where
do you call this javascript? at the time the document is load? Would
you please be a little bit specific if you could?
I really appreciate your help and info.
B.