• Post Reply Bookmark Topic Watch Topic
  • New Topic

To assign an object to a bean  RSS feed

 
Juan J. Pérez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How I can assign an object to a bean? When I iterate the arraylist to find the object, I want to set the usebean. Is there any way to reduce my code to avoid having to use 5 times jsp:setProperty?

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
useBean and setProperty are obsolete.

You should be using <c:set> instead, and creating beans in the controller.

Why is this code in a JSP in the first place? Seems like something that should have been handled in the controller.
 
Juan J. Pérez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a controller. It receives the id and password parameters. If these parameters match in the database, it gets the other properties and forwarded to another jsp. How would the code with <c:set?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you writing a controller as a JSP rather than a servlet? That's not a good idea, and is considered a really bad practice.
 
Juan J. Pérez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been tasked me a little job with only JSP
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good grief, no servlets? Why?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!