I have been working with some code that i inherited at work and added some new things to it, but now, the data won't print.
The code uses document.write and uses a .js file to help and store strings that are then printed in the JSP using document.write.
rset is a ResultSet
Here is an example:
From the JSP: testme.jsp
<td class="class" width="200" style="border-right: 1px solid<%= v_border %>;"><%= rset.getString("getMe") %>
(<script language="javascript">document.write(disp['getMe']['<%= rset.getString("getMe").substring(0,1) %>']); </script>)
</td>
From JS file: disp.js
disp["getMe"]=new Array()
disp ["getMe"]["X"] = "You Printed Me!";
The code above is just like other code from the program and that code works, but i can't figure out what is different about what I wrote that would cause issues and not print when the correct conditions are met.
When the conditions are met, the display output looks like: Hi There! (You Printed Me!) in the JSP
The text in the parenthesis is meant to be a description of the values that were taken and displayed from the ResultSet.
I know scriptlets and document.write may not be best practice for this sort of thing, but i have been limited in what i can change and use in the code that was given to me.
I went back to the code today and messed around with the other sections that print properly and discovered that modifying the print values in the JS file, did NOT get reflected when displaying the data. So I think something else might be going on as well.
Any help would be really appreciated. I am new to using JavaScript to print data to a JSP.
Thank you!!