Skip to Content
author's profile photo Former Member
Former Member

jsp include

I want to include a JSP from another application. Is this possible?

I have one application called "include" and one application called "myapp". From the /myapp/index.jsp i'm trying to use the tag <jsp:include page="/include/myinclude.jsp" />. Nothing shows for the include and no errors are thrown.

Any help is appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2005 at 10:35 AM


    you have to use

    <%@include file=="/include/myinclude.jsp" %>

    i am not sure but works for only html pages i.e if you have myinclude.htm then you can use this.

    hope this helps, else revert back.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member


      you want to call a dynamic jsp i.e. it has some of its functionality.

      then in my opinion you should use forward or redirection instead of include. since in case of include tag during server compilation the tag is replaced by the code of that include jsp page.

      since your page is dynamic hence it is not getting displayed and neither showing any error.

      try using forward tag to the page as:

      <jsp:forward page="your_page_loc.jsp" />

      and if you want to pass any paramateres then you can pass using: <jsp:forward page="your_page_loc.jsp"> <jsp:param name="username" value="jsmith" /> </jsp:forward>

      alternatively you can redirect like:

      response.sendRedirect("http://your_path_for_file/filename.jsp ");


      You can also physically alter the Location HTTP header attribute, as shown below:



      String newLocn = "/newpath/filename.jsp";



      Hope this may solve your problem,



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.