• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to create a bean using jstl?  RSS feed

 
Ranch Hand
Posts: 209
13
VI Editor
  • 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.
 
Sheriff
Posts: 67257
170
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: 209
13
VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, thanks Bear. That answers my question.
 
Bartender
Posts: 1810
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,
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!