Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Is it possible to get information from string literal, pass it to Thymeleaf and add th:href ?

 
Greenhorn
Posts: 12
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have this button which is dynamically created along with some hotel information. After clicking on the button I want the user to be redirected to the booking form page.



I have th:inline in the script tag and I have tried with /*<![CDATA[*/ right after the script tag and /*]]>*/ just before the closing script  tag and this
/*[[th:href="@{/hotels/{id}/booking-form(id=@{hotel.id}"]]*/
 
Saloon Keeper
Posts: 24866
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No matter what UI platform you use, complex EL is more trouble than it is worth. If at all possible, you should construct the URL in the UI Model bean, not on the web page template or in JavaScript. That way the template can be much simpler (for example 'href="#{hotel.bookingURL}"' and if you do have problems, you can set a breakpoing on the "getBookingURL method in Java to more easily determine what went wrong and why.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic