Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6914499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:21:18+00:00 2026-05-27T09:21:18+00:00

I have an arraylist with a custom object type named StartsideElement. <c:forEach items=#{startsideClient.brukerelementer} var=element

  • 0

I have an arraylist with a custom object type named “StartsideElement”.

 <c:forEach items="#{startsideClient.brukerelementer}" var="element" begin="0" step="1">                         
  <div class="#{element.headerStyle}">
   <div>
    <table width="100%" cellpadding="0" cellspacing="0">
     <tr height="25px">
      <td width="5px">
       <img src="#{facesContext.externalContext.requestContextPath}/resources/gfx/topmenu_lefttop.gif" width="5" height="5" />
       <img src="#{facesContext.externalContext.requestContextPath}/resources/gfx/topmenu_left.gif" width="5" height="15" />

       <img src="#{facesContext.externalContext.requestContextPath}/resources/gfx/topmenu_leftbottom.gif" width="5" height="5" />
      </td>
      <td background="#{facesContext.externalContext.requestContextPath}/resources/gfx/topmenu_bg.gif" style="width: 920px;">
       <img src="#{facesContext.externalContext.requestContextPath}/resources/gfx/Calendar_16x16.png" width="16" height="16" style="float:left; margin-bottom:2px;"/>
      <div class="headerText" style="text-align:left; position:relative; left: 15px; margin-top:2px"><h:outputText value="#{element.tittel}" /></div>
      </td>
      <td width="5px">
       <img src="#{facesContext.externalContext.requestContextPath}/resources/gfx/topmenu_righttop.gif" width="5" height="5" />

       <img src="#{facesContext.externalContext.requestContextPath}/resources/gfx/topmenu_right.gif" width="5" height="15" />
       <img src="#{facesContext.externalContext.requestContextPath}/resources/gfx/topmenu_rightbottom.gif" width="5" height="5" />
      </td>
     </tr>
    </table>
   </div>
   <!-- InnholdsDIV til Kommende oppgaver -->
   <div class="#{element.boxStyle}" style="clear: both;">          
    <div class="boxDokumenterFont">                            
     <ui:include src="#{element.mal}" />       
    </div>
   </div>
  </div>
  <!-- END CONTAINER FOR WIDGET -->             
 </c:forEach>

The problem here is that the loop c:foreach will loop 6 times, which is correct, but the value of element will change as i use it. The title of the box created <h:outputText value="#{element.tittel}" /> will not correnspond with the correct value. If I do: <h:outputText value="#{element.tittel element.tittel}" /> the value printed by element.tittel will not be the same both places.

Any suggestions on what to do would be great. I cannot use <ui:repeat> because the #{element.mal} contains a filename that I need to pass to ui:include and that doesn’t work with ui:repeat.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:21:19+00:00Added an answer on May 27, 2026 at 9:21 am

    If I understand correctly, the title
    <h:outputText value="#{element.tittel}" /> within your custom object “StartsideElement” is changing as the jsf code iterates over your arrayList. You would like that value to remain static and not change.

    Why not create another attribute in your “StartsideElement” custom object that has the correct corresponding value?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an h:dataTable with data generated from an ArrayList with custom object Result.
So I have a custom ListView object. The list items have two textviews stacked
I have an ArrayList with custom objects. Each custom object contains a variety of
I have a custom object whose structure is public String name; public int type;
I have an arraylist that contains items called Room. Each Room has a roomtype
I have an arraylist that gets different type of values in it, 1st value->
I have an ArrayList of objects of my custom class. I would like to
I have a AutoCompleteTextView and a custom AutoCompleteTextView adapter. my list has 20 items
I have created an arraylist that is made up of custom objects. Basically the
I have created an ArrayList (Java) of my custom class objects with a size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.