⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inputjobsaction.java

📁 带分页显示的简单例子 Hibernate
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package fmq.struts.action;

import fmq.model.bo.*;
import fmq.model.dao.*;
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 fmq.struts.form.InputJobsForm;

/** 
 * MyEclipse Struts
 * Creation date: 06-06-2007
 * 
 * XDoclet definition:
 * @struts.action path="/inputJobs" name="inputJobsForm" input="/form/inputJobs.jsp" scope="request" validate="true"
 * @struts.action-forward name="success" path="/form/searchJobs.jsp"
 */
public class InputJobsAction extends Action {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		InputJobsForm inputJobsForm1 = (InputJobsForm) form;// TODO Auto-generated method stub
		
		Jobs jobs = new Jobs();
		JobsDAO jobsDAO = new JobsDAO();
		
		try {
			// 以下编码转换OK!!
			//jobs.setJobDesc(new String(inputJobsForm.getJobDesc().getBytes("ISO8859-1"), "GB2312"));	// OK!
			// 以下编码转换OK!!
			//jobs.setJobDesc(new String(inputJobsForm.getJobDesc().getBytes("ISO8859-1")));			// OK!
			// 以下编码转换方法产生乱码!!因为 Struts 传输的是 ISO8859_1 编码 !!
			//jobs.setJobDesc(new String(inputJobsForm.getJobDesc().getBytes("GB2312")));					// 乱码!! 因为 Struts 传输的是 ISO8859_1 编码
			
			// 交由使用 Filter 进行统一处理 OK!!
			//String tmpStr = inputJobsForm.getJobDesc();
			//jobs.setJobDesc(tmpStr);
			jobs.setJobDesc(inputJobsForm1.getJobDesc());			
			
		} catch (Exception e) {
			// TODO: handle exception
		}			
		//jobs.setJobDesc(new String(inputJobsForm.getJobDesc(), "GB2312"));
		jobs.setMinLvl(inputJobsForm1.getMinLvl());
		jobs.setMaxLvl(inputJobsForm1.getMaxLvl());
		//jobsDAO.save(jobs);
		
		//return mapping.findForward("success");
        //return (new ActionForward(mapping.getInput()));
        inputJobsForm1.setMinLvl(new Short("121"));
        inputJobsForm1.setMaxLvl(new Short("131"));
        
        String tmpStr;
        tmpStr = inputJobsForm1.getJobDesc();
        System.out.println(tmpStr);
        
        return mapping.findForward("edit");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -