在随后的jsp中,有两种激活登录和注册操作的方法:2提交和2 a。提交工作正常,但当我需要与CSS框架集成时,我需要锚点。但他们没有工作,我认为他们已经正确配置。
我的Jsp是:
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<title>MeeTO</title>
</head>
<body>
<s:form action="loginAction" method="post" >
<s:url var="loginLink" action="loginAction.action" />
<s:url var="registerLink" action="registerAction.action" />
<s:label cssClass="login" value="Please fill in the form below in order to Register or Log in:" /> <br>
<s:label for="userBean.username" value="Username:"/>
<s:textfield name="userBean.username" /> <br>
<s:label for="userBean.password" value="Password:"/>
<s:password name="userBean.password" /> <br>
<s:a href="%{loginLink}">
LogIn
</s:a> <br>
<s:a href="%{registerLink}">
Register
</s:a> <br>
<s:submit value="LogIn" action="loginAction" /> <br>
<s:submit value="Register" action="registerAction" /> <br>
</s:form>
<s:fielderror/>
<s:actionerror/>
<s:actionmessage/>
</body>
</html>
答案 0 :(得分:1)
<s:url var="loginLink" action="loginAction.action" />
<s:url var="registerLink" action="registerAction.action" />
为:
<s:url var="loginLink" action="loginAction" />
<s:url var="registerLink" action="registerAction" />
现在工作正常。显然,不需要强行采取行动。