如果我从第1页到第2页,在我点击第1页的提纲时,控制就与第1页对应的有管理的纸张,我想从数据库中得出一些结果,并将其显示为第2页,如果我把数据库的数值确定为与第1页的Bean行动方法中第2页对应的有管理的星号,那么我将能够把这些数值放在第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. 另外,你还可以有几类百日元,可以向您提供所有数据库业务(可以是爱阵的星号,甚至也可以是加勒比共同基金的管理者),然后向每一个需要与世行合作的管理者投放。
I m using the new JSF2 <h:link> tag, with a nested <f:param> to link to a page using a get request. However, the conversation id (cid) is propagated via the query parambeters of the link ...
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> <...
I am currently trying to dynamically add a new component to the JSF component tree during an ajax request. In fact I add a child to the UIViewRoot component in my AjaxBehaviorListener which is fired ...
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"...
I have this form: <h:form> <h:outputText value="Tag:" /> <h:inputText value="#{entryRecorder.tag}"> <f:ajax render="category" /> </h:inputText> ...
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 ...
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 ...
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 ...