Two Laptop Bag*
The moose likes JSF and the fly likes retrieve a int from backbean and dinamically work with it in the .xhtml in very bizarre way Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "retrieve a int from backbean and dinamically work with it in the .xhtml in very bizarre way" Watch "retrieve a int from backbean and dinamically work with it in the .xhtml in very bizarre way" New topic
Author

retrieve a int from backbean and dinamically work with it in the .xhtml in very bizarre way

Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
Hi I am trying to retrieve an int from backbean and dinamically and work with it in the .xhtml as follows.

Which I am trying is this using that value, print dinamically in the .xhtml. ¿is it possible?.

I have a method in the backbean which returns an int, then I cast it to String and in function of it the .xhtml do this:


if(value 1)

<div id="Searchresult" >

<hutputText value="#{Content.load1}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load2}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load3}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load4}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load5}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load6}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load7}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load8}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load9}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load10}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load11}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load12}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load13}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load14}"/><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><hutputText value=" " /><br></br>
<hutputText value="#{Content.load15}"/><hutputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>


</div>

if(value 2)

<div id="Searchresult" >

<h:outputText value="#{Content.load1}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load2}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load3}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load4}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load5}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load6}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load7}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load8}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load9}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load10}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load11}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load12}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load13}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load14}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load15}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>


</div>

<div id="Searchresult" >

<h:outputText value="#{Content.load1}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load2}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load3}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load4}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load5}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load6}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load7}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load8}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load9}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load10}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load11}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load12}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load13}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load14}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>
<h:outputText value="#{Content.load15}"/><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><h:outputText value=" " /><br></br>


</div>


I am trying that because I cant find a better way.

¿Any idea?

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960
    
  19

¡Ouch! ¿Can you use the "Code" tags to format that next time?

You do not have to coerce values from int to string when using EL. The page renderer will automatically convert primitive property values such as ints, doubles, booleans and their respective wrapper objects.

You seem to be giving all your divs the same ID and that's not legal. Each one should have a unique ID. And actually, I recommend using JSF panelGrid columns="1" instead of brute-force HTML.

For example:



Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: retrieve a int from backbean and dinamically work with it in the .xhtml in very bizarre way
 
Similar Threads
Set css values dinamically pressing buttons
Could not instantiate Seam component: motorcycleCategService Problem
Trying send three values with just one button
Call back bean method from a facelet template.
pagination jquery dinamically