62,612
社区成员
发帖
与我相关
我的任务
分享
private final String SESSION_KEY = "JN050_SESSION";
private void saveToSession(HttpServletRequest request, JN050ActionForm form){
HttpSession session = request.getSession();
JN050ActionForm sessionForm = new JN050ActionForm();
sessionForm.setCsvFileFormatList(form.getCsvFileFormatList());
sessionForm.setErrorMessages(form.getErrorMessages());
sessionForm.setFullList(form.getFullList());
sessionForm.setPageList(form.getPageList());
sessionForm.setRootCodeMap(form.getRootCodeMap());
session.setAttribute(SESSION_KEY, sessionForm);
}
private void restoreFromSession(HttpServletRequest request, JN050ActionForm form){
HttpSession session = request.getSession();
JN050ActionForm sessionForm = (JN050ActionForm)session.getAttribute(SESSION_KEY);
form.setCsvFileFormatList(sessionForm.getCsvFileFormatList());
form.setErrorMessages(sessionForm.getErrorMessages());
form.setFullList(sessionForm.getFullList());
form.setPageList(sessionForm.getPageList());
form.setRootCodeMap(sessionForm.getRootCodeMap());
}
package com.sytdc.cxl;
import java.util.ArrayList;
public class ZhenZeTest {
/**
* @param args
*/
public static void main(String[] args) {
ArrayList<String> ar = new ArrayList<String>();
ar.add("001");
ar.add("003");
ar.add("002");
ar.add("004");
for(String o:ar){
System.out.println("000 == "+ o);
}
ArrayList<Integer> ar2 = new ArrayList<Integer>();
ar2.add(001);
ar2.add(003);
ar2.add(002);
ar2.add(004);
for(Integer o:ar2){
System.out.println("000 ==2 "+ o);
}
}
}
Object value;
ArrayList<String> formatList = null;
value = session.getAttribute(KEY_FORMAT);
if ((new ArrayList<String>()).getClass().isInstance(value)){
formatList = (ArrayList<String>)value;
}
HttpSession session = request.getSession();
Object value;
ArrayList<String> formatList = null;
value = session.getAttribute(KEY_FORMAT);
if (value != null){
formatList = (ArrayList<String>)value; // 此行被警告
}