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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:59:10+00:00 2026-06-18T07:59:10+00:00

I have this peace of code: <% ArrayList<Utente> lista=null; try{ lista= (ArrayList<Utente>)request.getAttribute(lista); }catch(Exception e){

  • 0

I have this peace of code:

<%
ArrayList<Utente> lista=null;
try{
    lista= (ArrayList<Utente>)request.getAttribute("lista");
}catch(Exception e){
    e.printStackTrace();
}
    if(lista!=null){                    
for(int i=0;i<lista.size();i++){                                                                                        out.print("<tr>");
                        out.print("<td>"+lista.get(i).getNome()+"</td>");
                        out.print("<td>"+lista.get(i).getCognome()+"</td>");
                        out.print("<td>"+lista.get(i).getPosizione()+"</td>");
                        out.print("<td>"+lista.get(i).getTelefono()+"</td>");
                        out.print("<td><img src='imm/view.png'>&nbsp"+
                                "<a href='' id='"+lista.get(i).getIdUtente()+"' class='view'>Vedi</a>&nbsp &nbsp" 
                                +"<img src='imm/mod.png'>&nbsp"+
                                "<a href='InfoUtente&id="+lista.get(i).getIdUtente()+"' id='"+lista.get(i).getIdUtente()+"' class='mod'>Modifica   </a>&nbsp &nbsp"+
                                 "<img src='imm/del.png'>&nbsp"+
                                "<a href='' id='"+lista.get(i).getIdUtente()+"' class='del' name='"+lista.get(i).getNome()+" "+lista.get(i).getCognome()+"'>Elimina   </a></td>");
                         }

                }
                        %>

What I want to do now is to call the servlet InfoUtente when I click on the link Modifica on a certain index. And so I want to pass the index parameter to the servlet.
How can I do?

  • 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-06-18T07:59:11+00:00Added an answer on June 18, 2026 at 7:59 am

    Just as you did, except the query string must start with a ? and not with a &:

    <a href='InfoUtente?id="+lista.get(i).getIdUtente()
                       ^-- here
    

    & is used to separate the parameters inside the query string. And it must be HTML-escaped. So if you had a second parameter to pass, you would need to generate the following URL:

    <a href='InfoUtente?id=" + theId + "&amp;foo=bar"
    

    Note that generating HTML from Java code is not a good practice. It leads to hard-to read, unmaintainable code. Scriptlets should be avoided. You should do that using JSTL tags and the JSP EL:

    <c:forEach var="utente" items="${lista}">
        <tr>
            <td><c:out value="${utente.nome}"/></td>
            <td><c:out value="${utente.cognome}"/></td>
            <td><c:out value="${utente.posizione}"/></td>
            <td><c:out value="${utente.telefono}"/></td>
            <td>
               <img src="imm/view.png"/>&nbsp;
               <a href="" id="${utente.idUtente}" class="view">Vedi</a>
               &nbsp;&nbsp;
               <img src="imm/mod.png"/>&nbsp;
               <a href="<c:url value="InfoUtente">
                            <c:param name="id" value="${utente.idUtente}"/>
                        </c:url>" class="mod">Modifica</a>
               &nbsp;&nbsp;
               <img src="imm/del.png"/>&nbsp;
               <a href="" class="del" name="<c:out value="${utente.nome} ${utente.cognome}"/>">Elimina</a>
            </td>
        </tr>
    </c:forEach>
    

    Note how the structure is much more readable. Also note that

    • it’s &nbsp; and not &nbsp
    • you can’t have several elements with the same ID. This is invalid.
    • <c:out> allows escaping special characters. So if any of the attributes contains a < or a > or a & for example, it won’t lead to invalid HTML (or worse: to an XSS attack)
    • using <c:url> allows using absolute paths instead of relative paths without hard-coding the context path, and it URL-encodes the parameters.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have this peace of code: <rich:select enableManualInput=true defaultLabel=Select time spent> <f:selectItems value=
I have this peace of code $doc = new DOMDocument(); $doc->loadHTML($article_header); $imgs = $doc->getElementsByTagName('img');
I have this peace of code which brings string searches for img tags in
I have this code that suppose to place the marker by the latlng public
I want to draw image in place where I click. i have this code:
I have code that all over the place(probably 20-30 instances) does this: <widget>.setVisible((condition ==
I'm looking at some code with this form: 1 package com.stackoverflow.java.questions; 2 import java.util.ArrayList;
:) I have int[] code = new int[10]; It has the following values: code[0]
I have write this code for displaying some set of colors from panel: import
I have this need to place my app in the share/send context menu so

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.