Solved

How to include a file in a JSP?

Posted on 2004-04-22
5
824 Views
Last Modified: 2013-11-24
Hello,

I have this Tree.jsp.  I need to include a GetPreview.jsp on the right of this GetTree.jsp.
The GetPreview.jsp with its paramters looks like this -
http://botdev.spimageworks.com:9180/browseit/GetPreview.jsp?previewPath=//op/characters/bob-bobbie/bob_bobbie1-cg.jpg&serverName=ALIEN01&projectName=oseason&jsessionid=830F9EDF63A0EA8C9F8BD76724571C1F

I have created a table and 1 row <TR> and 2 <td> and in 1st column displays the GetTree and the 2nd column display the GetPreview.jsp

I don't the syntax to include a file with parameters in a jsp ? please advise!


//File -GetTree.jsp
<%@ taglib uri="taglib49.tld" prefix="tree" %>
<%@ taglib uri='http://java.sun.com/jstl/core' prefix='c' %>

<TABLE BORDER="2" >
<TR>
<TD>
<%

ProjectNode projectNode=null;

projectNode= BmxServletUtilities.getProject(session);
%>
<a href="http://www"> hello </a>
<tree:createTree defaultConnectors="false" treePicture="tree-icons/tree.gif" nodePicture="tree-icons/leaf.gif" openPicture="tree-icons/open.gif" dhtml="true" width="325" height="725">
 <tree:addNode open="false" code="<%=projectNode.getName() %>">
<%

...............

<%
synchronized (fChildNode) {
     final Enumeration gChildren = fChildNode.children();

while (gChildren.hasMoreElements())
{
      final Node gChildNode = (Node)(gChildren.nextElement());
%>    
<tree:addNode open="false" code="<%=gChildNode.getName() %>">
<%
synchronized (gChildNode) {
      final Enumeration hChildren = gChildNode.children();

while (hChildren.hasMoreElements())
{
     final Node hChildNode = (Node)(hChildren.nextElement());

%>
<tree:addNode open="false" code='<%="<a href=\\"GetPreview.jsp?previewPath=//"+nChildNode.getName()+ "/" +fChildNode.getName() + "/" + gChildNode.getName() + "/" +hChildNode.getName() + "&serverName=ALIEN01&projectName=oseason&jsessionid=" + session.getId() + "\\">" + hChildNode.getName()+"</a>"%>'/>
<%
}
}
%>
</tree:addNode>
<%
}
}
%>
</tree:addNode>
<%  
} // while
} // in synchronized
%>
 </tree:addNode>

<%  
} // while
}
%>
  </tree:addNode>
</tree:createTree>
</TD>
<TD>
HERE <c:out value="${s_name}" />
<%@include file="GetPreview.jsp" %>
</TD>
</TR>
</TABLE>
0
Comment
Question by:sdesar
  • 3
  • 2
5 Comments
 

Author Comment

by:sdesar
ID: 10894451
increasing points
0
 
LVL 2

Accepted Solution

by:
PaulS_III earned 50 total points
ID: 10894861
can't you use something like:

<jsp:include page="{relativeURL | <%= expression %>}" flush="true" >
      <jsp:param name="parameterName"
            value="{parameterValue | <%= expression %>}" />+
</jsp:include>

Hope that helps


Paul
0
 

Author Comment

by:sdesar
ID: 10921687
I have a file called
 GetTree.jsp - this jsp displays a tree view of all the files.
 I want to include 1 other file within  this JSP such that when the user clicks on the links in GetTree.jsp it displays
 GetPreview.jsp on the Right Frame.

  the link for GetPreview within the GetTree.jsp(TreeView) looks like this -  <a href=\"GetPreview.jsp?dirPath=" + fixedPath  +"&serverName=" + serverName  + "&projectName=" + projectName  +  "&jsessionid=" + jsessionid  + "\"> preview</a>");



  What do I need to do the the GetTree.jsp to display the data with the
  TreeView on the left and the details ie GetPreview.jsp on the right frame

  And what code do I need to add to the data in the link in GetTree.jsp so
  that OnClick of the link will display GetPreview.jsp data  on the right
  frame

and GetPreview accepts these parameters -
<jsp:include page="GetPreview.jsp" flush="true">
  <jsp:param name="dirPath" value="season"/>
  <jsp:param name="serverName" value="ALIEN"/>
  <jsp:param name="projectName" value="oseason"/>
  <jsp:param name="jsessionid" value="<%=session.getId()%>"/>
</jsp:include>


  I  want to use framesets <FRAMESET> , instead on <TABLE>

 Please provide code on how to do this.

  Thanks!
0
 

Author Comment

by:sdesar
ID: 10933335
Thanks PaulS_III !
here are your excellent points!
0
 
LVL 2

Expert Comment

by:PaulS_III
ID: 10934505
Gee thanks. I didn't think I answered your question completely. I do hope you figured it out.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question