aspose file tools*
The moose likes Struts and the fly likes Display the contents of folder when the link is clicked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Display the contents of folder when the link is clicked" Watch "Display the contents of folder when the link is clicked" New topic
Author

Display the contents of folder when the link is clicked

Debasmita Dash
Greenhorn

Joined: Apr 07, 2009
Posts: 19
Hi...

I have to display the folder names on a page. When one of the folder name is clicked the contents of the folder should be displayed.

Thanks in advance...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Where's your code? What problems are you having with it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Debasmita Dash
Greenhorn

Joined: Apr 07, 2009
Posts: 19
Bear Bibeault wrote:Where's your code? What problems are you having with it?



I am able to display the folder names as hyper links using the "a href" tag.
<td><a href="DisplayContents.jsp"><%=attr.getName(object_name)%></a></td>
attr.getName(object_name) gives the folder name.But when I click on the folder name it gives NullPointerException
since the folder name is not accessible to the DiplayContents.jsp page.Basing on the folder name clicked I have to diplay the contents of that folder.

thanks...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Well, a couple of things.

First, it looks as if you are still using scriptlets. Stop. Use the JSTL and EL.

Also, you are submitting directly to a JSP. No good. Your first stop on any request should be a servlet controller. In that controller you can fetch the information to display, in this case use file I/O to obtain the files and folder names, and forward to the JSP for display.

Perhaps this article will help make that clear.
Debasmita Dash
Greenhorn

Joined: Apr 07, 2009
Posts: 19

I need to retreive the folder name selected that will be fetched to a java bean(ActionForm) which in turn will be used by the Action class.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Oh. You're using Struts. OK, this has been moved to the Struts forum.
Debasmita Dash
Greenhorn

Joined: Apr 07, 2009
Posts: 19

Bibeault,
Thanks a lot for the instant reply and help.....
Debasmita Dash
Greenhorn

Joined: Apr 07, 2009
Posts: 19

Can anyone help regarding this topic....

Thanks in advance...
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1454
    
    6

What code is running behind to retrieve the folder contents?


Swastik
Debasmita Dash
Greenhorn

Joined: Apr 07, 2009
Posts: 19

Thanks for the concern...
Solved the issue....now able to retreive the contents
But further I want to dislay the content of the document through a window that will pop upon clicking on the link.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Display the contents of folder when the link is clicked