aspose file tools*
The moose likes JSF and the fly likes Access backing bean variables from JSP directly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Access backing bean variables from JSP directly" Watch "Access backing bean variables from JSP directly" New topic
Author

Access backing bean variables from JSP directly

raju svgk
Greenhorn

Joined: Sep 25, 2002
Posts: 14
Hi, I need to access backing bean variables directly from the JSP. Not able to figure out how to do it. I created a Hashtable (details) and String[] (header) variables in the backing bean and initialized both in the corresponding backing bean constructor. Now I want to access those two variables from the JSP and apply some logic to format them properly. How can I do it?

Backing bean code

package com.itools.vs.view.backing.General;


find.jsp JSP code:

faces-config.xml
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Backing beans are not some sort of magical creation that only JSF understands. Backing beans are ordinary Javabeans that have been wired into the JSF application. JSF can construct them and connect them together, but unlike Struts formbeans and action beans, they don't have any special properties or attributes of their own.

So if you want to get at a session backing bean, use the same technique you'd use to get at any other J2EE session bean.


Customer surveys are for companies who didn't pay proper attention to begin with.
raju svgk
Greenhorn

Joined: Sep 25, 2002
Posts: 14
In the given example find.jsp is JSF only. I am treating JSF means backing bean with an associated JSP. In my JSF I can access the backing bean attribuites trough <hutputtext ..../> etc., Now I want to access those backing bean attributes between

<%

%>

How can I achieve this?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Probably the easiest way would be via JSTL. Use a useBean to define the backing bean to the JSP and a cut to print the property value.
Cyrille Pontvieux
Greenhorn

Joined: Sep 25, 2009
Posts: 1


You defined "backing_General_top" but you used "backing_General_find", here is the error.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access backing bean variables from JSP directly
 
Similar Threads
initial page event
Unable to call Action Methof
Setting ID attribute in backing bean
passing parameter from non JSF URL to JSF backing bean
Struts: No getter method for property name problem