Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display the contents of folder when the link is clicked

 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where's your code? What problems are you having with it?
 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh. You're using Struts. OK, this has been moved to the Struts forum.
 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bibeault,
Thanks a lot for the instant reply and help.....
 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can anyone help regarding this topic....

Thanks in advance...
 
Swastik Dey
Rancher
Posts: 1602
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What code is running behind to retrieve the folder contents?
 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic