• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Create folder structures using jsp dynamically

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can anyone suggest how can we create folder structures provided in form of xml input dynamically to get the output executed on a jsp page? Any sample code or suggestion is helpful. The xml input of the same has parent and child structure of the folder structure in form of the xml tags so I need to show its output in the form of a jsp page.

for eg: A is parent and then B and C are child then for under B there is three more child D, E and F. This way the count is changed dynamically in the xml input so jsp should display this in form of a folder structure of the same names as present in the xml nodes?

Also How do we obtain the folder icons in the result jsp page?

Best regards
 
Sheriff
Posts: 28416
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Folder structures? I'm not sure what those are, but the basic rule for writing a JSP is this:

1. Decide what HTML you want to generate. (In this case, decide how to produce those folder structures in HTML.)

2. Write a JSP which generates that HTML.
 
Greenhorn
Posts: 24
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You want folder structure or Objects structure ....?
 
Foni kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ganesh Gore wrote:You want folder structure or Objects structure ....?



Hi Ganesh,

I want the folder structure ...let me clear this with some example..

suppose we have an xml file

<tag-parent>FolderA
<tag-child1>FolderB</tag-child1>
<tag-child2>FolderC</tag-child2>
</tag-parent>

Now when it will be displayed in the jsp page it should come as folder structure with the same name FolderA --->FolderB+FolderC---> and this structure can be dynamic I mean someone can add n number of child elements in xml and it should pick the values and display in jsp output..The folder structure can be expanded to the one given in xml on click of the node created in the jsp but it should happen dynamically.
 
Foni kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Folder structures? I'm not sure what those are, but the basic rule for writing a JSP is this:

1. Decide what HTML you want to generate. (In this case, decide how to produce those folder structures in HTML.)

2. Write a JSP which generates that HTML.



Thanks Paul for the response, I have explained one scenario as below to Ganesh quote could you please have a look if that sounds familiar to what you are explaining
 
Paul Clapham
Sheriff
Posts: 28416
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, that doesn't sound right. I don't see where you attempted step 1, which is to design HTML which does what you want.

Of course your question might actually be "How do I use HTML to display a folder structure?" In which case you should just ask that question instead of confusing the issue with JSP. You should also clarify what a "folder structure" is.
 
Foni kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:No, that doesn't sound right. I don't see where you attempted step 1, which is to design HTML which does what you want.

Of course your question might actually be "How do I use HTML to display a folder structure?" In which case you should just ask that question instead of confusing the issue with JSP. You should also clarify what a "folder structure" is.



ok let me go it in a different way, can we write a scriptlet or java codes inside the JSP page to fetch the values from XML file for the folder names and display the results in the folder structure pattern? I have to write the logic inside the jsp page to parse an xml and then read the folder structure present in its tags (parent-child hierarchy) and then display the output. This folder structure should be created dynamically which means if i add any additional child under the parent then it should showup.

please let me know if it clarifies..
 
Author and all-around good cowpoke
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you actually have an example of typical HTML to produce the display you want to see?

NO: Stop talking about JSP and create one or more examples of plain HTML that looks like what you want.

YES: write a plain language explanation of how you built that HTML.

NEXT; then and only then think about JSP.

Bill

(hint HTML lists make this display easy)
 
Paul Clapham
Sheriff
Posts: 28416
102
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deeb kumar wrote:can we write a scriptlet or java codes inside the JSP page to fetch the values from XML file for the folder names and display the results in the folder structure pattern?



Of course you can. Provided that you know how to implement this folder structure in HTML. Your first step should be to figure that part out.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Except, of course, that scriptlets and Java codes [sic] in the JSP have been obsolete and considered a bad practice for 12 years now. 12 years! Do you not think that it's time to catch up?

Do all your file discovery in the page controller, and after you have figured out what the HTML should be, use the EL and JSTL in the JSP page to create that HTML.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic