JSF - managed bean in variable?
Posted
by Yurish
on Stack Overflow
See other posts from Stack Overflow
or by Yurish
Published on 2010-03-22T08:40:05Z
Indexed on
2010/03/22
8:41 UTC
Read the original article
Hit count: 359
Hi!
Weird question, but i need to find an answer.
Is there any way, in which i can manage managed beans in JSP? I`ll try to explain, what i want to do:
Imagine, i have JSP page, which, for example, is called document.save.jsp. I have some various documents with different types. Each of them have their own bean. For example: BillDocument.java, OrderDocument.java and ReportDocument.java.
BillDocument.java in my jsp is #{billdoc}.
OrderDocument.java -> #{orddoc}.
ReportDocument.java -> #{repdoc}.
Each of them have method save(). In my JSP i want to call this method, but i need to know, which document it is. In my mind this structure is something like:
<% String currentBean = "";
if(document == BillDocument){
currentBean = #{billdoc};
}
if(document == OrderDocument){
currentBean = #{orddoc};
}
if(document = ReportDocument){
currentBean = #{repdoc};
}
%>
Then, my Button with save method on it, may be smth like:
<h:commandButton action="currentbean.save"/>
Is there any way, in which i can store data about bean, which will be used in this button?
Thank`s for your replies!
© Stack Overflow or respective owner