spring-boot 相关问题

Spring Boot可以轻松创建Spring驱动的生产级应用程序和服务,并且可以轻松实现。它采用了Spring平台的观点,以便新用户和现有用户可以快速获得他们需要的位。



我有这个春季启动项目结构:

在root/settings.gradle:

回答 1 投票 0



SpringbootThymeleaf-<expression>期望,得到'@

我有这个代码: <li class="page-item" th:classappend="${currentPage == 0} ? 'disabled' : ''"> <a class="page-link" th:href="${currentPage == 0} ? '#' : @{/transits/page/{pageNum}(pageNum=${currentPage - 1})}" aria-label="Previous"> <span aria-hidden="true">&laquo;</span> </a> </li> 但是我有一个错误: 您可以在url语法的最底部所示,以两个步骤进行操作:https://www.thymeleaf.org/doc/doc/articles/standardurlsictax.html 相关的例子是 <div th:with="baseUrl=(${user.admin}? '/admin/home' : ${user.homeUrl})"> ... <a th:href="@{${baseUrl}(id=${order.id})}">...</a> ... </div> 相似,您可以使用 <div th:with="baseUrl=(${currentPage == 0} ? '#' : '/transits/page/{pageNum}')"> ... <a th:href="@{${baseUrl}(pageNum=${currentPage - 1})}">...</a> ... </div>

回答 1 投票 0


这是脚本:

这是脚本: </desc><code>&lt;script type=&#34;application/ld+json&#34;&gt; { &#34;@context&#34;: &#34;https://schema.org&#34;, &#34;@type&#34;: &#34;FAQPage&#34;, &#34;mainEntity&#34;: [{ &#34;@type&#34;: &#34;Question&#34;, &#34;name&#34;: &#34;[(${faq.question1})]&#34;, &#34;acceptedAnswer&#34;: { &#34;@type&#34;: &#34;Answer&#34;, &#34;text&#34;: &#34;[(${faq.answer1})]&#34; } }] } &lt;/script&gt; </code><question vote="3"> <p>和属性文件</p>Messages.properties<pre>:</pre> <p><code>faq.question1=What is Mystic Planets? faq.answer1=Mystic Planets is an astrology app that helps users understand their birth chart and align with their purpose. </code><strong> </strong>但页面不加载:</p> <pre></pre><p></p><p> <a href="https://i.sstatic.net/JvGdb42C.png" rel="nofollow noreferrer">当我尝试过的时候:<img src="https://cdn.txt58.com/i/AWkuc3N0YXRpYy5uZXQvSnZHZGI0MkMucG5n" alt="enter image description here"/> </a><code>&lt;script type=&#34;application/ld+json&#34;&gt; { &#34;@context&#34;: &#34;https://schema.org&#34;, &#34;@type&#34;: &#34;FAQPage&#34;, &#34;mainEntity&#34;: [{ &#34;@type&#34;: &#34;Question&#34;, &#34;name&#34;: &#34;&lt;th:block th:text=&#34;${faq.question1}&#34;&gt;&lt;/th:block&gt;&#34;, &#34;acceptedAnswer&#34;: { &#34;@type&#34;: &#34;Answer&#34;, &#34;text&#34;: &#34;&lt;th:block th:text=&#34;${faq.answer1}&#34;&gt;&lt;/th:block&gt;&#34; } }] } &lt;/script&gt; </code></p> <p>然后我得到了这个错误:</p> <pre><code>2025-02-28 20:20:45.040 [http-nio-8080-exec-1] ERROR [] o.a.c.c.C.[.[.[.[dispatcherServlet]@log(175) - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: &#34;faq.question1&#34; (template: &#34;index-new&#34; - line 404, col 32)] with root cause org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field &#39;question1&#39; cannot be found on null at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:225) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:112) at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorValueRef.getValue(PropertyOrFieldReference.java:376) at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:97) at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:116) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:338) at org.thymeleaf.spring6.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:265) at org.thymeleaf.standard.expression.VariableExpression.executeVariableExpression(VariableExpression.java:166) at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:66) at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109) </code></pre> <p> </p> <pre>使用</pre><code>#{key.name}</code></question>从<answer tick="true" vote="1"><code>messages.properties</code><p>。 <pre>在您的情况下,它看起来像:</pre> <pre><code>&#34;name&#34;: &#34;&lt;th:block th:text=#{faq.question1}&gt;&lt;/th:block&gt;&#34;, </code></pre> </p>or<p> </p><code>&#34;name&#34;: &#34;[(&lt;th:block th:text=#{faq.question1}&gt;&lt;/th:block&gt;)]&#34;, </code><pre> </pre> <p> try以更新脚本以使用:插入动态内容的文本或th:utext:</p> <pre><code>&lt;script type=&#34;application/ld+json&#34;&gt; { &#34;@context&#34;: &#34;https://schema.org&#34;, &#34;@type&#34;: &#34;FAQPage&#34;, &#34;mainEntity&#34;: [{ &#34;@type&#34;: &#34;Question&#34;, &#34;name&#34;: &#34;&lt;th:block th:text=&#34;${faq.question1}&#34;&gt;&lt;/th:block&gt;&#34;, &#34;acceptedAnswer&#34;: { &#34;@type&#34;: &#34;Answer&#34;, &#34;text&#34;: &#34;&lt;th:block th:text=&#34;${faq.answer1}&#34;&gt;&lt;/th:block&gt;&#34; } }] } &lt;/script&gt; </code></pre> </answer> <answer tick="false" vote="0"><p>

回答 0 投票 0

回答 0 投票 0

如何将@serviceconnection与redis testContainers一起用于春季会话?

@Configuration @EnableRedisHttpSession public class SessionConfig extends AbstractHttpSessionApplicationInitializer { @Bean LettuceConnectionFactory redisConnectionFactory() { return new LettuceConnectionFactory(); } ...

回答 0 投票 0




为什么vs代码认为无法解决这个春季框架导入?

我正在尝试运行一个显然适合他人的Java/Maven项目,但是VS代码不会运行这个春季启动项目,因为:

回答 0 投票 0





使用胸腺的html选择对象的对象选择选项到控制器 我想使用百利二夫(Thymeleaf)将对象从SELECT发送到我的控制器。这是模型类 @实体 @Table(名称=“技能”) @builder 公共班技能{ @ID @

@Entity @Table(name = "Skills") @Builder public class Skill { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", nullable = false) private Long id; @Column(name = "title", nullable = false, length = 40) private String title; @Column(name = "category", nullable = false, length = 30) @Enumerated(EnumType.STRING) private Category category; }

回答 1 投票 0

ttl(int minTtl, int maxTtl)

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.