问题
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
回答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