0

Here is the complete code.

<%@ page language="java" contentType="text/html;charset=euc-kr" %>
<%@ page import="com.ecm.utilities.bankAcc.TBankAccEnt" %>
<%@ page import="java.util.*,java.text.*" %>
<%@ page import="com.ecm.tools.TRefTabEnt" %>
<%@ page import="com.ecm.tools.TCombTabEnt" %>
<%@ page import="com.ecm.utilities.branch.TBranchEnt" %>
<%@ page import="com.ecm.utilities.coa.TChartOfAccEnt" %>
<%@ page import="core.util.*" %>
test1
<%@ page import="java.util.*,java.text.SimpleDateFormat" %>
test2
<%@ include file="/project/Util.js" %> //The execution is stopped here
test3
<%@ page import="core.presentation.ScreenBean" %>

When I go to the page, it is just blank. I added the test1, test2, test3 and found out that Util.js was the one that is causing the page to display blank because the test2 was displayed but not test3, the code did not passed the include file util.js. I viewed the source code via right-click>View Source and Util.js was incompletely written. There were certain parts of the JS file that did not show in the View Source.

4

2 回答 2

1

I believe what you want is something like this:

<jsp:include file="/project/Util.js" />

A better option would be to use a javascript script tag instead thought:

<script type="text/javascript" src="path/to/project/Util.js />

This question on StackOverflow may help clarify your question: What's the difference between including files with JSP include directive, JSP include action and using JSP Tag Files?

于 2013-11-12T06:33:06.123 回答
1

The include directive

The include directive is processed when the JSP page is translated into a servlet class. The effect of the directive is to insert the text contained in another file (either static content or another JSP page) into the including JSP page. You would probably use the include directive to include banner content, copyright information, or any chunk of content that you might want to reuse in another page. The syntax for the include directive is as follows:

<%@ include file="filename" %>

Remember JavaScript is executed at the client side not at server side.

<script> tag

A client-side script is a program that may accompany an HTML document or be embedded directly in it. The program executes on the client's machine when the document loads, or at some other time such as when a link is activated.

The <script> tag is used to define a client-side script, such as a JavaScript.

The <script> element either contains scripting statements, or it points to an external script file through the src attribute.

Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.

Solution

Remove

<%@ include file="/project/Util.js" %>  

Add

<script src="/project/Util.js" type="text/javascript"/>
于 2013-11-12T06:53:22.057 回答