jsp代码如下:<html>
<head>
<base href="<%=basePath%>"> <title>登陆页</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="<%=path %>/css/main.css">
</head> <body class="bodycss" onload="javascript:document.getElementById('j_username').focus();">

<form  name="f" action="${pageContext.request.contextPath}/j_spring_security_check" method="post">
<p style="color: red;">
${sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message }
</p>
<h3>请登录</h3>
<hr/>
<br/>

<table >
<tr>
<td style="width:60px;">

<label>用户名</label></td>
<td>
<input type="text" style="width:155px;" name='j_username' title="请输入用户名" placeholder="请输入用户名">
</td>
</tr>

<tr>
<td style="width:60px;">
<label>密码</label>
</td>
<td>
<input style="width:155px;" type="password" name='j_password' title="请输入密码" placeholder="请输入密码">
</td>
</tr>

<tr>
<td colspan="2">
<input type='checkbox' name='_spring_security_remember_me' />
两周内不需要登录(请不要再公共网络上勾选此项)。
</td>
</tr>

<tr>
<td>
<input  type="submit"  value="登  录" />
</td>
<td>
<input type="button" value="重  置" onclick="javascript:window.document.f.j_username='';window.document.f.j_password='';" />
</td>
</tr>
</table>

</form>
</body>
</html>
目前出现的问题是,点击提交,直接链接到样式文件?

解决方案 »

  1.   

    楼主,你的j_spring_security_check是什么东东?
      

  2.   

    不知道你讲的样式文件的表单action指定的url有什么关系,还有就是有没有提交经过url,然后重定向之类的。
      

  3.   

    j_spring_security_check后面是否应该加上.action?
      

  4.   

    j_spring_security_check    这个是不是用了spring security?
    看看spring security的配置文件,应该是你的action被拦截了吧
      

  5.   

    对的,我确实用了。
    spring security
    链接到样式文件是,
    网站跳转到main.css文件去了
    页面直接显示main.css的内容~action被拦截也不会跳到样式问去吧?
      

  6.   

    你应该是登录成功了,但是你登录成功后跳转的页面不对,查一下你的spring security配置的default-target-url 参数,是不是配置为main.css了?或者你是跳转到根目录,但你web.xml里面配了main.css为welcome page