📄 indexaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.meet.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.meet.bean.meeting;
import com.meet.struts.form.IndexForm;
import java.sql.*;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
/**
* MyEclipse Struts
* Creation date: 06-11-2008
*
* XDoclet definition:
* @struts.action path="/index" name="indexForm" input="/form/index.jsp" scope="request" validate="true"
*/
public class IndexAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public String codeToString(String str) {
String s = str;
try {
byte tb[] = s.getBytes("iso-8859-1");
s = new String(tb, "Gbk").trim();
} catch (Exception e) {
e.printStackTrace();
}
return s;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
IndexForm indexForm = (IndexForm) form;
ActionErrors error = new ActionErrors();
meeting me = new meeting();
String mana = codeToString(indexForm.getUsername());
String key = codeToString(indexForm.getKey());
String str = "select * from manager where mana_ID='" + mana
+ "' and password= '" + key + "'";
ResultSet rs = me.executeFind(str);
try {
rs.next();
int i = rs.getRow();
if (i == 0) {
error.add("username", new ActionError("com.meet.usernamewrong"));
return mapping.findForward("faile");
} else {
return mapping.findForward("success");
}
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -