📺 Develpreneur YouTube Episode

Video + transcript

Spring Boot Application - Links and Events

2023-12-26 •Youtube

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. In this episode, we work in Thymeleaf and Spring Boot to build some links and pass parameters

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 our conversion of our older
Tom Cat Apache Apache Tom Cat JSP
application to a new fangle nice bright
and shiny spring boot with time leaf
with
bootstrap and converting that over it
hasn't been too hard and now I just want
to sort of this episode and as probably
go through a couple we'll start
converting some of these pages that are
a little more complicated um a little
more involved basically so for now we've
usually done some very you know some
simple things where it's like you know
hey you generate a little section like
up in here you've got something that you
know got a little looping thing that's
going through some stuff and then you've
got some you know another basically Loop
so a lot of this is very straightforward
we haven't gone very nuts like you can
see here if I go oh I do have a nav bar
I didn't realize I had my nav bar um but
we'll play around with that do some
styling a little later on again working
within the the bootstrap world I want to
do right now is we're going to go to uh
we have these projects what we want to
be able to do is click on one and edit
it now right here we do have that set up
in this one um we can go in and it's
going to try to edit so let's actually
go from here and first let's hook this
thing up so we've got like here's an
example we we must we pulled this over
and we didn't really finish it out so
let's go look at this project list and
let's get it set up so that we can edit
now actually to make it simple if we
look here if we go look at what was
generated is what we need is a pro edit
project and then the number so if we
come back to our project list that
means and let's see let's do two things
one from our hello
controller if we go look for list
projects which I believe is this one yep
we have a user ID we didn't not have a
user so we're going to add a
user and we're just going to call them
user
lowercase we're going to send that user
in and we'll just keep it simple so
we'll send that one directly into list
projects because then what we're going
to do is the same thing that we did for
the user
dashboard is we're just going to come in
here and we're just going to say you
know basically where it says here
welcome we're going to do that here but
we're going to wrap that that if you see
here it is going to always display this
text no matter what so if for example we
don't have information it's just going
to say dashboard for dashboard for blank
and then there's actually another space
or two in there but you know user won't
see that instead what we want to do is
we're going to do this just like the uh
project form where I have started
that and here we go so here here we're
going to use one of our time Leaf ifs
and we're going to say if the first name
is not equal to null then we'll display
this otherwise we're not going to bother
so if we go over to our projects
page and we're just going to replace
that that'll be easy enough to do um and
this thing's got a whole mess of stuff
so we're going to clean this page up
even before we get to the edit uh so
here is where it does the
welcome uh it does oh and then it's got
this maintain overhead and maintain
difficulty ulty both of which are not
mapped but we're going to leave those
for now um so let's see let's do this
first
whoop uh first I want to come
through and we're going to basically
simplify this thing out so we don't need
to worry about this we don't need to
worry about the welcome we do want to
keep
however the maintain
overhead
and uh we're just going to make him I
think I don't even know if it uses
button small but okay so we're going to
use that and we're going to keep this
one which is the maintain difficulty and
we'll tackle these later as far as
actually putting these together but
here's one of the problem is we don't
need and we'll fix this what we're going
to do is we're going to go look at can
we get the context path uh we should be
able to do it just like this
wh but we will come back to that
shortly so
now let's see where we at we're in this
row we've got if we've got a username
we're going to display it and regardless
after that so we may get nothing here
but we will get our two little buttons
so let's do that for now let's make sure
we got everything wh we don't need that
CF this is all
in this class row so we should be
good see is there anything else we want
to
do yeah so we're going to have to do
this change there's probably some stuff
up here that we wanted to get rid of
yeah so we've got this
like so the form action is going to
be log
out we don't need that URL
uh let's see we're probably going to
need that information and then we want
to do edit project zero so let's put
that in
there so note a lot of what we're doing
is it's just because of you some of the
ways things were generated before but
then we've got all these little
variables and so we have to make sure
that we are you know essentially
cleaning those things up uh let's see so
here I
think we are pretty darn
close other than we have this context
path and so that could be you know could
be something we want to deal with uh
let's see and I think what we want to do
is let's just say here this is going to
be uh sledit
project no I think it's
called projects yes
projects and it may be that
simple uh may not be we're going to find
out soon enough so if we come in here uh
let's see we did that all
right so if we go run
this Oh shoot what I want to do is I
want to be able to do a uh
onclick which we do not have because I
basically want to do here is say if I
click it then I get to El edit it and so
I'm going to go to each row here
and I'm going to have to have for each
one I am going to have to do
a I think I do
a uh what do we want to do this is a on
click let's do on
click wh what did I do there here let's
get rid of this let's I don't want to
break my
class
I may be able to just do on click
equals and do I have an edit project
already up
here I do I have a select
project so I should be able to just from
here do select project and give it what
am I giving it an ID and a root I don't
know why it has a root at
all uh it doesn't use that so there's no
need filter projects actually doesn't
use that either which is interesting
enough so let's see filter
projects so I don't need
that uh let's see
select does
need the ID which is going to be the
uh I think we need to do it th on click
select
[Music]
project we're going to do it like this
so it's going to be
um here and we'll just do a
straight text sort of like we did up
here and and is that how I want to do it
let's
see oh I can do it so it's going to be
with that so I don't need
this I do it like
that and he is going to be a
dollar
right so I do want my dollar yep and
he's just going to be the ID so I think
it's going to be just project.
ID if I can spell it right and if I can
put it inside this that will help
project ID did I get it oh I need to
close that so now if we run
it let's see what we get here so it's
going to make us log
in and if we go to
projects now H we broke something
somewhere oh but it is giving us our
edit so we are getting our edit project
but what we do need to figure out is
what did we
break create website and web flow okay
so we probably have something
here that
is not closing things right so let's try
to go inspect and see if we can see
what's going on so if we go in here this
is going to be sort of tough to see but
we're going to come down into our
container and we come down
to this part of our container and and we
are going to go into our responsive
table and we're going to take one of
these and we're going to
see that we've got our class set
up we've got our select
project he's a
div but he's with outside of a row which
is
interesting so we want him
uh class equals
[Music]
row oh so he's not an actual table row
so here's our div let's go look at that
again and within
him he's got div div div div div and
then he closes
up
and these are each a small two which
that should
[Music]
be
[Music]
and see what are we missing here we've
got something a little funky so if we go
in here and this is where we start
running to fun stuff so if we grab
that and he says on click that class
equal oh I think it's that class equals
so it needs to be th class that's where
we missed
it I think that's where we have an
issue which is probably a good sign
since I see that that's like hey that is
not coming up right so now if we come in
let me get rid of
this we log
in and now we click there we go so now
note we got everything falling out here
now we can select a row we'll clean this
up later the selector thingy and now we
can come in and we can actually edit a
project and it's giving us an ID so now
let's take a look at
this this page is obviously just barely
getting started so let's take a look at
our project
form
here and we will dive into that that
will actually be our next episode I
don't want to go too long in this one so
for this one what we did is we did clean
up a little page uh we went in we took a
look at uh selecting a row we looked at
basically converting a couple of objects
over from oops this is the wrong one uh
looking at yep and that's correct at
converting objects
over and making sure that we get some
stuff you know built out oh we've got
some uh couple of layout issues that
we're going to want to deal with here uh
in order to make that not the uh the ug
LLY thing that it is so we'll clean a
couple of these things up so our buttons
aren't going all the way across next
time and we will work on actually
filtering a list we'll go ahead and add
that one in uh next time as well so
we'll start with filtering a list and uh
we'll go from there get our project form
going and just continue walking through
this conversion process getting you like
we are just walking through all of the
little changes that need to be done if
you had a if you've got an older
application but of course these are also
things you have to put in place if you
have a new application as well if you
have any questions send us an email at
info@ developer.com and go out there and
have yourself a great day a great week
and we will talk to you next time hello
this is Rob with develop or also known
as building better developers wanted to
announce that we have school.
developer.com feel free to check it out
if you like any of this information any
of the content that we've sent and you
would like to see more you can come out
you can enroll for free we have free
courses we've got places for you to get
better at just learning a technology or
how toose you can work on your business
skills we can help you with becoming a
better developer as in coding and things
like that a lot of the stuff you've seen
on YouTube we also have out at school.
develop andure we just have it in a
little more of a uh educational format
and a way for you to track your progress
as you move forward becoming a better
developer
[Music]
Transcript Segments
1.35

