From what I understand a jsp is responsible for dynamically generating html pages, which are later sent to the client browser for viewing. But then why do browsers show a .jsp extension while viewing some pages? Is it possible to view a .jsp file in a browser?
2 Answers
But then why do browsers show a .jsp extension while viewing some pages?
Because, traditionally, JSP files have .jsp file extensions, and URLs map directly onto files on a filesystem (these days the front controller pattern means you see less of that).
Is it possible to view a .jsp file in a browser?
Not an arbitrary one. Servers execute server side programs and return the output to the client, not the program itself.
2 Comments
faisal bhat
So the .jsp is only because of mapping, but basically the file that browser receives is pure html/css/js?
Quentin
Yes. HTTP clients care about Content-Type headers, not things that look like they might be file extensions in URLs.
You need to have a server to view jsp files. I think you can find your answer here
6 Comments
Marten
You have to change .html to .jsp
faisal bhat
If I have .jsp in the url, does that not mean the .jsp file actually reached my browser from the server(located elsewhere)? How did the jsp reach my browser in the first place? Werent jsps meant to output an html page, which would later be sent to the client?
Marten
You have to create a server and put the .jsp in the server directory, then the server will load it from there.
faisal bhat
Load it and? afterwards?
faisal bhat
are u sayin it will send .jsp file to client browser?
|