Detailed Notes
We are continuing a series of tutorials focused on Spring Boot. The crux of the project is to convert/migrate an old JSP/Tomcat application to a modern Spring Boot application and Java 7/8 to a current version. We are working on a complex form for entering data. We continue form entry and log at what to do once we save our data.
You can learn more through our online classes at https://school.develpreneur.com and register for free. Registration will add you to our email list, and you will periodically receive coupons for courses and notifications of the latest releases.
Transcript Text
[Music] well hello and welcome back we are continuing just doing our application conversion moving from an old Apache tom cat into a spiffy new spring boot uh bootstrap five time Leaf all that good stuff last episode we're working our way through a form getting that data across entering it saving it doing updates all that kind of good stuff well we ended up hitting a little bit of a snag and it really had to do with dealing with uh generating some of the the calculations on the Fly probably not something you do too often and it does turn out to be a bit of a pain to make sure that you get all of your uh types correct so we're going to do instead of what we were you know trying to do it all on the Fly we're going to all pull this stuff out and we're going to pull this into our U Back out so it's just going to be sent as values into our form so here we have project cost is already there but we're going to take this thing and that's basically going to become our earnings and so if we go back here we're going to have an earnings and we're going to have an agent cost so if we go back to our controller uh we'll just put that there for now and we're going to create a couple of objects and it's going to be this is going to be our we'll call it our agent cost and our earnings and we don't have those already so we can pull those what we're going to do is simply enough is we're going to come in here and this guy is going to become earnings and we can take a look back here make sure that we get that that generated properly so earnings is going to be this now here we've got let's see project cost do we already have project cost here we have that somewhere oh here we go project cost so here we actually are going to have to go ahead and let's do it this way we're going to do uh we'll create a we'll just create a project cost and I think that's going to be a double and we'll start at equal z0 and so here instead of doing this add object in all these places we don't need to worry about it here because project cost is going to be Zero by default so we're going come back here we do project cost whoops don't need that else and it's going to be uh we get with the capital c wh I need to spell it right and let's do it this way make sure we get it copied and pasted right whoa not sure what I just did uh let's do this do that okay so then we're going to need here this just means project cost equals that and here new project cost equals that whole thing oh and there's where our problem is is at our cost we were actually adding all of those things together so actually this alone might fix our problems uh let's go check that real quick uh let's see project. agent percent I think we had project set up here yep we have project so we could do it like that oh except for it's going to have to be get agent percent uh I believe it's like that project get agent percent yep so let's try that because now we've got the earnings there but we have not pulled across yet our uh agent cost so let's see if we still have this blow up which goes back to this is this is why we got to make sure we oh I have an error somewhere so let's go back it's probably in the hello oh did I yes I did was going to say probably had something I didn't get things oh project cost already exists where did it oh here it is Calculate cost okay oh interesting so I already did project cost equals Calculate cost oh this may be something where we did something stupid so let's go uh back to what we had so project cost oh so it is two different okay so we're going to change that and we're going to make this let's see this is Calculate cost this one's going to be uh oh we need to make it so we'll just do it uh this will be total cost and we'll just make that total cost everywhere else here so he's going to be equal to that he's going to be equal to that and we're going to shove him here and oh this is going to be project okay let's see how this runs I think that was what ended up happening is we had one of our values not work we were creating a string when we shouldn't have been so if we come in here and we go look boom now we finally got it coming across our earnings and our agent cost are coming here uh bit amount uh earnings is based off of what that's probably based off of oh because it's t based off of our calc Calculate cost which is I bet based off of tasks so if we go oh we probably have a nice little complicated thing here project Dao Calculate cost uh and so there's hours estimated and hours adjusted so we would have to actually get it and that's from tasks so we would have to within here we have no task so uh see looks like we've got most of our stuff coming up our ear earnings on our agent cost is a little bit wonky so let's go look at that on our form real quick do a quick fix there uh let's see oh it's because he's an md2 let's see how do we want to change that around um let's go ahead and not sure why we put those together the way we did we could do one more was that 2 4 6 8 10 12 so we probably would need to tweak that a little bit let's do status and stack that up on site instead and take the that one is that going to work uh yeah I think that whole thing and and then that's going to go here and we're going to take our status we're going to push that up by our site let's just see how that looks we may want to clean it up a little bit but that probably gives us a good start so now let's go look and let's actually look at one that maybe has something since we've got a value this has a bid let's see yeah so this has tasks and now we can see some earnings and some agent cost got our statuses stacked up and uh everything is coming through so we have a form uh we're able to save and we're able to make some adjustments so let's change this to 0 and this will probably change our agent cost so now we're having an issue with the save oh this is trying to go back to home we ran into this before that was where we were at so now let's take a look at our uh redirect cuz what we have been doing is let's see so if we do a redirect uh let's see where was home if we go here here's our home oops that's the wrong one H this is the one we want so we want to fix our redirect so that it when we save a project it actually redirects properly what we end up here is that our save project since it's doing a redirect we don't actually want it to go and create a model in view this is actually going to be just like we did with uh for example here we're just going to return but this time instead of returning oh and that's I can return that this tells us hey we're not going to try to go to that page we're going to try to redirect to a new page so if we do this let's try to save save some data again and get that cleaned up and when we do so we can go back to the bid that we had we're going to see that we had a slightly different cost because we saved it let's go back to the 13.3 that we had and we're still having an issue so let's take a look at what we got here so this one uh let's see it's not telling me anything terribly useful about it oh we know this is not going to work and so let's see then we want to do our home uh let's see oh that's going to be a string but what we need to do here actually is we're going to have to do an H TP response and let's see so we're going to need to do a let's do it like this come back here this is going to be the response then we need to do here response do send redirect and then we can do this I need to spin that right and let's see if that works for Save project so go build that oh doesn't like that oh because we haven't added that yet oh and I'm just going to do this it really doesn't matter what I send oh I need to do that oh let's do it this way so we're going to do a try catch here and what we're going to do is we're going [Music] to uh let's just do return and actually we could probably return either way here if there's an exception there we're going to return to let's go to the oh let's see what's the most simple one we've got let's see if we've got one that has nothing I think we've got a home uh let's see yeah we can just do return home uh probably don't want that but that's and that's what we'll go with for right now because we'll just keep it simple we should never see that but we'll do that just in case And now when we run it let's see if we get where we're supposed to go to I forget what we're supposed to go to probably back to projects so let's just uh we'll just add some more text here just to be safe we'll save it and it did not go where we wanted to so it said it's trying to go home why doesn't it like home oh so we don't want to go back to home we want to go to dashboard dashboard um uh let's see when we save that we actually probably want to go to projects okay so we want to go to so this going to be which is what projects technically we should probably figure out where we came from and go back to where we came from but let's try this see if this works uh pick that log in h let's go back to this guy will change his bid to like 250 and now we're back so now we're getting where we're supposed to be so this has been uh a little bit of a fun little journey here uh but we did need to you know make sure that we've got our redirect going we can't just um you we can't it's not like just returning a like here where it's going to return just a an address uh which is actually what we probably wanted that to be something else anyways um so we have this we now are able to do our redirects we actually probably can do should do this up here so we do our opportunities that we will work okay this should be we're just going to say home although that's not going to work for us uh and then we want to get our response put that up [Music] here there we go that gives us something to work from and we're just going to continue moving along because the next thing we're going to do is we're going to come in here we're going to look at a bid and actually let's go look here because I bet we don't have any of the edits set up so if we go here and click we get nothing even though if we look here yep it's trying to do edit project edit task so it's got funkiness going on there so it looks like that's a broken link this is probably a broken link yep and we probably if we do new task that's a broken link so we got a couple things down here so we've got our top okay um not sure what we're supposed to do here we'll take a look what that is but um we will just continue on next episode if you have any questions you an email out to info@ develop or.com other than that go out there and have yourself a great day a great week and we will talk to you next [Music] time
Transcript Segments
[Music]
well hello and welcome back we are
continuing just doing our application
conversion moving from an old Apache tom
cat into a spiffy new spring boot uh
bootstrap five time Leaf all that good
stuff last episode we're working our way
through a form getting that data across
entering it saving it doing updates all
that kind of good stuff well we ended up
hitting a little bit of a snag and it
really had to do with dealing with uh
generating some of the the calculations
on the Fly probably not something you do
too
often and it does turn out to be a bit
of a pain to make sure that you get all
of your uh types correct so we're going
to do instead of what we were you know
trying to do it all on the Fly we're
going to all pull this stuff out and
we're going to pull this into our U Back
out so it's just going to be sent as
values into our form
so here we have project cost is already
there but we're going to take this
thing
and that's basically going to become our
earnings and so if we go back here we're
going to have an earnings and we're
going to have an agent cost so if we go
back to our
controller uh we'll just put that there
for now and we're going to create a
couple of
objects and it's going to
be this is going to be our we'll call it
our agent
cost and our
earnings
and we don't have those already so we
can pull those what we're going to do is
simply enough is we're going to come in
here and this guy is going to
become
earnings and we can take a look back
here make sure that we get that that
generated properly so earnings is going
to be this now here we've got let's see
project cost do we already have project
cost here we have that somewhere oh here
we go project
cost so here we actually are going to
have to go ahead
and let's do it this way we're going to
do uh we'll create a we'll just create a
project
cost and I think that's going to be a
double and we'll start at equal
z0
and so here instead of doing this add
object in all these
places we don't need to worry about it
here because project cost is going to be
Zero by
default so we're going come back here we
do project cost whoops don't need that
else and it's going to be uh we get with
the capital
c wh I need to spell it
right
and let's do it this way make sure we
get it copied and pasted right whoa not
sure what I just
did uh let's do
this do that okay so then we're going to
need here this just means project cost
equals that and
here
new project cost
equals that whole thing oh and there's
where our problem is is at our cost we
were actually adding all of those things
together
so actually this alone might fix our
problems uh let's go check that real
quick uh let's see project. agent
percent I think we had project set up
here yep we have project so we could do
it like that
oh except for it's going to have to be
get agent
percent uh I believe it's like that
project get agent percent
yep so let's try that because now we've
got the earnings there but we have not
pulled across yet
our uh agent cost so let's see if we
still have this blow
up which goes back to this is this is
why we got to make sure we oh I have an
error somewhere so let's go back it's
probably in the hello oh did I yes I did
was going to say probably had something
I didn't get
things oh project cost already
exists where did it oh here it is
Calculate cost
okay
oh interesting so I already
did project cost equals Calculate cost
oh this may be something where we did
something stupid so let's
go uh back to what we
had so project
cost oh so it is two different okay so
we're going to change
that
and we're going to make this let's see
this is Calculate
cost this one's going to
be uh oh we need to make it so we'll
just do
it uh this will
be total
cost and we'll just make that total cost
everywhere else here
so he's going to be equal to that he's
going to be equal to
that and we're going to shove him
here and oh this is going to
be project
okay let's see how this runs
I think that was what ended up happening
is we had one of our values not work we
were creating a string when we shouldn't
have been so if we come in
here and we go look boom now we finally
got it coming across our earnings and
our agent cost are coming here uh bit
amount uh earnings is based off of what
that's probably based off
of oh because it's t based off of our
calc Calculate cost which is I bet based
off of tasks so if we
go oh we probably have a nice little
complicated thing here project Dao
Calculate
cost uh and so there's hours estimated
and hours adjusted so we would have to
actually get it and that's from tasks so
we would have to within here we have no
task so uh see looks like we've got most
of our stuff coming up our ear earnings
on our agent cost is a little bit wonky
so let's go look at that on our form
real quick do a quick fix
there uh let's see oh it's because he's
an
md2 let's see how do we want to change
that around
um let's go ahead
and not sure why we put those together
the way we
did
we could do one more was that 2 4 6 8 10
12 so we probably would need
to tweak that a little bit let's do
status and stack that up on site
instead and take the that
one is that going to work
uh yeah I think that whole thing and and
then that's going to go here and we're
going to take our
status we're going to push that up by
our
site let's just see how that looks we
may want to clean it up a little bit but
that probably gives us a good
start so now let's go look and let's
actually look at one that maybe has
something since we've got a value this
has a bid let's see yeah so this has
tasks and now we can see some earnings
and some agent cost got our statuses
stacked up and uh everything is coming
through so we have a form uh we're able
to save and we're able to make some
adjustments so let's change this to 0
and this will probably change our agent
cost so now we're having an issue with
the
save oh this is trying to go back to
home we ran into this before that was
where we were at so now let's take a
look at our uh redirect
cuz what we have been doing is let's see
so if we do a
redirect uh let's see where was
home if we go here here's our home oops
that's the wrong
one H this is the one we want so we want
to fix our redirect so that it when we
save a project it actually redirects
properly
what we end up here is that our save
project since it's doing a redirect we
don't actually want it to go and create
a model in
view this is actually going to be just
like we did with uh for example here
we're just going to return but this time
instead of returning oh and that's I can
return
that this tells us hey we're not going
to try to go to that page we're going to
try to redirect to a new page so if we
do this let's try to save save some data
again and get that cleaned
up and when we do
so we can go back to the bid that we had
we're going to see that we had a
slightly different cost because we saved
it let's go back to the 13.3 that we
had and we're still having an issue so
let's take a look at what we got here so
this
one uh let's see it's not telling me
anything terribly useful about
it oh we know this is not going to
work and so let's see then we want to do
our home uh let's see
oh that's going to be a
string but what we need to do here
actually is we're going to have to do an
H
TP
response
and let's
see so we're going to need to
do
a let's do it like
this come back
here this is going to be the
response then we need to
do here
response
do send
redirect and then we can do
this I need to spin that
right and let's see if that works for
Save
project so go build
that oh doesn't like
that oh because we haven't added that
yet oh
and I'm just going to do
this it really doesn't matter what I
send oh I need to do that oh let's do it
this
way so we're going to do a
try
catch
here and what we're going to do is we're
going
[Music]
to uh let's just do
return and actually we could probably
return either way here if there's an
exception there we're going to
return
to let's go to
the oh let's see what's the most simple
one we've got let's see if we've got one
that has nothing I think we've got a
home uh let's see yeah we can just do
return
home uh probably don't want that but
that's and that's what we'll go with for
right now because we'll just keep it
simple we should never see that but
we'll do that just in
case And now when we run
it let's see if we get where we're
supposed to go
to I forget what we're supposed to go to
probably back to projects so let's just
uh we'll just
add some more text here just to be safe
we'll save it and it did not go where we
wanted to so it said it's trying to go
home why doesn't it like
home oh so we don't want to go back to
home we want to go to
dashboard
dashboard
um uh let's see when we save that we
actually probably want to go to projects
okay so we want to go
to so this going to be which is
what
projects technically we should probably
figure out where we came from and go
back to where we came from but let's try
this see if this
works
uh pick
that log in h let's go back to this guy
will change his bid to like
250 and now we're back so now we're
getting where we're supposed to be so
this has been uh a little bit of a fun
little journey here uh but we did need
to you know make sure that we've got our
redirect going we can't just um you we
can't it's not like just returning a
like here where it's going to return
just a an address uh which is actually
what we probably wanted that to be
something else anyways
um so we have this we now are able to do
our redirects we actually probably can
do should do
this up
here so we do our
opportunities that we
will work okay this should be we're just
going to say home although that's not
going to work for
us uh and then we want to get our
response
put that up
[Music]
here there we go that gives us something
to work from and we're just going to
continue moving along because the next
thing we're going to do is we're going
to come in here we're going to look at a
bid and actually let's go look here
because I bet we don't have any of the
edits set up so if we go here and click
we get nothing even though if we look
here yep it's trying to do edit
project edit task so it's got funkiness
going on there so it looks like that's a
broken link this is probably a broken
link yep and we probably if we do new
task that's a broken link so we got a
couple things down here so we've got our
top okay um not sure what we're supposed
to do here we'll take a look what that
is but um we will just continue on next
episode if you have any questions you an
email out to info@ develop or.com other
than that go out there and have yourself
a great day a great week and we will
talk to you
next
[Music]
time