S.H.
S.H.

Reputation: 2853

How to know which is the JSP webpage that is showing my servlet

I have a project that I can see the JSP's... However Jboss shows me the servlets so in the address bar all i can see is:

"appservleer?=AppDev"

This is an example not the actual address...but with that info only how can I know which JSP is being displayed at that moment by JBoss.

or am I understanding this Jboss, servlet, JSP incorrectly?

Some guidance would be appreciated.

Thanks.

Upvotes: 2

Views: 6718

Answers (3)

pravat
pravat

Reputation: 475

You should always start with the web.xml file which will eventually lead you to the actual jsp file that is displayed. Start with the servlet mapping and check which servlet is invoked for the url. Then dig into the servlet to find out which jsp it is redirected to. If you are using any application framework then look for the implementation to findout the mapping. For e.g. in spring the spring configuration files or the controller classes tells you where the calls are redirected to.

Upvotes: 1

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 280030

You cannot know which jsp is being displayed unless the developer decided to give hints about it.

A jsp is just a view technology that the servlet uses to render a response. That is, typically, the jsp will be parsed and html will be generated. However, the developer of the servlet may decide to write to the response himself. So nothing can really tell you if what you got came from a jsp or from another source, even if you had a url like www.mydomain.com/page.jsp. Nothing guarantees the response you are seeing in your browser was generated from a jsp.

Upvotes: 3

Pierre Henry
Pierre Henry

Reputation: 17487

The only way to know for sure which JSP is used for rendering is to look at the source code of the servlet that is mapped under (in your example) "appservleer".

Look in web.xml which servlet is mapped with this path, and open the source code of this servlet. Then figure out the execution path, starting with the doGet(...) or the doPost(...) method, and see to which JSP it is forwarded in the end...

Good luck.

Upvotes: 1

Related Questions