Solved

How to include a file in a JSP?

Posted on 2004-04-22
5
832 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.

729 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