filename = id;
try {
FileReader in = new FileReader(filename);
BufferedReader buffer = new BufferedReader(in);
while ((strIvNo = buffer.readLine()) != null) {
ZaikuBean zaikubean1 = new ZaikuBean();
int indexNo1 = strIvNo.indexOf(",");
int indexNo2 =
strIvNo.indexOf(",", indexNo1 + 1);
strName = strIvNo.substring(0, indexNo1);
strMailAddress =
strIvNo.substring(
indexNo1 + 1,
indexNo2);
if (!zaikubean1.getMail(strMailAddress)) {
if (!zaikubean1
.addUser(strName, strMailAddress)) {
strCsvFlg = "Failure";
throw new Exception("顧客の追加エラー!");
} else {
strCsvFlg = "Success";
}
} else {
if (!zaikubean1
.update(strName, strMailAddress)) {
strCsvFlg = "Failure";
throw new Exception("顧客の更新エラー!");
} else {
strCsvFlg = "Success";
}
}
}
request.setAttribute("strCsvFlg", strCsvFlg);
LoginServlet loginServlet = new LoginServlet();
loginServlet.SelectTable(request, response);
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(
PagePath.LIST_PATH);
/*リスト画面へ遷移する*/
dispatcher.forward(request, response);
} catch (IOException e) {
System.out.println("File read error: " + e);
}