• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create a bean using jstl?  RSS feed

 
Richard Hayward
Ranch Hand
Posts: 176
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am just starting to learn about beans.
I have a bean & a jsp page that uses that bean:





It works as expected, but is there any way of creating the bean instance without useBean? Is there any jstl syntax to do that?

I know that creating beans in a jsp page is not the recommended way to do things. I'm just testing here.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard Hayward wrote:
It works as expected, but is there any way of creating the bean instance without useBean? Is there any jstl syntax to do that?

No. Why would there be?

I know that creating beans in a jsp page is not the recommended way to do things. I'm just testing here.

Correct. Not the right way to do things. If you need to, useBean is what you'll need to use. But, just don't.
 
Richard Hayward
Ranch Hand
Posts: 176
11
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, thanks Bear. That answers my question.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have your servlet put the bean into the request scope and forward it to the page.


Now you have the bean in scope and can use JSTL to access it's properties without using the useBean syntax,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!