質問編集履歴
4
修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
thymeleaf
|
1
|
+
thymeleaf 複数条件
|
test
CHANGED
File without changes
|
3
修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
thymeleaf の実装
|
test
CHANGED
File without changes
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -23,3 +23,7 @@
|
|
23
23
|
|
24
24
|
|
25
25
|
条件式が一致した場合、Aと表示をして、かつ非活性にしたい場合、この文で大丈夫か教えて頂きたいです。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
例 もし受けた値が”tokyo”の場合、日付きを表示させ、かつ非活性にする
|
1
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,101 +1,25 @@
|
|
1
|
-
```html
|
1
|
+
```html
|
2
|
-
|
3
|
-
<!doctype html>
|
4
|
-
|
5
|
-
<html>
|
6
|
-
|
7
|
-
<head></head>
|
8
|
-
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<table border="1";>
|
12
|
-
|
13
|
-
<tr>
|
14
|
-
|
15
|
-
<th id="text">東京</th>
|
16
|
-
|
17
|
-
<td><span th:text="${city.tokyo}"></span></td>
|
18
|
-
|
19
|
-
</tr>
|
20
|
-
|
21
|
-
</table>
|
22
|
-
|
23
|
-
</body></html>
|
24
|
-
|
25
|
-
```
|
26
|
-
|
27
|
-
```jquery
|
28
|
-
|
29
|
-
$(function(){
|
30
|
-
|
31
|
-
var obj='fukuoka';
|
32
|
-
|
33
|
-
if(obj=='fukuoka'){
|
34
|
-
|
35
|
-
$("#text").hide();
|
36
2
|
|
37
3
|
|
38
4
|
|
39
|
-
}
|
5
|
+
<td th:disabled="${---条件式---}? 'A': 'B'"/>
|
40
6
|
|
41
|
-
});
|
42
7
|
|
43
|
-
```
|
44
|
-
|
45
|
-
```Java
|
46
|
-
|
47
|
-
package com.example.demo;
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
import java.util.ArrayList;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
import org.springframework.beans.factory.annotation.Autowired;
|
56
|
-
|
57
|
-
import org.springframework.stereotype.Controller;
|
58
|
-
|
59
|
-
import org.springframework.ui.Model;
|
60
|
-
|
61
|
-
import org.springframework.web.bind.annotation.RequestMapping;
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
@Controller public class Test {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
@RequestMapping(value="text")
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
public String User( Model model ) {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
ArrayList<CityList> CityList = new ArrayList<CityList>();
|
78
|
-
|
79
|
-
String text='fukuoka';
|
80
|
-
|
81
|
-
model.addAttribute("CityList", CityList);
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
return "country.html";
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
} }
|
90
|
-
|
91
|
-
|
92
8
|
|
93
9
|
```
|
94
10
|
|
95
11
|
|
96
12
|
|
97
|
-
thymeleafで
|
13
|
+
thymeleafからできました。ありがとうございます。
|
98
14
|
|
99
|
-
|
15
|
+
今複数条件を埋め込みたいのです。条件式が一致した場合、Aと表示をして、かつ非活性にしたいです。
|
100
16
|
|
17
|
+
|
18
|
+
|
19
|
+
<td th:text="${---条件式---}? 'A' : 'B'"/>ではなく
|
20
|
+
|
21
|
+
<td th:disabled="${---条件式---}? 'A' : 'B'"/>に変えました。
|
22
|
+
|
23
|
+
|
24
|
+
|
101
|
-
|
25
|
+
条件式が一致した場合、Aと表示をして、かつ非活性にしたい場合、この文で大丈夫か教えて頂きたいです。
|