I have bean defined as PersonBean
in session scope.
What I want is find the PersonBean.personId
in jsp page.
I want it in jsp page, because I want to do some calculation based on this personId
. Anyone have idea how to get the same.
In JSP, I am able to print the same using jsf
<h:outputText value="#{PersonBean.personId}" />
However I need this value assigned to some integer value in jsp as shown below.
<h:outputText value="#{PersonBean.personId}" />
<%
int i = new PersonBean().getPersonId;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
I thought int i = new PersonBean().getPersonId;
would work, however it is not working. Any idea how I get get this?
Update 1
I also tried
<jsp:useBean id="sessionPersonalDataBean" class="com.sac.databean.PersonalInformationDataBean" scope="session"/>
<%
out.print("my id is " + sessionPersonalDataBean.getPersonId());
%>
Still I get output as my id is 0
instead of my id is 0
.
NOTE:
When I use, <h:outputText value=#{PersonalInformationDataBean.personId} />
I get proper output.