aspose file tools
The moose likes JSP and the fly likes JSTL create bean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "JSTL create bean" Watch "JSTL create bean" New topic
Author

JSTL create bean

carlos Muller
Greenhorn

Joined: Apr 20, 2006
Posts: 14
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

Joined: Nov 15, 2004
Posts: 1026
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"/>


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56191
    
  13

What have you got against <jsp:useBean>? I use it all the time in conjunction with the JSTL.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JSTL create bean
 
Similar Threads
How-to use DOM document returned from a bean, with JSTL x:transform
confused about the usage of JSP tags
<c:set target>
Clarification About c:set target= on bottom of p.447 of HFSJ Book
Difference betweenn c:set and jsp:useBean