0

I created a webservice project named FirstTest using dwr.

In WebContent folder I have a JSP. After successful deployment there is a JS

localhost:8080/FirstTest/dwr/interface/getdata.js

So in JSP I wrote

<script type="text/javascript" src="/FirstTest/dwr/interface/getdata.js">

Now I rename the project to SecondTest then the js location changed to

localhost:8080/SecondTest/dwr/interface/getdata.js

and I have to rewrite the JSP file path. Then how to use relative path instead? I tried

<script type="text/javascript" src="../dwr/interface/getdata.js">

and

<script type="text/javascript" src="/dwr/interface/getdata.js">

but both not working.

Thx for any help.

kk luo
  • 549
  • 1
  • 9
  • 22

1 Answers1

0
<script type="text/javascript" src="/dwr/interface/getdata.js">

In this line the first "/" means the the root directory of your site. Check the deployed root directory in your server and make sure from root directory this file path is present. Rest looks good on this line.

A Paul
  • 8,113
  • 3
  • 31
  • 61
  • I use wildfly with default setting for deployment. And I put the war file in the deployment folder as default. So you mean I should check the configuration of server? Thx. – kk luo Dec 28 '20 at 01:50
  • @kkluo That could be a configuration issue, but I think in your case its more path, I think you have to use /SecondTest/dwr/interface/getdata.js as you are putting the war file inside the default folder. – A Paul Dec 28 '20 at 01:55