日期:2014-05-18  浏览次数:20849 次

怎么html转不到servlet下?
<html>
<body   onload= "../servlet/Mainservlet?method=logout ">  
<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <h2   align= "center "> &#35831;&#31245;&#31561;&#12290;&#12290;&#12290; <br> </h2>
</body>
</html>


servlet描述:
    <servlet-mapping>
        <servlet-name> Mainservlet </servlet-name>
        <url-pattern> /servlet/Mainservlet </url-pattern>
    </servlet-mapping>
路径绝对没错,为什么上面的html转不到servlet下?

------解决方案--------------------
<body onload= "servlet/Mainservlet?method=logout ">
这样写跳转不了吧,
你试试下面的代码:
<script language= "Javascript ">
function doLoad()
{
window.location = "../servlet/Mainservlet?method=logout "
}
</script>
<body onload= "doLoad() ">