[Music]

27.24

well hello and welcome back we are

29.359

continuing our conversion of our older

32.8

Tom Cat Apache Apache Tom Cat JSP

36.64

application to a new fangle nice bright

39.96

and shiny spring boot with time leaf

43.079

with

44.239

bootstrap and converting that over it

47.16

hasn't been too hard and now I just want

50.52

to sort of this episode and as probably

52.76

go through a couple we'll start

54.199

converting some of these pages that are

55.6

a little more complicated um a little

58.68

more involved basically so for now we've

60.84

usually done some very you know some

62.32

simple things where it's like you know

63.8

hey you generate a little section like

65.28

up in here you've got something that you

68.32

know got a little looping thing that's

69.68

going through some stuff and then you've

71.96

got some you know another basically Loop

74.439

so a lot of this is very straightforward

76.72

we haven't gone very nuts like you can

78.32

see here if I go oh I do have a nav bar

81.36

I didn't realize I had my nav bar um but

84.28

we'll play around with that do some

85.479

styling a little later on again working

88.04

within the the bootstrap world I want to

90.52

do right now is we're going to go to uh

94.119

we have these projects what we want to

95.56

be able to do is click on one and edit

97.92

it now right here we do have that set up

101.96

in this one um we can go in and it's

105.119

going to try to edit so let's actually

