java
  • spring-boot
  • thymeleaf
  • 2017-07-12 3 views 0 likes 
    0

    thymeleafのhrefリンクにタスクIDを渡してリストの項目を削除しようとしています。これは、thymeleafの文字列にパラメータを渡すには

    <a th:href="@{'delete-task?id='${task.id}}"> 
    

    のように見えるしかし、その代わりにアイテムを削除するので、これは出力が何であるかである

    delete-task?id=th:text=%27${task.id}%27 
    

    イム

    : Error parsing HTTP request header 
    Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. 
    
    java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 
    Can anyone tell me the correct syntax 
    

    答えて

    0

    は、私はあなたのhrefがすべきと考えているたるみトレースでこのエラーを取得そのように見える:

    <a th:href="@{'delete-task?id=' + ${task.id}}"></a> 
    
    +0

    Workedありがとう! – nabeelaa

    +0

    別のタイメレフの問題を手伝ってもらえますか? https://stackoverflow.com/questions/45064706/spring-boot-thymeleaf-form-error – nabeelaa

    1

    リンクにthymeleafのStandard URL Syntaxを使用する必要があります。パラメータを正しくエスケープできるようにしてください。リンクは次のようになります。

    <a th:href="@{delete-task(id=${task.id})}"> 
    
    関連する問題