• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Frames in struts

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jsp page that displays the list of folders. When one of the folder name is selected the contents of that folder is diplayed in another jsp page.


I want that when one of the folder name is clicked, the jsp page that displays the contents of the folder to be shown as a frame in the same jsp page at the right.

Thanks....
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is this related to struts that I don't know, but you can create frames in your page and use the target property of <a> tag to target the hyperlink to the frame...
 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your concern..
Following are the entries in struts-config file.


By using <html:frame> in DisplayContents.jsp I am not able to get the content of ListOfCabinets.jsp.

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...

Including the JSP code that isn't working might help.
 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following is the jsp code.

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While I'm not familiar with the "frame" tag, its documentation leads me to believe you're using it incorrectly, since your usage does not include *any* attributes.

Why would you do all that work in the JSP file? That's what actions and service objects are for.
 
Debasmita Dash
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will you please give any idea how to do it....
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do what, use the <html:frame> tag, use the HTML anchor tag's "target" attribute correctly, or writing all your code in the JSP?

If you're talking about using the anchor tag: in your example you're using the "href" value for the "target" attribute. If you're having issues with frames and HTML tags you'll probably want to post in the HTML forum--once you get the basic HTML worked out *then* you can get back to the Struts stuff.

If you're talking about writing all your code in the JSP, there's almost never any reason to do this. The reason servlets and JSPs exist is to separate code and presentation. The reason Struts exists is to further the abstraction: Java code should be written in Java files, JSP should be used to present data processed in the Java files.

Besides, the HTML you posted does not seem to be well-formed: issues like this can be seen readily when indentation is used consistently. Here you're starting a new table row inside a table cell, are opening potentially multiple div tags and never closing them, don't close the try/catch block, and so on. In short, it's a mess.It's easy to see when this is formatted consistently that something has gone wrong.

Besides the malformed HTML:

* None of this Java code should be in the JSP. It should be in a service object used by the action.
* The "tree.xml" file should be either on the classpath or use a path relative to the server context.
* It should be cached, otherwise you're parsing XML *every* time the page is loaded.
* If the attribute map is a *map* then why are you *iterating* over it to get the ID?! It's a map: get it using map access.
* The table cell containing everything has a height attribute of "1". That's really short, and almost certainly not what you want.
* If the node value is really the cabinet name, as implied by the improperly-used "target" attribute, then you'll need to quote it to pass it to the JavaScript function. If it's guaranteed to be a numeric value then you're okay. I would, however, be wary of using it, unadorned, as the id for a DOM element.

This would lead to JSP code much closer to the following (although not really understanding the structure you posted some of it is just a close approximation:I'd also consider moving the code for each individual line into a JSP-based custom tag file; this would clean up the main JSP page considerably, leading to the even cleaner:You're welcome! Consider having your employer make a donation.
reply
    Bookmark Topic Watch Topic
  • New Topic