107.56

go from here and first let's hook this

110.36

thing up so we've got like here's an

112.36

example we we must we pulled this over

114.52

and we didn't really finish it out so

117.439

let's go look at this project list and

120.28

let's get it set up so that we can edit

123.479

now actually to make it simple if we

126.36

look here if we go look at what was

128.44

generated is what we need is a pro edit

130.879

project and then the number so if we

133.4

come back to our project list that

136.92

means and let's see let's do two things

140.08

one from our hello

142.08

controller if we go look for list

144.959

projects which I believe is this one yep

147.68

we have a user ID we didn't not have a

151.76

user so we're going to add a

154.28

user and we're just going to call them

156.319

user

157.239

lowercase we're going to send that user

161.599

in and we'll just keep it simple so

163.68

we'll send that one directly into list

165.8

projects because then what we're going

166.76

to do is the same thing that we did for

169.599

the user

170.68

dashboard is we're just going to come in

172.64

here and we're just going to say you

174.72

know basically where it says here

176.64

welcome we're going to do that here but

178.84

we're going to wrap that that if you see

181.4

here it is going to always display this

184.64

text no matter what so if for example we

187.4

don't have information it's just going

189.48

to say dashboard for dashboard for blank

192.36

and then there's actually another space

193.799

or two in there but you know user won't

195.959

see that instead what we want to do is

200.44

we're going to do this just like the uh

203

project form where I have started

206.72

that and here we go so here here we're

210.28

going to use one of our time Leaf ifs

212.12

and we're going to say if the first name

214.28

is not equal to null then we'll display

216.4

this otherwise we're not going to bother

219.04

so if we go over to our projects

221.92

page and we're just going to replace

224.08

that that'll be easy enough to do um and

226.64

this thing's got a whole mess of stuff

227.92

so we're going to clean this page up

229.12

even before we get to the edit uh so

232.04

here is where it does the

234.599

welcome uh it does oh and then it's got

237.799

this maintain overhead and maintain

239.519

difficulty ulty both of which are not

242.04

mapped but we're going to leave those

243.799

for now um so let's see let's do this

245.72

first

247.079

whoop uh first I want to come

250.2

through and we're going to basically

253.079

simplify this thing out so we don't need

256.199

