Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

296
Views
En una tabla, tengo una lista de archivos. Si el archivo existe, el color de fondo de la fila debe ser verde o rojo.
<tr><th>s.no</th> <th>File name</th> <th>Date and time</th> <th>Show</th></tr> <% while(rs.next()){ String id=rs.getString(1); String name=rs.getString(2); String date=rs.getString(3); try{ File file=new File("C:\\Users\\Ragulprasath\\Desktop\\Register\\src\\main\\webapp\\uploaded\\"+name); if(file.exists()){ //what should put here } else{ //also here } } catch(Exception e){} %> <tr> <td><%=id%></td> <td><%=name%></td> <td><%=date%></td> <td><input type="button" onClick="location.href='view.jsp?msg=<%=name%>'" value="View the contents"/></td> </tr> <%} %>

¿Cómo puedo hacer esto para establecer el color de la fila en función de si el archivo existe (verde) si no la fila debe ser roja? En esto, obtengo los detalles como el nombre del archivo y verifico si existe o no, pero no lo sé. para continuar

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Realmente no conozco ningún JSP, pero sea cual sea el idioma, debe establecer el color que desee en su bloque IF/ELSE (no crea que realmente necesita ELSE si está en el tiempo)

 // .... While (rs.next()) { String bgColor = "#00000"; // .... if(file.exists()){ bgColor = "#FFFF" } <tr style="background-color:<% bgColor %>;"> // ....
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!