📄 testaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.tb.test.action;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.Globals;
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.tb.test.model.TestModel;
/**
* MyEclipse Struts
* Creation date: 03-27-2008
*
* XDoclet definition:
* @struts.action path="/test" name="testModel" input="/test/add.jsp" scope="request" validate="true"
*/
public class TestAction 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) {
TestModel testModel = (TestModel) form;// TODO Auto-generated method stub
String type = testModel.getType()==null?"":testModel.getType().toString().toLowerCase();
if(type.equals("")){
Locale locale = null;
String yuyan = testModel.getYuyan()==null?"":testModel.getYuyan().toString().trim().toLowerCase();
if("".equals(yuyan) || yuyan.equals("1"))
locale = Locale.SIMPLIFIED_CHINESE;
else if(yuyan.equals("2"))
locale = Locale.US;
else if(yuyan.equals("3"))
locale = Locale.TRADITIONAL_CHINESE;
request.getSession().setAttribute(Globals.LOCALE_KEY,locale);
return mapping.findForward("add");
}
else if(type.equals("add")){
Locale locale = null;
String yuyan = testModel.getYuyan()==null?"":testModel.getYuyan().toString().trim().toLowerCase();
if("".equals(yuyan) || yuyan.equals("1"))
locale = Locale.SIMPLIFIED_CHINESE;
else if(yuyan.equals("2"))
locale = Locale.US;
else if(yuyan.equals("3"))
locale = Locale.TRADITIONAL_CHINESE;
request.getSession().setAttribute(Globals.LOCALE_KEY,locale);
return mapping.findForward("add");
}
else
return mapping.findForward("add");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -