Results 1 to 3 of 3
  1. #1
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default jsp:include tag won't do as expected

    hi,

    I have a jsp file that checks if a certain session object is existing, name of the jsp page that checks is UserCheck.jsp. this jsp page is included in every page of the web application.

    it contents, as said, checks a certain session objects existence like

    if (a_session_object==null) {
    // go to error page
    } else {
    // continue render
    }

    now, if the checker page is included, it does not work as it is supposed to be
    what it does is it will redirect to the error page, with the stacktrace. (which should not be shown)

    BUT, if i do it this way. get the contents of the checker page, paste the contents directly to the page that causes the error. it does the redirection without including the stacktrace

    so instead of using <jsp:include page="checkerPage">, i copy and pasted the contents of it and paste it to the page that needs to be checked. it works find. TEST > REDIRECT > RENDER ERROR PAGE

    but if I use include the checkerPage it would do TEST > REDIRECT > RENDER (the stacktrace show)

    I wonder why?

    any suggestions would be appreciated

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,931
    Rep Power
    19

    Default

    What stack trace?
    Don't you think it might have been worth posting the exception and trace?

  3. #3
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default

    hi tolls,

    it is just a nullpointerexception. comes up because the user bookmarked a page which is dependent to a previous page and can't find the set value on the previous page

    anyway, I somehow found a workaround. instead of using the <jsp:forward> tag, i just used the response.sendRedirect("someJspPage")

    it would still show the error on my log file, but not on the page.

    I guess that is good enough for now


Similar Threads

  1. Replies: 0
    Last Post: 03-02-2010, 08:28 AM
  2. include-prelude/include-coda
    By devin in forum Java Servlet
    Replies: 0
    Last Post: 02-11-2009, 07:33 PM
  3. jsp:include in a sql:transaction
    By sam2020 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-31-2008, 08:11 PM
  4. Replies: 5
    Last Post: 07-29-2008, 02:13 PM
  5. jsp:include and include file
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-14-2007, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •