• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Springboot Thymeleaf form submission showing NULL and blank values!! NOT showing entered values!

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Controller-> Design





when submitting design  form on localhost:

Form logs:

ingredients
name
{design=com.example.demo.DomainTacoDesign@3ee4d959, org.springframework.validation.BindingResult.design=org.springframework.validation.BeanPropertyBindingResult: 0 errors, name=null}
{design=com.example.demo.DomainTacoDesign@3ee4d959, org.springframework.validation.BindingResult.design=org.springframework.validation.BeanPropertyBindingResult: 0 errors, name=null, class=class com.example.demo.DomainTacoDesign}
2024-07-11T18:35:28.162-04:00  INFO 25076 --- [nio-8090-exec-9] com.example.demo.ControllerDesignTaco    : Processing design-> ingredient: com.example.demo.DomainTacoDesign@3ee4d959
2024-07-11T18:35:28.162-04:00  INFO 25076 --- [nio-8090-exec-9] com.example.demo.ControllerDesignTaco    : Processing design-> ingredient.name: null
{order=com.example.demo.DomainTacoOrder@2315f02}
key=order,value=com.example.demo.DomainTacoOrder@2315f02


designForm view Thymeleaf:

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<form method="POST" th:object="${design}">

Where are you sending the request to? Unless I am missing something you are merely attributing a POST method which will attempt to post the form on submit, but even if you are attempting to bind to the "design" model, you have no action attribute.
 
Saloon Keeper
Posts: 28806
212
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note: code tags aren't just for code! They can also intelligently display/highlight XML, SQL, and many other types of structured text.

I've added code tags to the HTML template. Much easier to read that way.
 
Tim Holloway
Saloon Keeper
Posts: 28806
212
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK. I edited it again because those long lines meant that I had to do a lot of right/left scrolling to read things. That, and the double-spaced lines mean that it's hard to read even on a wide screen like I'm using, though I left the double-spacing alone.

There are times when I long for the old 65-column punched-card, limitations.
 
Tim Holloway
Saloon Keeper
Posts: 28806
212
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's another helpful hint. When using data classes, override the toString method to make it format and display your data values. That makes it simpler to display what's in them. Some IDEs actually have a "wizard" that will generate that code for you.

And let me look at your loop:

Nah. I can't even tell what that's supposed to do. How about:
 
Partha Ray
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly sincere apologies for late response to both Steve M Davies and Tim Holloway. ..So briefly.... in an attempt to understand the logic of MVC pattern utilized in Spring deeply from ground up with added error objects + logs+ added essential annotations i am referring to example from said Spring Action book.. AND there seems to be quite a bit rather than just following the book to understand from ground up + also some of the utilities are outdaded..

Steve M Davies :
Yes added the action attribute to the respective form view fields of the respective Thymeleaf form Design. I have also added HTTP Client Request Server Response Logging via Logbook tool. Still null values:
2024-09-03T10:51:34.878-04:00  INFO 16712 --- [nio-8090-exec-5] com.example.demo.ControllerDesignTaco    : Processing design-> design: com.example.demo.DomainTacoDesign@1f4fa6cf
2024-09-03T10:51:34.878-04:00  INFO 16712 --- [nio-8090-exec-5] com.example.demo.ControllerDesignTaco    : Processing design-> design.name: null
2024-09-03T10:51:34.881-04:00 TRACE 16712 --- [nio-8090-exec-5] org.zalando.logbook.Logbook              : {"origin":"local","type":"response","correlation":"9fcc504f24c4bb84","duration":28,"protocol":"HTTP/1.1","status":302,"headers":{"Location":["http://localhost:8090/orders/current"]}}
2024-09-03T10:51:34.901-04:00 TRACE 16712 --- [nio-8090-exec-6] org.zalando.logbook.Logbook              : {"origin":"remote","type":"request","correlation":"d16495e3687de677","protocol":"HTTP/1.1","remote":"127.0.0.1","method":"GET","uri":"http://localhost:8090/orders/current","host":"localhost","path":"/orders/current","scheme":"http","port":"8090","headers":{"accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"accept-encoding":["gzip, deflate, br"],"accept-language":["en-US,en;q=0.5"],"connection":["keep-alive"],"cookie":["username-localhost-8888=\"2|1:0|10:1725225514|23:username-localhost-8888|44:NTEzM2RlZDg5OTFjNDQ4ZGI1N2I5NTRkNjcwNzcwZmY=|67a14d89d1958ca89eaff312bd98d68bb898ed83e6a60b245bf4bdbdaca64f3c\"; _xsrf=2|1dcfd872|062cfe000619da61174c32d757eb076d|1725225514; JSESSIONID=DFBC5D013DFC886CA382E94A2F153F4F"],"host":["localhost:8090"],"referer":["http://localhost:8090/design"],"sec-fetch-dest":["document"],"sec-fetch-mode":["navigate"],"sec-fetch-site":["same-origin"],"sec-fetch-user":["?1"],"upgrade-insecure-requests":["1"],"user-agent":["Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"]}}

Tim Holloway:
Yes apologies the verbose object variable identifiers just for deep dive introspection purposes and also the excessive logging via tools and system.out. yes perhaps Map object for HTTP servlet Request with the getParameterMap method....and yes still null values when form submission as mentioned to Steve M Davies. Thanks for all your guys help.!
 

 
My pie came with a little toothpic holding up this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic