相关疑难解决方法(0)

Angular 2/4/5 - 动态设置基本href

我们有一个企业应用程序,它为客户端使用Angular 2.我们每个客户都有自己独特的网址,例如:https://our.app.com/customer-onehttps://our.app.com/customer-two.目前我们可以<base href...>动态设置document.location.所以用户点击https://our.app.com/customer-two<base href...>设置为/customer-two......完美!

问题是,如果用户是例如,https://our.app.com/customer-two/another-page并且他们刷新页面或尝试直接点击该URL,则<base href...>设置为get /customer-two/another-page并且找不到资源.

我们尝试了以下无济于事:

<!doctype html>
<html>

<head>
  <script type='text/javascript'>
    var base = document.location.pathname.split('/')[1];
    document.write('<base href="/' + base + '" />');
  </script>

...
Run Code Online (Sandbox Code Playgroud)

不幸的是,我们的想法很新鲜.任何帮助都会很棒.

angular

107
推荐指数
9
解决办法
12万
查看次数

/ WEB-INF中的JSP返回"HTTP状态404请求的资源不可用"

我创建了一个JSP文件.

sample.jsp

<%@ page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
  <head>
    <title>Insert title here</title>
  </head>
  <body>
    This is jsp program
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我把它放在samplejsp项目中.

samplejsp
 `-- WebContent
      `-- WEB-INF
           `-- sample.jsp
Run Code Online (Sandbox Code Playgroud)

我在以下网址上打开了它.

http://localhost:8080/samplejsp/sample.jsp

但它在浏览器中显示以下错误.

404错误

请求的资源(/sample.jsp)不可用.

jsp web-inf http-status-code-404

7
推荐指数
1
解决办法
7417
查看次数

标签 统计

angular ×1

http-status-code-404 ×1

jsp ×1

web-inf ×1