📄 unitaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.captainli.struts.action;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.captainli.dboperation.UnitDA;
import com.captainli.struts.form.UnitForm;
/**
* MyEclipse Struts
* Creation date: 10-31-2008
*
* XDoclet definition:
* @struts.action path="/unit" name="unitForm" scope="request" validate="true"
*/
public class UnitAction extends DispatchAction {
/*
* Generated Methods
*/
/**
* 添加计量单位
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws IOException
*/
public ActionForward addUnit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UnitForm unitForm = (UnitForm) form;// TODO Auto-generated method stub
//js中解决乱码问题
response.setContentType("text/html;UTF-8");
response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
new UnitDA().addUnit(unitForm);
out.write("<script language='javascript'>window.alert('计量单位添加成功!');window.location.href='systemPages/unit.jsp';</script>");
out.flush();
out.close();
return null;
}
/**
* 修改计量单位
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws IOException
*/
public ActionForward updateUnit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UnitForm unitForm = (UnitForm) form;// TODO Auto-generated method stub
//js中解决乱码问题
response.setContentType("text/html;UTF-8");
response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
int u_id = Integer.parseInt(request.getParameter("uid"));
new UnitDA().updateUnit(unitForm, u_id);
out.write("<script language='javascript'>window.alert('计量单位修改成功!');window.location.href='systemPages/unit.jsp';</script>");
out.flush();
out.close();
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -