You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian McSweeney <br...@aurium.net> on 2003/05/06 12:16:58 UTC

way of topic! sorry

Hi all,

I'm looking for advice that's way off topic here, but perhaps you guys 
can even point me in the right direction.

I'm building a struts web-app that stores a list of categories in an n-ary tree 
structure ( each root category can have many children sub-categories,
each sub-cat can have many sub-sub categories etc).

I want to be able to select a leaf category in which to add a new product. 
However, I want to be able to do it all on one page using javascript as follows:

http://list.auctions.shopping.yahoo.com/0-submit.html

I've used javascript before but I know the theory. 

1) Seeing as it's client side, can I assume that the entire tree has to be stored 
on the page?

2) What would you recommend as the best way to do this using struts?

3) Know any good javascript resources to get me started?

I know it's horribly off topic, sorry again,
thanks,
Brian


Re: way of topic! sorry

Posted by Gareth Andrew <ga...@ntlworld.com>.
Brian McSweeney wrote:

>Hi all,
>
>I'm looking for advice that's way off topic here, but perhaps you guys 
>can even point me in the right direction.
>
>I'm building a struts web-app that stores a list of categories in an n-ary tree 
>structure ( each root category can have many children sub-categories,
>each sub-cat can have many sub-sub categories etc).
>
>I want to be able to select a leaf category in which to add a new product. 
>However, I want to be able to do it all on one page using javascript as follows:
>

>
>I've used javascript before but I know the theory. 
>
>1) Seeing as it's client side, can I assume that the entire tree has to be stored 
>on the page?
>  
>
You wouldn't necessarily need to store the entire tree on the page.  You 
could fetch it from the server (perhaps pre-fetching a level or two 
ahead) Javascript remote scripting http://www.ashleyit.com/rs/ or 
something similar could be used for this - although I've never used it 
so i can't say much about it.  There are definitely some posts in the 
archive related to remote scripting since thats the only reason I know 
it exists.

>2) What would you recommend as the best way to do this using struts?
>  
>
My rough solution would.

1) Store the tree using nested javascript arrays - write these out from 
a struts action (call the action from a <script src="<html:rewrite ... 
/>"> tag)
2) write a javascript method that takes two select menu objects as 
arguments - the method reads the selected value from the first argument; 
then fills in the options in the second list.
3) write an action to handle the submit.  This action should probably 
derive from the same base Action as the the action in (1) in order to 
access common tree-related functions (or use delegation).

Voila! Problem solved (if only it were this easy).

>3) Know any good javascript resources to get me started?
>  
>
My problem with javascript has always been making it work with all 
browsers.  Netscape devedge http://devedge.netscape.com always seemed 
like a fairly authoritative resaource to me - with good emphasis on 
platform independance.

>I know it's horribly off topic, sorry again,
>thanks,
>Brian
>
>  
>
HTH,

Gareth.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org