Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring 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:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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

 
Greenhorn
Posts: 14
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: 26733
190
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.
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic