这是登录界面<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title></head><body><from action="LoginAction.action" method="post">用户名:<input type="text" name="user.username"><br/>密码:<input type="password" name="user.password"><br/><input type="submit" value="提交"/></from></body></html><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"><struts> <package name="default" extends="struts-default"> <default-action-ref name="index"></default-action-ref> <action name="index"> <result>/error.jsp</result> </action> <action name="helloworld" class="an.cm.HelloWorldAction"> <result>/result.jsp</result> </action> <action name="addAction" method="add" class="an.cm.HelloWorldAction"> <result>/add.jsp</result> </action> <action name="updateAction" method="update" class="an.cm.HelloWorldAction"> <result >/update.jsp</result> </action> <action name=" LoginAction" method="login" class="an.cm.LoginAction"> <result >/success.jsp</result> </action> </package> </struts>package an.cm;import com.opensymphony.xwork2.ActionSupport;import an.cm.User;public class LoginAction extends ActionSupport { private User user; public String login(){ System.out.println(user.getUsername()); return SUCCESS; } public User getUser() { return user; } public void setUser(User user) { this.user = user; }}package an.cm;public class User { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }代码我都是根据视频写的 点击提交按钮 界面无法调转到另外一个界面
添加回答
举报
0/150
提交
取消