This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with JSP  RSS feed

 
Mike Br
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiya,
Im writing a web page where a user can view directories / files on the intranet. I have a bean that handles all the directory recursing etc and returns and array of files etc . I pass in the path I want recursed as a string from the page. The problem is, I want to allow the user to click on a directory and then go into that directory. I have set up a parent frame which I want to set the path in the bean - I was thinking that I could set the path to the bean from my parent, then reload the child page and get the beans path from a call. problems are
a) can I share the bean across to my child page that does all the display itself
b) when I get the directory from the user that they want to go into (using javascript) how can I tell my parent page what this new path is
c) somehow Ill have to reload my child page
any ideas. I probably havent explained this very well, but I've seen this on loads of sites and thought it must be possible with JSP - whats the standard way of doing this??
Thanks in advance
Mike Brown
 
sridhar satuloori
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes you can use the same bean across JSP's use Scope = session or application
 
Mike Br
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that - the pages can now talk to the same bean.
what im still lost with is how to get the new directory path passed into the bean. Im using javascript to get the value, but obviously I cant just pass it in as JSP is server-side. Basically, I am setting the default path when the page loads. User clicks on the directory they want and I store that in a javascript variable. Now ive somehow got to tell the jspbean what that new path is (the value of the javascript variable), but how can i reload the bean? I decided to use a frameset (parent + child sharing the jspbean), thinking that I can store the new path in the parent page, then reload the child page which will read the directory to recurse out of the shared jsp bean!
do I have to use setAttribute or something in the parent page, then read the attribute from the child page - if so though, how do you set a jsp variable from javascript??
Thanks again,
MIke
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may or may not work because I havn't had the opportunity to test it. But seem to remember a while back having a smiliar issue. The cool thing about JSP is that you can intersperce Java into Javascript & HTML.
So for instance.

Then obviously you'll need to read it from somewhere.
Hope this is helpful (also hope it works, wish I had more time).
[This message has been edited by Angela Poynton (edited November 23, 2001).]
[This message has been edited by Angela Poynton (edited November 23, 2001).]
 
Mike Br
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Alot Angela - thats looks really useful - ive hashed round it a bit by using servlets etc but that looks good to me
Didnt know you could do that!!
Thanks again,
Mike
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!