• 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

JSP file content - Unable to locate its source

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a file `faq.jsp` and it has no content. I grepped through the tomcat directories to find any content it produces when loading a page. But I can't find it. What can produce its data if its isn't in any file?

I'm not sure how this content can be produced. The site is pretty much run using a velocity engine. But none of the views have the content it produces. Also this `faq.jsp` is outside out the views directory but when the site is loaded its in a velocity templated window.

For example when the page is loaded through the site, it has some contents like `Some sample paragraph
` and I've searched it in the server and couldn't find any file that has this content.



   <%@ page language="java"%>
   <html>
       <head>
           <script language="javascript">
                 window.location.href = window.location.href.replace("faq.jsp", "faq.html");
           </script>
       </head>
       <body>
           Redirecting...
       </body>
   </html>

 
Sheriff
Posts: 67529
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I am understanding your question correctly: the generated JSP output is not saved in the file system anywhere. The output is generated using the JSP template, along with any data provided to it, then sent as the content of the response. At no time is the generated content written to the file system.

If you are not acquainted with how JSP works, perhaps this article might be helpful.
 
John Herrington
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean like if the data is either generated using a JSP template or if it was provided to it, it might be somewhere on the server? Unless its coming from database, which I haven't searched. I've searched the whole server and no where I found the content string in any file. Is it possible for a JSP template to pull data from database? Maybe like there is a admin panel for the website and the content could be there which means it might be saved in the database.

Also any hint in finding the source JSP template? Like is there a certain path it usually is or is there any config file that I can check to find out where the templates might be?

This file doesn't say where its redirecting to either.. But looking at the velocity engine config file, it seems it is responsible for handling all the html files.
 
Marshal
Posts: 3506
496
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This line:should cause the URL to be rewritten from yoursite/path/faq.jsp to yoursite/path/faq.html, and the browser should then request the new page.  The replacement URL should be visibile in the browser's address bar.  If this redirection happens quickly, you may not see the Redirecting ... message.

Is that what you are seeing?
 
Bear Bibeault
Sheriff
Posts: 67529
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Herrington wrote:I mean like if the data is either generated using a JSP template or if it was provided to it, it might be somewhere on the server?


Again, at no point in the generation of output is it written anywhere but to the response.

Unless its [sic] coming from database, which I haven't searched. I've searched the whole server and no where I found the content string in any file. Is it possible for a JSP template to pull data from database?


Sure. Caveat being that JSP templates should not have any processing code in them, but since the dawn of JSP they have been used poorly.

Based upon this, it sounds like you are actually trying to find where the data is coming from? (You haven't really said what you are actually trying to accomplish.)

Also any hint in finding the source JSP template?



This is your best bet for finding the source of the data; finding the template and seeing where it's pulling its data from.

As Ron posted, the URL mapping is the thread to start pulling at...
 
Saloon Keeper
Posts: 23544
161
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that whoever designed the app thought that only JSPs could be handled in a JEE webapp and tried to kludge around it.

Probably faq.jsp should not exist (as a file in the WAR) and whatever links or redirects are made should be aimed straight at faq.html.

Because JEE webapp servers can serve up html pages just fine on their own.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic