This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL create bean

 
carlos Muller
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I need create an object in my JSP (pageScope) with JSTL. The tag c:set don't work for me, because it don't have a manner of give the class of the object, like:

jsp:useBean id="beanForm" class="FormOfer" scope="page"

useBean works like I'd like works c:set, but How can I make this with JSTL?

PD: Sorry for my English
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With JSTL, you set the bean object in servlet code in the desired scope and forward the request to the target JSP, where you can use JSTL to set the value of the bean like

Servlet Code:
FormOfer offer = new FormOfer();
request.setAttribute("beanForm",offer);

JSP Code:
<c:set target="${beanForm}" property="name" value="carlos"/>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you got against <jsp:useBean>? I use it all the time in conjunction with the JSTL.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic