what the hell is model and why controller returns random string?
hey guys. can smb explain what the hell
model
is? bc i tried googling and its just vaguely said that model is your data. yes, i know its from MVC pattern, but it still doesnt make any sense, can smb explain what the f is going on here:
how can importBgwEod
accept model
argument, but its not requeired for the GET request? why this method is returning random string status
? where do i get this needed model
from? thx28 Replies
⌛
This post has been reserved for your question.
Hey @bambyzas! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
but how can importBgwEod accept model argument, but its not requeired for the GET request?
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
what
thats not what i asked
i asked about one thing, and u r talking about smth other than that
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
what are you talking about
sorry but i honestly dont understand ur point and what u mean
do you have any option to call the "/importBgwEod"?
how can importBgwEod accept model argument, but its not requeired for the GET request?
The request arrives the spring framework in the first place. Then spring notice that the getmapped method requires a argument of type "Model" (most likely org.springframework.ui.Model). Spring now have a special logic for that. Spring creates a new, plain instance of Model. Spring put arguments from the session and from the request into that model and with that instance, the method importBgwEod
is called. Now, the return-string is indicating what template should be filled and sent back to the browser.So the model is not an object that we can access a row of a table row?
and you access it like this
At this moment only the OP knows what full-qualified-name the class Model has. It must be a type having the method "addAttribute". I am certain that the full-qualified-classname is
org.springframework.ui.Model
. Because:
1. The classname is the same
2. The method exists
3. The parameters match.finally someone explained it to me. thanks alot!. so basically since im using MVC pattern, sprint automagically takes care of model?
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
yeah, with postman
So what is your Model's fully qualified name?
I am just curious to know
you can even pass an Entity like this
no idea. idk how/where to look
on the top imports find the line what Model
somewhere here
good shit, now you can see search for it for futher details
Heh, I knew it 😄
so what do they mean by a place holder?
hmm it's like a dynamic object hah
Yea, placeholder is misleading. It is an dynamic-outgoing-value-wrapper to be used as an method-argument.
Usually method arguments should consume data into the method. But this dynamic-object is primarily used for returning values. Usually a returning value is used with the
return
command of the method-result-type.
Borgrel was absolutly correct that this is a not well written code
! Since we have two result-values in that code (the attribute "status" and the template-view-name "status"), you better use the Return-Type return new ModelAndView(...);
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.