Solved

finding out which jsp is included in a web page

Posted on 2014-02-13
5
502 Views
Last Modified: 2014-03-13
Hi,
I have a file named additionalAddDisplay.jsp
Now this is included in two jsp
1) standard.jsp
2) secureStandard.jsp

For these two i only find reference in the tiles. xml which is as follows :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
	"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
	"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>

	<definition name="standardLayout" template="/WEB-INF/layouts/standard.jsp" preparer="com.yatra.platform.commons.utils.YatraViewPreparer">
		<put-attribute  name="topBar" value="/WEB-INF/layouts/topbar.jsp" />
		<put-attribute name="title" value="Yatra Online" />
		<put-attribute name="header" value="/WEB-INF/layouts/header.jsp" />
		<put-attribute name="content" value=""/>
		<put-attribute name="seofooter" value=""/>
		<put-attribute name="footer" value="/WEB-INF/layouts/footer.jsp" />
		<put-attribute name="themeFromCMS" value="" />
	</definition>

	<definition name="promoStandardLayout" template="/WEB-INF/layouts/promoStandard.jsp" preparer="com.yatra.platform.commons.utils.YatraViewPreparer">
		<put-attribute  name="topBar" value="/WEB-INF/layouts/topbar.jsp" />
		<put-attribute name="title" value="Yatra Online" />
		<put-attribute name="header" value="/WEB-INF/layouts/header.jsp" />
		<put-attribute name="content" value=""/>
		<put-attribute name="seofooter" value=""/>
		<put-attribute name="footer" value="/WEB-INF/layouts/footer.jsp" />
	</definition>

	<definition name="secureStandardLayout" template="/WEB-INF/layouts/secureStandard.jsp" preparer="com.yatra.platform.commons.utils.YatraViewPreparer">
		<put-attribute  name="topBar" value="/WEB-INF/layouts/secureTopbar.jsp" />
		<put-attribute name="title" value="Yatra Online" />
		<put-attribute name="header" value="/WEB-INF/layouts/secureHeader.jsp" />
		<put-attribute name="content" value=""/>
		<put-attribute name="seofooter" value=""/>
		<put-attribute name="footer" value="/WEB-INF/layouts/secureFooter.jsp" />
	</definition>

	<definition name="printETicketLayout" template="/WEB-INF/layouts/standard.jsp" preparer="com.yatra.platform.commons.utils.YatraViewPreparer">
		<put-attribute  name="topBar" value=""  />
		<put-attribute name="title" value="Yatra Online" />
		<put-attribute name="header" value="" />
		<put-attribute name="content"  />
		<put-attribute name="footer" value="" />
		<put-attribute name="themeFromCMS" value="" />
	</definition>

	<definition name="errorStatusPage" extends="standardLayout">
		<put-attribute name="content" value="/WEB-INF/layouts/resourceUnAvailable404.jsp" />
	</definition>

	<definition name="error" extends="standardLayout">
		<put-attribute name="content" value="/WEB-INF/layouts/error.jsp" />
	</definition>

	<definition name="erroredSearch" extends="standardLayout">
		<put-attribute name="content" value="/WEB-INF/layouts/erroredSearch.jsp" />
	</definition>

	<definition name="waitPageLayout" template="/WEB-INF/layouts/waitpage.jsp">
		<put-attribute name="title" value="Yatra Online" />
	</definition>

	<definition name="tgWaitPageLayout" template="/WEB-INF/layouts/tgwaitpage.jsp">
		<put-attribute name="title" value="Yatra Online" />
	</definition>

</tiles-definitions>

Open in new window


Now how do i find out whether standard.jsp is included in my webpage or securestandard.jsp is included.

Also whats the use of tiles.xml

I need to add some parameters in model so that i can access it in additionalAddDisplay.jsp
I am also unable to find out which file is reponsible for this so that i could include the parameters in map and then access it in this jsp.

Any help will be appreciated

Thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 35

Expert Comment

by:mccarl
ID: 39857952
The answer to your above question requires some more information. Can you please provide your spring xml configuration files? Also (if there is not too many of them) can you provide the code for your Spring Controller classes? This information should be able to tell us where this is all coming from, but at a high level... your Controller class will generally state which "view" should be rendered to the client, and this "view" will be mapped in some way (there are numerous hence why the extra info required) to a definition "name" that links to your tiles.xml file as given above. Then as you can probably see from the above, the definition refers to the layout template and any attributes to provide to that template.

So anyway from the above tiles.xml you can work out the list of "definitions" that use either standard.jsp or secureStandard.jsp...

standardLayout
secureStandardLayout
printETicketLayout
errorStatusPage            (indirectly via standardLayout)
error                               (indirectly via standardLayout)
erroredSearch               (indirectly via standardLayout)

and so we just need to work out what controller methods refer ultimately to those definition names.
0
 

Author Comment

by:Rohit Bajaj
ID: 39858314
HI,
I am attaching important controllers which i think and root-context.xml.
Please see if this can help or you need more files.

Thanks
Spring-project-files.zip
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39869549
Ok, so in most of those Controller's the actual view name that they return is hidden inside a method call, which is usually this...

resultRulesBean.getResponsePage()

If you look for that in your Controller's and find out what resultRulesBean is doing and what it will return for the .getResponsePage you should find out which layout is in use and subsequently which .jsp is used to render to the user.

My guess is that to include the additional model attirbutes need to support your changes to additionalAddDisplay.jsp might be best placed in your ModelPopulator class as it seems that that is called for most pages that you return a view. Note that there isn't a huge problem if you add the data that you need to the model and pages "other" than standard.jsp or securestandard.jsp end up rendered, the data just won't get used. So maybe the easiest way to go is to just include all the time in the model (in a class like ModelPopulator) and you just use it if additionalAddDisplay.jsp ends up being called.
0
 

Author Comment

by:Rohit Bajaj
ID: 39908885
HI mccarl,
Thanks for the above post. I will update shortly on it, if i need some more information.
Thanks
0
 

Author Closing Comment

by:Rohit Bajaj
ID: 39926030
Hi Mccarl,
Just needed some suggestions from you. I am a java developer working on springs framework web Application. I want to know what according to you are good or emerging technologies which one should learn or which will have good scope in future ?
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
String array comparison 4 57
Adding multiple JVM environments to RedHat 6 7 81
jsp error 6 70
What browser will run Java? 7 177
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question