English 中文(简体)
3. 在另一个加勒比管理方法中确立加勒比管理价值观
原标题:Setting ManagedBean values in another ManagedBean s method
  • 时间:2012-05-17 06:59:06
  •  标签:
  • jsf-2

如果我从第1页到第2页,在我点击第1页的提纲时,控制就与第1页对应的有管理的纸张,我想从数据库中得出一些结果,并将其显示为第2页,如果我把数据库的数值确定为与第1页的Bean行动方法中第2页对应的有管理的星号,那么我将能够把这些数值放在第2页上。

请说明我的做法是否正确?

问题回答

你们可以这样向Bean2注入名人名的美因。

@ManagedBean
@RequestScoped
public Bean2 {
     @ManagedProperty(value="#{bean1}")//this is EL name of your bean 
     private Bean1 injectedBean;

     public void setBean1(Bean1 value) {
          injectedBean = value; //provide setter for it
     }

     @PostConstruct
     private void init() {
         List<YourData> list = injectedBean.getDBData(); //now you can fetch your list
     }

请注意,你必须提供注射器具和注射器具的范围,应始终相同或更高,然后是你的豆类范围(在这种情况下,Bean1必须至少是请求书目)。

P.S. 另外,你还可以有几类百日元,可以向您提供所有数据库业务(可以是爱阵的星号,甚至也可以是加勒比共同基金的管理者),然后向每一个需要与世行合作的管理者投放。





相关问题
JSF redirect doesn t work

I have a problem with redirecting a page in my JSF application. My navigation rule look like this : <navigation-rule> <from-view-id>/index.xhtml</from-view-id> <...

Get JSF managed bean by name in any Servlet related class

I m trying to write a custom servlet (for AJAX/JSON) in which I would like to reference my @ManagedBeans by name. I m hoping to map: http://host/app/myBean/myProperty to: @ManagedBean(name="myBean"...

JSF2 - what scope for f:ajax elements?

I have this form: <h:form> <h:outputText value="Tag:" /> <h:inputText value="#{entryRecorder.tag}"> <f:ajax render="category" /> </h:inputText> ...

Modifying JSF Component Tree in PhaseListener

I m having an issue. I ve implemented a PhaseListener, which is meant to add a style class to any UIInput components in the tree that have messages attached to them, and removes the style class if it ...

JSF 2 - clearing component attributes on page load?

The real question: Is there a way to clear certain attributes for all components on an initial page load? Background info: In my application, I have a JSF 2.0 frontend layer that speaks to a service ...

JSF2 - backed by EJB or ManagedBean?

As I am learning JSF2, I realized I am not sure what the backing components should be. From design point of view, what is the difference between EJBs and @ManagedBeans? In the end I am going to use ...

热门标签