質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -209,3 +209,7 @@
|
|
209
209
|
|
210
210
|
|
211
211
|
```
|
212
|
+
|
213
|
+
postmasterカラム詳細
|
214
|
+
|
215
|
+
![イメージ説明](443ec28b1589bef154c3b5a89750e536.png)
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -166,7 +166,7 @@
|
|
166
166
|
|
167
167
|
while (rs.next()) {
|
168
168
|
|
169
|
-
|
169
|
+
int id = rs.getInt(id);
|
170
170
|
|
171
171
|
String title = rs.getString("title");
|
172
172
|
|
@@ -178,7 +178,7 @@
|
|
178
178
|
|
179
179
|
|
180
180
|
|
181
|
-
pm.set
|
181
|
+
pm.setId(id);
|
182
182
|
|
183
183
|
pm.setTitle(title);
|
184
184
|
|
@@ -206,4 +206,6 @@
|
|
206
206
|
|
207
207
|
|
208
208
|
|
209
|
+
|
210
|
+
|
209
211
|
```
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,6 +4,10 @@
|
|
4
4
|
|
5
5
|
タイトル通りですが、aタグを使ってパラメータを渡したいのですが、変遷先のURLを見るとnullになってしまいます。。
|
6
6
|
|
7
|
+
(変遷前URL:http://localhost:8080/XXX/
|
8
|
+
|
9
|
+
変遷後URL:http://localhost:8080/XXX/article/article.jsp?id=null)
|
10
|
+
|
7
11
|
forやgetは動作しているので問題ありませんが、href内のgetが上手くいってないようです。。
|
8
12
|
|
9
13
|
jspでgetしてリンク先にパラメータを送るのは無理なのでしょうか。。
|
@@ -99,3 +103,107 @@
|
|
99
103
|
</body>
|
100
104
|
|
101
105
|
```
|
106
|
+
|
107
|
+
PostMasterMapper
|
108
|
+
|
109
|
+
```
|
110
|
+
|
111
|
+
package model;
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
import java.sql.Connection;
|
116
|
+
|
117
|
+
import java.sql.DriverManager;
|
118
|
+
|
119
|
+
import java.sql.PreparedStatement;
|
120
|
+
|
121
|
+
import java.sql.ResultSet;
|
122
|
+
|
123
|
+
import java.sql.SQLException;
|
124
|
+
|
125
|
+
import java.util.ArrayList;
|
126
|
+
|
127
|
+
import java.util.List;
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
public class PostMasterMapper {
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
public List<PostMaster> findAll() {
|
136
|
+
|
137
|
+
List<PostMaster> postlist = new ArrayList<PostMaster>();
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
try (
|
142
|
+
|
143
|
+
// データベースに接続
|
144
|
+
|
145
|
+
Connection connect = DriverManager.getConnection(
|
146
|
+
|
147
|
+
"jdbc:mysql://localhost:8880/XXX",
|
148
|
+
|
149
|
+
"root",
|
150
|
+
|
151
|
+
"XXX");
|
152
|
+
|
153
|
+
) {
|
154
|
+
|
155
|
+
String sql = "SELECT * FROM postmaster";
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
PreparedStatement ps = connect.prepareStatement(sql);
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
ResultSet rs = ps.executeQuery();
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
while (rs.next()) {
|
168
|
+
|
169
|
+
String id = rs.getString("id");
|
170
|
+
|
171
|
+
String title = rs.getString("title");
|
172
|
+
|
173
|
+
String honbun = rs.getString("honbun");
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
PostMaster pm = new PostMaster();
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
pm.setTitle(id);
|
182
|
+
|
183
|
+
pm.setTitle(title);
|
184
|
+
|
185
|
+
pm.setHonbun(honbun);
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
postlist.add(pm);
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
} catch (SQLException e) {
|
194
|
+
|
195
|
+
e.printStackTrace();
|
196
|
+
|
197
|
+
return null;
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
return postlist;
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
```
|