jsp路径

    xiaoxiao2025-10-05  2

    Page directive: illegal to have multiple occurrences of contentType with different values (old:..,new:…) 一个jsp include 另外一个jsp,报了上面的错 原因上两个jsp的 contentType 不一致

    1)<%@ page language=”java” contentType=”text/html” pageEncoding=”UTF-8”%> 2) meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8” 这两个标签,引用的jsp和被引用的jsp都保持一致

    2.jsp的路径 1): 我的项目名称是visaordercenter jsp:include @page include welcome c:url 和java后台的得到路径的方法

    这几个标签的/会自动加上项目名 譬如: /caissainclude/header_script.jsp 解析后等同于 http://localhost:8080/visaordercenter/caissainclude/header_script.jsp

    2): script css a的href window.location.href form表单action ajax 以上标签的/不会自动加上项目名称,只会加上服务器IP 譬如: /caissainclude/header_script.jsp 实际上是: http://localhost:8080/caissainclude/header_script.jsp 没有这个路径

    应该这么写 或者用c:url 标签给抱起来 /visaordercenter/caissainclude/header_script.jsp 解析后就是: http://localhost:8080/visaordercenter/caissainclude/header_script.jsp 就是的路径了

    其他./ ../ 或者直接**.jsp等 则自己测试,一般写绝对路径

    3.foward 转发 公用request,地址栏不变 redirect 重定向,request失效生成新的,地址栏改变

    转载请注明原文地址: https://ju.6miu.com/read-1302867.html
    最新回复(0)