0

I gotta situation where my project is up & running from many years.

Now to enhance it's security I'm planning to include some code (Using a common javascript & jsp file) in every jsp file.

To overcome this manual work, is there any way out where I can configure my web application (In web.xml or somewhere else) and my file includes goes with every page my container dispatch.

Sample Code:

<script type="text/javascript" src="myCommonCode.js"></script>
<%@include file="myHelperFile.jsp" %>
Jaykishan
  • 1,409
  • 1
  • 15
  • 26
  • 1
    Should not be too hard to make the necessary changes in the source files with a little shell script. On *NIX I would use a combination of `find` and `sed` to achieve that. – Henry Oct 19 '18 at 05:03
  • 1
    Did you ever include other own jsp file? like `<%@include file="header.jsp" %>`, if so, you just add your code in header.jsp. If not you have to add a line like that. You can use shell to modify files or use replace function in IDE. Find some markable code and add your line – Bejond Oct 19 '18 at 06:15
  • 1
    @Henry suggests a shell script, but this should also be possible to do directly in the IDE. Search and replace? Most IDE:s, such as IntelliJ IDEA, supports search and replace with regexp. – Magnilex Oct 19 '18 at 06:17
  • @Bejond No there is not any common jsp file which I can utilize. – Jaykishan Oct 23 '18 at 06:25
  • Henry & Magnilex, I know that using some script or by finding and adding content I can do. But what I'm expecting is that while dispatching the jsp my container handle such thing. And that I can further enhance and control as well. – Jaykishan Oct 23 '18 at 06:27

0 Answers0