to worry about this we don't need to

258.68

worry about the welcome we do want to

261.6

keep

265.68

however the maintain

268.6

overhead

273.12

and uh we're just going to make him I

276.479

think I don't even know if it uses

277.639

button small but okay so we're going to

279.12

use that and we're going to keep this

281.6

one which is the maintain difficulty and

284.68

we'll tackle these later as far as

287.039

actually putting these together but

288.96

here's one of the problem is we don't

291.639

need and we'll fix this what we're going

294.08

to do is we're going to go look at can

295.8

we get the context path uh we should be

298.32

able to do it just like this

304.759

wh but we will come back to that

308.6

shortly so

311.039

now let's see where we at we're in this

313.36

row we've got if we've got a username

315.8

we're going to display it and regardless

318.44

after that so we may get nothing here

320.88

but we will get our two little buttons

323.28

so let's do that for now let's make sure

325.479

we got everything wh we don't need that

328.479

CF this is all

331.52

in this class row so we should be

336.6

good see is there anything else we want

338.72

to

342.84

do yeah so we're going to have to do

344.84

this change there's probably some stuff

346.919

up here that we wanted to get rid of

348.639

yeah so we've got this

350.039

like so the form action is going to

354.24

be log

356.56

out we don't need that URL

361.759

uh let's see we're probably going to

363.919

need that information and then we want

366.12

to do edit project zero so let's put

368.12

that in

371.039

there so note a lot of what we're doing

373.759

is it's just because of you some of the

376.039

ways things were generated before but

377.44

then we've got all these little

378.36

variables and so we have to make sure

380.8

that we are you know essentially

382.319

cleaning those things up uh let's see so

385

here I

387.12

think we are pretty darn

390.759

close other than we have this context

393.8

path and so that could be you know could

398

be something we want to deal with uh

399.639

let's see and I think what we want to do

400.919

is let's just say here this is going to

402.68

be uh sledit

405.52

project no I think it's

408.96

called projects yes

415.479

projects and it may be that

418

simple uh may not be we're going to find

421.199

out soon enough so if we come in here uh

425.52

let's see we did that all

428.28

right so if we go run

431

this Oh shoot what I want to do is I

433.84

want to be able to do a uh

438.039

onclick which we do not have because I

441.759

basically want to do here is say if I

443.44

click it then I get to El edit it and so

446.639

I'm going to go to each row here

451.039

and I'm going to have to have for each

452.759

one I am going to have to do

456.919

a I think I do

462.12

a uh what do we want to do this is a on

469.159

click let's do on

471.96

click wh what did I do there here let's

475.759

get rid of this let's I don't want to

477.159

break my

478.319

class

481.319

I may be able to just do on click

485.4

equals and do I have an edit project

487.84

already up

489.4

here I do I have a select

493

project so I should be able to just from

495.24

here do select project and give it what

500.24

am I giving it an ID and a root I don't

503.44

know why it has a root at

508.24

all uh it doesn't use that so there's no

511.76

need filter projects actually doesn't

514.599

use that either which is interesting

520.919

enough so let's see filter

524.279

projects so I don't need

529.16

that uh let's see

531.88

select does

534.56

need the ID which is going to be the

543.76

uh I think we need to do it th on click

546.32

select

547.35

[Music]

549.56

project we're going to do it like this

551.399

so it's going to be

556.72

um here and we'll just do a

561.32

straight text sort of like we did up

567.92

here and and is that how I want to do it

570.92

let's

572.2

see oh I can do it so it's going to be

574.36

with that so I don't need

576.48

this I do it like

579.72

that and he is going to be a

584.76

dollar

586.56

right so I do want my dollar yep and

589.64

he's just going to be the ID so I think

591.36

it's going to be just project.

593.68

ID if I can spell it right and if I can

596.16

put it inside this that will help

601.12

project ID did I get it oh I need to

603.079

close that so now if we run

608.44

it let's see what we get here so it's

611.959

going to make us log

613.959

in and if we go to

616.2

projects now H we broke something

618.88

somewhere oh but it is giving us our

621.2

edit so we are getting our edit project

624.839

but what we do need to figure out is

626.76

what did we

628.04

break create website and web flow okay

630.72

so we probably have something

635.8

here that

638.44

is not closing things right so let's try

641.959

to go inspect and see if we can see

644.12

what's going on so if we go in here this

646.6

is going to be sort of tough to see but

648.88

we're going to come down into our

651.839

container and we come down

655.68

to this part of our container and and we

659.279

are going to go into our responsive

661.16

table and we're going to take one of

663.24

these and we're going to

664.72

see that we've got our class set

668.44

up we've got our select

677.16

project he's a

681.76

div but he's with outside of a row which

684.88

is

686.76

interesting so we want him

692.32

uh class equals

693.41

[Music]

696

row oh so he's not an actual table row

699.44

so here's our div let's go look at that

703.68

again and within

708.48

him he's got div div div div div and

712.92

then he closes

717.959

up

719.76

and these are each a small two which

722.88

that should

723.37

[Music]

727.32

be

728.54

[Music]

730.88

and see what are we missing here we've

733.16

got something a little funky so if we go

735.16

in here and this is where we start

736.36

running to fun stuff so if we grab

739.68

that and he says on click that class

744

equal oh I think it's that class equals

746.079

so it needs to be th class that's where

749.36

we missed

750.519

it I think that's where we have an

756.6

issue which is probably a good sign

758.76

since I see that that's like hey that is

760.639

not coming up right so now if we come in

763.24

let me get rid of

764.44

this we log

767.279

in and now we click there we go so now

770.76

note we got everything falling out here

773.24

now we can select a row we'll clean this

775.399

up later the selector thingy and now we

777.48

can come in and we can actually edit a

780.8

project and it's giving us an ID so now

783.44

let's take a look at

785.04

this this page is obviously just barely

788.36

getting started so let's take a look at

790.959

our project

795.68

form

797.639

here and we will dive into that that

801.6

will actually be our next episode I

804.44

don't want to go too long in this one so

806.44

for this one what we did is we did clean

808.88

up a little page uh we went in we took a

812.16

look at uh selecting a row we looked at

816.399

basically converting a couple of objects

818.399

over from oops this is the wrong one uh

821.04

looking at yep and that's correct at

824.079

converting objects

825.68

over and making sure that we get some

828.399

stuff you know built out oh we've got

830.32

some uh couple of layout issues that

833.44

we're going to want to deal with here uh

835.759

in order to make that not the uh the ug

838.759

LLY thing that it is so we'll clean a

840.839

couple of these things up so our buttons

842.079

aren't going all the way across next

844.199

time and we will work on actually

846.8

filtering a list we'll go ahead and add

848.399

that one in uh next time as well so

851.44

we'll start with filtering a list and uh

853.88

we'll go from there get our project form

855.839

going and just continue walking through

857.839

this conversion process getting you like

860.24

we are just walking through all of the

862.24

little changes that need to be done if

864.399

you had a if you've got an older

866.639

application but of course these are also

868.44

things you have to put in place if you

870.079

have a new application as well if you

872.279

have any questions send us an email at

873.8

info@ developer.com and go out there and

876.959

have yourself a great day a great week

879.12

and we will talk to you next time hello

882.6

this is Rob with develop or also known

884.6

as building better developers wanted to

887.24

announce that we have school.

888.72

developer.com feel free to check it out

891.639

if you like any of this information any

894.32

of the content that we've sent and you

895.68

would like to see more you can come out

897.519

you can enroll for free we have free

899.519

courses we've got places for you to get

902.399

better at just learning a technology or

904.759

how toose you can work on your business

906.759

skills we can help you with becoming a

909.279

better developer as in coding and things

911.72

like that a lot of the stuff you've seen

913.36

on YouTube we also have out at school.

916.24

develop andure we just have it in a

917.839

little more of a uh educational format

920.32

and a way for you to track your progress

922.839

as you move forward becoming a better

927.6

developer

933.68

[Music]