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 7617981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:16:53+00:00 2026-05-31T03:16:53+00:00

I’ve got an ArrayList of objects that I read from a txt file, RegistrationFormBean();

  • 0

I’ve got an ArrayList of objects that I read from a txt file, RegistrationFormBean(); is the element type

    public List getuserList() throws IOException{

            InputStream input = new FileInputStream("log.txt");

                int i=0;

                String temp[]=new String[5];

                                          tmp= new RegistrationFormBean();
                BufferedReader in = new BufferedReader(new FileReader("log.txt"));

                while ((str = in.readLine()) != null) {

                              StringTokenizer st = new StringTokenizer(str,"\t\t");

                    while(st.hasMoreElements()){
                    temp[i]=st.nextElement().toString();
                                                }

                                                   tmp.setName(temp[0]);
                    tmp.setCognome(temp[1]);
                    tmp.setCitta(temp[4]);
                    tmp.setDdnascita(temp[2]);
                    tmp.setCodfisc(temp[3]);

                    userList.add(tmp);
                                        }
                in.close();

    return userList;
}

this is the jsp page that should iterate over the arraylist returned and print the attributes for each element of the arraylist

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld"   prefix="bean" %>
<jsp:useBean id="userList" scope="request" class="com.webagesolutions.struts.actions.query"/>



<html:html>
<HEAD>
<%@ page 
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE></TITLE>
</HEAD>

<BODY>
    <table border=1>
        <logic:iterate name="userList" id="nextElement" property="userList">
    <tr>
    <td><bean:write name="nextelement" property="name"/></td>
    <td><bean:write name="nextElement" property="cognome"/></td>
    <td><bean:write name="nextElement" property="ddnascita"/></td>
    <td><bean:write name="nextElement" property="codfisc"/></td>
    <td><bean:write name="nextElement" property="citta"/></td>  
    </tr>
    </logic:iterate>        
    </table>
</BODY>
</html:html>

So I’m wondering how to access the elements of next element, suppose that the property are the element.name element.cognome element.ddnascita (attributes of element), should I define some getters in the class that reads the txt file ?
should I reference the element type in the jsp page ?

note that with the code I’ve wrote I get only the first column printed and it contains the “citta” wich in my tmp is the last attribute of the element,
also I’ve did a debug and the list gets loaded correctly so the problem I suppose is in the jsp page.

  • 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-31T03:16:55+00:00Added an answer on May 31, 2026 at 3:16 am

    You can use <nested:nest> tag to access nested properties.
    To use it, you need to add the taglib in the JSP page:

    <%@ taglib uri="/tags/struts-nested" prefix="nested"%>
    

    For the above example, you have userList as list of the parent beans, which has some composite properties like cognome and plain String properties like name. Now, start iterating the userList like this:

    <nested:nest property="userList">
        <!-- 'name' is just plain String, does not need a nested iteration --> 
        <nested:write property="name"/> 
    
        <!-- but 'cognome' has some inner properties, we are interested in exploring -->
        <nested:iterate property="cognome">
             <nested:write property="somePropertyOfCognome"/>
        </nested:iterate>
    
    </nested:nest>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.