0

I'm a dba and our team has recently lost both Java developers that were developing/sustaining our applications. We discovered that some of our .jsp files need to be modified and us DBAs are trying to figure it out while we try to find a developer; however, I'm having a hard time understanding where some of these variables are coming from. The file I'm working on is very short:

<%@ include file="../../include/header-text-email.html" %>
Your ZEDIAN account for ${system} will be terminated in ${daysLeft} days based on inactivity
or based on an established expiration date.

<%--%>
check if ${system} evaluates to WAF, if so display different message
Found on Stack Overflow (https://stackoverflow.com/questions/26930216/using-if-else-in-jsp):

<c:choose>
    <c:when test="${empty user}">
        I see!  You don't have a name.. well.. Hello no name
    </c:when>
    <c:otherwise>
        <%@ include file="response.jsp" %>
    </c:otherwise>
</c:choose>

Also, unless you plan on using response.jsp somewhere else in your code, it might be easier to just include the html in your otherwise statement:
<c:otherwise>
    <h1>Hello</h1>
    ${user}
</c:otherwise>

<%--%>
To avoid termination for inactivity, please visit <c:out value="${url}"/>.
Terminating your account requires no action.


If you have any questions, please email the ZEDIAN mailbox at:
<c:out value="${mailbox}"/>

I left a comment in the file that shows what I'm trying to do. I'd like to see if the ${system} variable will evaluate to WAF (the system that is causing our problems and requires its own outbound email thats different than the other systems). That said, I know where the variables are coming from in the database but I'm not sure where they come from in this file. I'm not sure if the format of ${system} is the same as the version in the database (i.e. abbreviated, uppercase, lowercase, etc...) I've tried looking for these values in other files but I'm not seeing where they values are set. Can anyone provide any guidance?

flwr_pwr
  • 150
  • 4
  • 16

2 Answers2

0
  1. They appear to be coming from the included file.
  2. A JSP page executes in a context where quite a few variables are providedu: the request, the URL, the session, ... You will have to look at the documentation some time: why not now?
user207421
  • 305,947
  • 44
  • 307
  • 483
-1

There is a servlet (which is a java file only) whose job is to handle the request coming in. The servlet will have a method like get or post.

In this method there will be logic to set the attributes at request scope.

request.setAttribute("system", "some value");

These attributes accessed in jsp as ${system}

Geek
  • 627
  • 1
  • 8
  • 18
  • Thank you for that answer! That makes sense. Do you know how I might go about finding which file would have that servlet? I'm assuming it would be on the application server, where I pulled this file from. I've searched alot of the files (there are about 100 or so) but not all of them and I'm not sure where to look. I understand you won't know the specific directories and files involved with our apps but I'm looking to see if there's a common place to store these? – flwr_pwr Sep 20 '17 at 19:02
  • Look for a file called `WEB-INF/web.xml` it will have mappings for a servlet to a specific URL pattern. Look at the URL you are accessing this page in your browser, find that matching pattern in web.xml, and you'll see the name of the servlet which handles the request. Unless your application is using some framework like `struts` or something else. – Nicholas Hirras Sep 20 '17 at 19:04
  • Try doing a Search for 'setAttribute.*system' in *java file. It will get you closer to the answer. Open those java file from results send see if they have reference of the jsp file which has the attributes in question – Geek Sep 20 '17 at 19:08
  • Could be a session variable too, in which case it will likely be declared in a login servlet of some sort. – Jonathan Laliberte Sep 20 '17 at 19:51
  • The request can come direct to the JSP page. Request attributes are not accessed as described. This answer is not correct. – user207421 Sep 20 '17 at 22:59
  • So you are saying the answer is incorrect or there can be other possibilties too? – Geek Sep 20 '17 at 23:03