jsp - <c:import /> with server username and password

旧时模样 提交于 2021-02-11 08:45:44

问题


I have a simple jsp page that is trying to access another jsp file from another server

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:import url="http://our-other-server.com/header.jsp"></c:import>

As it's our sensitive QA site it's password protected from the server, can I add the username and password as parameters to ? It's a tomcat server where the other site exists. Without the credentials it throws a 500 error of course

enter image description here


回答1:


If your environment uses HTTP Basic access authentication, you can basically add the credentials on the URL as follows:

<c:import url="http://username:password@our-other-server.com/header.jsp" />
  • Wikipedia on HTTP Basic access authentication.


来源:https://stackoverflow.com/questions/16853295/jsp-cimport-with-server-username-and-password

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!