我有一个基本的SpringBoot 2.0.5.RELEASE应用程序。使用Spring Initializer,JPA,嵌入式Tomcat,Thymeleaf模板引擎并将其打包为可执行JAR文件。我有这个模板,我想根据条件禁用选择对象
<form id="menuFormId" class="form-style-9" action="#" th:action="@{/menu/save}" th:object="${menu}" method="post">
<ul>
<li th:each="e : ${#fields.detailedErrors()}" th:class="${e.global}? globalerr : fielderr">
<span th:text="${e.global}? '*' : ${e.fieldName}" ><b>The field name</b></span> : <span th:text="${e.message}" class="red">
<font color="red">The error message</font>
</span>
</li>
</ul>
<ul class="tab_form">
<li>
<select id="selectMenuId" th:field="*{resto}" th:classappend="${menu.id == null} ? disabled='disabled'">
<option value="0">PLEASE SELECT A MENU</option>
</select>
...
但是我得到了这个错误:
Could not parse as expression: "${menu.id == null} ? disabled='disabled'"
答案 0 :(得分:1)
嗯,有两个问题:
1。)禁用是属性而不是类。因此,请使用以下代码段:
Traceback (most recent call last):
File "test_td.py", line 103, in <module>
upload_file_to_td_folder(folder_id, file, FILE_MIME)
File "test_td.py", line 46, in upload_file_to_td_folder
supportsTeamDrives=True, fields='id').execute().get('id')
File "/home/bo/anaconda3/lib/python3.6/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/bo/anaconda3/lib/python3.6/site-packages/googleapiclient/http.py", line 840, in execute
raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError:
<HttpError 400 when requesting https://www.googleapis.com/upload/drive/v3/files?supportsTeamDrives=true&fields=id&alt=json&uploadType=multipart
returned "Bad Request">
2。)您不能定义一个类disable ='disabled'。
第二个问题并不重要。不需要这样的类定义。