ログイン時log出力追加。
非ログイン時試合詳細表示追加。
| @@ -3,15 +3,20 @@ | ||
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.sql.Date; |
| 5 | 5 | import javax.annotation.Resource; |
| 6 | +import javax.servlet.http.HttpServletRequest; | |
| 7 | +import javax.servlet.http.HttpSession; | |
| 6 | 8 | |
| 9 | +import org.apache.struts.Globals; | |
| 7 | 10 | import org.apache.struts.action.ActionErrors; |
| 8 | 11 | import org.apache.struts.action.ActionMessage; |
| 9 | 12 | import org.apache.struts.action.ActionMessages; |
| 10 | 13 | import org.seasar.framework.beans.util.Beans; |
| 11 | 14 | import org.seasar.framework.container.annotation.tiger.Aspect; |
| 15 | +import org.seasar.framework.container.factory.SingletonS2ContainerFactory; | |
| 12 | 16 | import org.seasar.struts.annotation.ActionForm; |
| 13 | 17 | import org.seasar.struts.annotation.Execute; |
| 14 | 18 | import org.seasar.struts.enums.SaveType; |
| 19 | +import org.seasar.struts.util.RequestUtil; | |
| 15 | 20 | |
| 16 | 21 | import cx.myhome.ckoshien.dto.BattingResultDto; |
| 17 | 22 | import cx.myhome.ckoshien.dto.GameListDto; |
| @@ -76,6 +81,8 @@ | ||
| 76 | 81 | public List<GameListDto> gameListDtos; |
| 77 | 82 | public Integer leagueId; |
| 78 | 83 | public League league; |
| 84 | +public Team firstTeam; | |
| 85 | +public Team lastTeam; | |
| 79 | 86 | |
| 80 | 87 | @Execute(validator = false) |
| 81 | 88 | public String index(){ |
| @@ -88,6 +95,13 @@ | ||
| 88 | 95 | @Aspect(value="loginConfInterceptor") |
| 89 | 96 | @Execute(validator = false) |
| 90 | 97 | public String create(){ |
| 98 | +// HttpSession session = | |
| 99 | +// (HttpSession) SingletonS2ContainerFactory | |
| 100 | +// .getContainer() | |
| 101 | +// .getExternalContext() | |
| 102 | +// .getSession(); | |
| 103 | + //session.removeAttribute("gameSummaryForm"); | |
| 104 | + | |
| 91 | 105 | teamList=teamService.findAllOrderById(); |
| 92 | 106 | playerList=playerService.findAllOrderById(); |
| 93 | 107 | return "create.jsp"; |
| @@ -95,9 +109,8 @@ | ||
| 95 | 109 | |
| 96 | 110 | @Aspect(value="loginConfInterceptor") |
| 97 | 111 | //@Execute(validator = true,input="create?redirect=true") |
| 98 | - @Execute(validator = true,input="create?redirect=true", | |
| 112 | + @Execute(validator = true,input="create", | |
| 99 | 113 | stopOnValidationError=false, |
| 100 | - saveErrors=SaveType.SESSION, | |
| 101 | 114 | validate="dateValidate", |
| 102 | 115 | removeActionForm=true) |
| 103 | 116 | public String createComplete(){ |
| @@ -200,13 +213,25 @@ | ||
| 200 | 213 | return "index&redirect=true"; |
| 201 | 214 | } |
| 202 | 215 | |
| 216 | + @Execute(urlPattern="show/{id}",validator = false) | |
| 217 | + public String show(){ | |
| 218 | + gameId=Integer.parseInt(gameSummaryForm.id); | |
| 219 | + game=gameService.findById(gameId); | |
| 220 | + //playerList=playerService.findAllOrderById(); | |
| 221 | + firstTeam=teamService.findById(game.firstTeam); | |
| 222 | + lastTeam=teamService.findById(game.lastTeam); | |
| 223 | + //teamList=teamService.findAllOrderById(); | |
| 224 | + firstPitchingList=pitchingService.findByGameId(gameId,game.firstTeam); | |
| 225 | + lastPitchingList=pitchingService.findByGameId(gameId,game.lastTeam); | |
| 226 | + firstBattingSumList=battingSumService.findByGameId(gameId,game.firstTeam); | |
| 227 | + lastBattingSumList=battingSumService.findByGameId(gameId,game.lastTeam); | |
| 228 | + //logic= new GameSummaryLogic(); | |
| 229 | + //gameSummaryForm=logic.convert2GameSummary(game,firstBattingSumList,lastBattingSumList,gameSummaryForm,firstPitchingList,lastPitchingList); | |
| 230 | + return "show.jsp"; | |
| 231 | + } | |
| 232 | + | |
| 203 | 233 | @Aspect(value="loginConfInterceptor") |
| 204 | - @Execute(urlPattern="edit/{id}", | |
| 205 | - validator = true,input="edit/{id}?redirect=true", | |
| 206 | - stopOnValidationError=false, | |
| 207 | - saveErrors=SaveType.SESSION, | |
| 208 | - validate="dateValidate", | |
| 209 | - removeActionForm=true) | |
| 234 | + @Execute(urlPattern="edit/{id}",validator = false) | |
| 210 | 235 | public String edit(){ |
| 211 | 236 | gameId=Integer.parseInt(gameSummaryForm.id); |
| 212 | 237 | game=gameService.findById(gameId); |
| @@ -222,7 +247,10 @@ | ||
| 222 | 247 | } |
| 223 | 248 | |
| 224 | 249 | @Aspect(value="loginConfInterceptor") |
| 225 | - @Execute(validator=true,input="edit.jsp") | |
| 250 | + @Execute(validator=true,input="edit/{id}", | |
| 251 | + stopOnValidationError=false, | |
| 252 | + validate="dateValidate", | |
| 253 | + removeActionForm=true) | |
| 226 | 254 | public String updateComplete(){ |
| 227 | 255 | StringBuilder sb = new StringBuilder(); |
| 228 | 256 | //日付を連結 |
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | import javax.annotation.Resource; |
| 4 | 4 | |
| 5 | +import org.apache.log4j.Logger; | |
| 5 | 6 | import org.apache.struts.action.ActionMessage; |
| 6 | 7 | import org.apache.struts.action.ActionMessages; |
| 7 | 8 | import org.seasar.framework.beans.util.Beans; |
| @@ -26,6 +27,8 @@ | ||
| 26 | 27 | |
| 27 | 28 | public Player player; |
| 28 | 29 | |
| 30 | + static Logger logger = Logger.getLogger("rootLogger"); | |
| 31 | + | |
| 29 | 32 | @Execute(validator = false) |
| 30 | 33 | public String index() { |
| 31 | 34 | return "/login/index.jsp"; |
| @@ -55,9 +58,12 @@ | ||
| 55 | 58 | |
| 56 | 59 | //パスワード照合エラー |
| 57 | 60 | player = playerService.findByLoginId(playerForm.loginId); |
| 61 | + logger.info("ログインID:"+playerForm.loginId); | |
| 62 | + logger.info("パスワード:"+playerForm.password); | |
| 58 | 63 | if (player!=null){ |
| 59 | 64 | if (!player.password.equals(playerForm.password)) { |
| 60 | 65 | errors.add("login", new ActionMessage("errors.login")); |
| 66 | + logger.warn("一致しないパスワード:"+playerForm.password); | |
| 61 | 67 | } |
| 62 | 68 | if (player.authority!=1) { |
| 63 | 69 | errors.add("login", new ActionMessage("errors.login")); |
| @@ -64,6 +70,7 @@ | ||
| 64 | 70 | } |
| 65 | 71 | }else{ |
| 66 | 72 | errors.add("login", new ActionMessage("errors.login")); |
| 73 | + logger.warn("存在しないログインID:"+playerForm.loginId); | |
| 67 | 74 | } |
| 68 | 75 | |
| 69 | 76 | return errors; |
| @@ -49,7 +49,7 @@ | ||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public List<Pitching> findByGameId(Integer gameId,Integer myTeamId) { |
| 52 | - list=select().where("gameId=? AND myTeamId=?",gameId,myTeamId).orderBy(asc(id())).getResultList(); | |
| 52 | + list=select().innerJoin(player()).where("gameId=? AND myTeamId=?",gameId,myTeamId).orderBy(asc(id())).getResultList(); | |
| 53 | 53 | return list; |
| 54 | 54 | } |
| 55 | 55 | public List<Pitching> findByGameIdAll(Integer gameId) { |
| @@ -31,7 +31,7 @@ | ||
| 31 | 31 | * @return エンティティのリスト |
| 32 | 32 | */ |
| 33 | 33 | public List<Player> findAllOrderById() { |
| 34 | - return select().orderBy(asc(teamId())).getResultList(); | |
| 34 | + return select().innerJoin(team()).orderBy(asc(teamId())).getResultList(); | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public Player findByLoginId(String loginId) { |
| @@ -48,7 +48,7 @@ | ||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public List<BattingSum> findByGameId(Integer gameId,Integer myTeamId) { |
| 51 | - list=select().where("gameId=? AND myTeamId=?",gameId,myTeamId).orderBy(asc(id())).getResultList(); | |
| 51 | + list=select().innerJoin(player()).where("gameId=? AND myTeamId=?",gameId,myTeamId).orderBy(asc(id())).getResultList(); | |
| 52 | 52 | return list; |
| 53 | 53 | } |
| 54 | 54 | public List<BattingSum> findByGameIdAll(Integer gameId) { |
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | import org.seasar.framework.container.annotation.tiger.InstanceType; |
| 8 | 8 | import org.seasar.struts.annotation.Required; |
| 9 | 9 | |
| 10 | -@Component(instance=InstanceType.SESSION) | |
| 10 | +//@Component(instance=InstanceType.SESSION) | |
| 11 | 11 | public class GameSummaryForm implements Serializable{ |
| 12 | 12 | private static final long serialVersionUID = 1L; |
| 13 | 13 |