Hi everyone! Lurking around for some time and I finally have a need to make a post.
Forgive me I am not very experienced in programming yet.
I have a program I am building that when you click a menu item, goes to a servlet.
The servlet calls a java class that opens a connection to a database, runs a query and loops through every row in the table.
For every row, the data is stored in a bean.
The beans get added to a list.
The list is sent back to the servlet.
Now I wish to send the list of beans to a jsp page for display.
I am inexperienced with Java Beans and do not wish to use jstl to manipulate the list in jsp if I can do so with mere bean tags.
So how do you manipulate a list of beans if I wanted to make an html table row for every bean in my list?
can I only reference a single bean with <jsp:usebean ?
Jesse Snadden wrote:No beef with jstl. What I want to avoid is using a lot of scriplets in the jsp page if possible.
Umm, that is exactly what the JSTL does! Without the JSTL, you need to use scriptlets, which you are correct in avoiding like the plague.
I don't get the jsp:usebean and/or jsp:getProperty tags.
getProperty is outdated. Not needed when using JSTL and EL. useBean has limited use.
Dunno... someone once told me my use of scriplets was gross and that I should be using bean tags.
Scriptlets are gross. But using bean tags in place of them might have been true 9 years ago. Modern JSP uses JSTL and EL.
So you are saying I should not be be doing anything different than this ?(snippet of old code of mine):
No, I am not saying that. The scriptlets in that code need to be fed to the shredder. There should be no Java code in a JSP. None. Nada. Zero. Zilch.
Why on earth are you mixing scriptlets in with the JSTL and EL?
The setting of the scoped variables (via setAttribute()) should be taking place in the controller, not the page.
Joined: May 16, 2011
I would appreciate it if you would remain patient with me. "umms" in sarcastic tones does nothing but belittle me ...
I've obviously gotten confused about something and would appreciate if you could either point me in the right direction or show me an example. I came to this forum for some help afterall. I don't have 10 years of experience. I'm really new at this.