Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria
Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria
vivo X300 Pro rappresenta un'evoluzione misurata della serie fotografica del produttore cinese, con un sistema di fotocamere migliorato, chipset Dimensity 9500 di ultima generazione e l'arrivo dell'interfaccia OriginOS 6 anche sui modelli internazionali. La scelta di limitare la batteria a 5.440mAh nel mercato europeo, rispetto ai 6.510mAh disponibili altrove, fa storcere un po' il naso
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo
Lenovo Legion Go 2 è la nuova handheld PC gaming con processore AMD Ryzen Z2 Extreme (8 core Zen 5/5c, GPU RDNA 3.5 16 CU) e schermo OLED 8,8" 1920x1200 144Hz. È dotata anche di controller rimovibili TrueStrike con joystick Hall effect e una batteria da 74Wh. Rispetto al dispositivo che l'ha preceduta, migliora ergonomia e prestazioni a basse risoluzioni, ma pesa 920g e costa 1.299€ nella configurazione con 32GB RAM/1TB SSD e Z2 Extreme
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti
A re:Invent 2025, AWS mostra un’evoluzione profonda della propria strategia: l’IA diventa una piattaforma di servizi sempre più pronta all’uso, con agenti e modelli preconfigurati che accelerano lo sviluppo, mentre il cloud resta la base imprescindibile per governare dati, complessità e lock-in in uno scenario sempre più orientato all’hybrid cloud
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 22-01-2008, 13:21   #1
xxdavide84xx
Member
 
L'Avatar di xxdavide84xx
 
Iscritto dal: May 2006
Città: Cesenatico
Messaggi: 274
[JSP] Spingendo pulsante upload fare partire programma java

Salve mi chiedevo avendo questo semplice e intuitivo JSP
Codice:
<%-- 
    Document   : Verifica tesi
    Created by : Venturi Davide
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Verifica tesi</title>
</head>
<p align="center"><b><font size="5" color="#0000FF">Verifica parametri tesi</font></b></p>
    <FORM ENCTYPE='multipart/form-data'
 method='POST' action='mioserver/upload.jsp'>
<p align="center">
<INPUT TYPE='file' NAME='fileUp'>
<INPUT TYPE='submit' VALUE='Upload File'>
</p>
</FORM>
</html>
1) come faccio a dire quando spingo il pulsante Upload di fare partire il mio programma parserDOm.java sul file caricato?
2) Come faccio in sfoglia a fare comparire solo i file .xml???
__________________
CPU Intel i5-4590, Scheda Madre Asrock H97 Pro4, RAM DDR3 Corsair Vengeance 1600MHz 8GB CL9, Hard Disk WD Caviar Blue 1TB, SSD Crucial MX100 256GB.
xxdavide84xx è offline   Rispondi citando il messaggio o parte di esso
Old 22-01-2008, 13:38   #2
AnonimoVeneziano
Senior Member
 
L'Avatar di AnonimoVeneziano
 
Iscritto dal: Aug 2001
Città: San Francisco, CA, USA
Messaggi: 13827
Quote:
Originariamente inviato da xxdavide84xx Guarda i messaggi
Salve mi chiedevo avendo questo semplice e intuitivo JSP
Codice:
<%-- 
    Document   : Verifica tesi
    Created by : Venturi Davide
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Verifica tesi</title>
</head>
<p align="center"><b><font size="5" color="#0000FF">Verifica parametri tesi</font></b></p>
    <FORM ENCTYPE='multipart/form-data'
 method='POST' action='mioserver/upload.jsp'>
<p align="center">
<INPUT TYPE='file' NAME='fileUp'>
<INPUT TYPE='submit' VALUE='Upload File'>
</p>
</FORM>
</html>
1) come faccio a dire quando spingo il pulsante Upload di fare partire il mio programma parserDOm.java sul file caricato?
2) Come faccio in sfoglia a fare comparire solo i file .xml???
1) Devi creare una Servlet che gestisce la richiesta. Se non sai cos'è una servlet allora devi studiare di più sull'argomento JSP/Servlets. Per prima cosa la definizione generale : http://en.wikipedia.org/wiki/Java_Servlet e questo invece è un libro molto buono e gratuito che spiega un po' di cose sull'argomento : http://pdf.coreservlets.com/

Per usare JSP + Servlet hai bisogno di un server HTTP contenitore che gestisce JSP e Servlets. Ti consiglio di usare Apache Tomcat ( http://tomcat.apache.org )

2) Non lo so
__________________
GPU Compiler Engineer
AnonimoVeneziano è offline   Rispondi citando il messaggio o parte di esso
Old 22-01-2008, 18:47   #3
xxdavide84xx
Member
 
L'Avatar di xxdavide84xx
 
Iscritto dal: May 2006
Città: Cesenatico
Messaggi: 274
NetBeans e Tomcat ce li ho già...

Non mi puoi fare un esempio della Servlet che dovrei utilizzare,
se il mio programma si chiamasse parserDOM.java?
__________________
CPU Intel i5-4590, Scheda Madre Asrock H97 Pro4, RAM DDR3 Corsair Vengeance 1600MHz 8GB CL9, Hard Disk WD Caviar Blue 1TB, SSD Crucial MX100 256GB.
xxdavide84xx è offline   Rispondi citando il messaggio o parte di esso
Old 23-01-2008, 12:29   #4
xxdavide84xx
Member
 
L'Avatar di xxdavide84xx
 
Iscritto dal: May 2006
Città: Cesenatico
Messaggi: 274
Ho provato a prendere degli esempi dalla rete, ma non riesco ad installare le librerie: javax.servlet
ho provato a scaricare da qui:
http://java.sun.com/products/servlet/2.1/

http://commons.apache.org/fileupload/

http://vmgump.apache.org/gump/public...karta-commons/

http://tomcat.apache.org/tomcat-5.5-...api/index.html

http://www.servlets.com/cos/

a scaricare i zip, ma non riesco a farli funzionare su un editor Java anche importando (forse erroneamente i file)....

Ho anche Netbean, ma non riesco lo stesso a fare partire questo (ossia non riesco a generare il file .class):
Codice:
 import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;


public class ControllerFiles extends HttpServlet
{
  public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
  {
    // Istanziamo le variabili
    // Il ServletContext sevirà per ricavare il MIME type del file uploadato
    ServletContext context = getServletContext();
    String forw = null;
    try
    {
      // Stabiliamo la grandezza massima del file che vogliamo uploadare
      int maxUploadSize = 50000000;
      MultipartRequest multi = new MultipartRequest(request, ".", maxUploadSize);
      String descrizione = multi.getParameter("text");
      File myFile = multi.getFile("myFile");
      String filePath = multi.getOriginalFileName("myFile");
      String path = "C:\\files\\";
      try
      {
        // ricaviamo i dati del file mediante un InputStream
        FileInputStream inStream = new FileInputStream(myFile);
        // stabiliamo dove andrà scritto il file
        FileOutputStream outStream = new FileOutputStream(path + myFile.getName());
        // salviamo il file nel percorso specificato
        while ( inStream.available() > 0 )
        {
          outStream.write(inStream.read());
        }
        // chiudiamo gli stream
        inStream.close();
        outStream.close();
      }
      catch (FileNotFoundException fnfe)
      {
        fnfe.printStackTrace();
      }
      catch (IOException ioe)
      {
        ioe.printStackTrace();
      }
      forw = "/done.jsp";
      // mettiamo nella request i dati così da poterli ricavare dalla jsp 
      request.setAttribute("contentType", context.getMimeType(path + myFile.getName()));
      request.setAttribute("text", descrizione);
      request.setAttribute("path", path + myFile.getName());
      request.setAttribute("size", Long.toString(myFile.length()) + " Bytes");
      RequestDispatcher rd = request.getRequestDispatcher(forw);
      rd.forward(request, response);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}
__________________
CPU Intel i5-4590, Scheda Madre Asrock H97 Pro4, RAM DDR3 Corsair Vengeance 1600MHz 8GB CL9, Hard Disk WD Caviar Blue 1TB, SSD Crucial MX100 256GB.
xxdavide84xx è offline   Rispondi citando il messaggio o parte di esso
Old 23-01-2008, 12:45   #5
vladix
Member
 
L'Avatar di vladix
 
Iscritto dal: Jan 2008
Città: roma
Messaggi: 296
crea nuovo progetto web da net beans . metici dentro le tue jsp e classi , poi ( nn ricordo esattamente il percorso ) dal menu crei nuova servlet ( mi racc con la procedura guidata) . Se fai cosi non puoi sbagliare
vladix è offline   Rispondi citando il messaggio o parte di esso
Old 23-01-2008, 13:19   #6
xxdavide84xx
Member
 
L'Avatar di xxdavide84xx
 
Iscritto dal: May 2006
Città: Cesenatico
Messaggi: 274
Quote:
Originariamente inviato da vladix Guarda i messaggi
crea nuovo progetto web da net beans . metici dentro le tue jsp e classi , poi ( nn ricordo esattamente il percorso ) dal menu crei nuova servlet ( mi racc con la procedura guidata) . Se fai cosi non puoi sbagliare
Se io faccio così
Codice:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Verifica tesi</title>
</head>
<p align="center"><b><font size="5" color="#0000FF">Verifica parametri tesi</font></b></p>
    <FORM ENCTYPE='multipart/form-data'
 method='POST' action='mioserver/upload.jsp'>
<p align="center">
<INPUT TYPE='submit' VALUE='Upload File'>
</p>
</FORM>
</html>
Dove devo mettere upload.jsp per farlo partire???

Io ho un file bb.java che fa una cosa. e funziona normalmente in java, come faccio a farlo partire anche se non è settato per essere una web application spingendo il pulsante upload?
Questo è bb.java:
Codice:
import java.io.*;
import java.util.*;
import java.awt.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import javax.swing.*;

public class bb
{
  Vector styleNodes = new Vector();

  Vector styleObjects = new Vector();

  Vector bodyNodes = new Vector();

  Vector bodyObjects = new Vector();

  public bb()
  {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
    try
    {
      builder = factory.newDocumentBuilder();
    }
    catch (ParserConfigurationException e)
    {
      e.printStackTrace();
      System.exit(1);
    }
    Document document = null;
    try
    {
      JFileChooser fc = new JFileChooser();
      fc.setApproveButtonText("Apri");
      //decidi cosa mettere nel pulsante
      fc.setDialogTitle("Seleziona XML");
      //imposti nome JFileCHooser    
      fc.setFileFilter(new XMLFilter());
      // imposti filtro .xml
      int value = fc.showOpenDialog(null);
      if ( value == JFileChooser.APPROVE_OPTION )
      {
        File f = fc.getSelectedFile();
        PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("Verifica_tesi.txt", false)));
        document = builder.parse(f);
        findStyleNodes(document);
        createStyleObjects();
        Based_On();
        printStyles(pw);
        findBodyNodes(document);
        createBodyObjects();
        printBody(pw);
        controlli();
        pw.close();
        try {
            String nomeFile = "Verifica_tesi.txt";
            Runtime rt = Runtime.getRuntime() ;
            Process proc;
            proc = rt.exec("cmd /C start "+nomeFile);

            InputStream inp = proc .getInputStream() ;
            OutputStream outp = proc .getOutputStream ();
            InputStream errp = proc .getErrorStream();

        } catch(Exception e) {
            e.printStackTrace();
        }
      }
      if ( value == JFileChooser.CANCEL_OPTION )
      {
        System.out.println("Hai premuto il tasto annulla");
      }
      if ( value == JFileChooser.ERROR_OPTION )
      {
        System.out.println("ERRORE");
      }
      System.exit(0);
    }
    catch (Exception e)
    {
      e.printStackTrace();
      System.exit(1);
    }
  }

  private void findStyleNodes(Node startingNode)
  {
    NodeList childNodes = startingNode.getChildNodes();
    for ( int i = 0; i < childNodes.getLength(); i++)
    {
      Node actualNode = childNodes.item(i);
      if ( isStyleNode(actualNode) )
        styleNodes.addElement(actualNode);
      if ( actualNode.hasChildNodes() )
        findStyleNodes(actualNode);
    }
  }

  private boolean isStyleNode(Node node)
  {
    return node.getNodeName().equals("w:style");
  }

  private void createStyleObjects()
  {
    for ( int i = 0; i < styleNodes.size(); i++)
    {
      Node styleNode = (Node)styleNodes.elementAt(i);
      Style style = new Style();
      style.name = getAttributeValue(styleNode, "w:styleId");
      Node basedNode = getChildNode(styleNode, "w:basedOn");
      if ( basedNode != null )
        style.based = getAttributeValue(basedNode, "w:val");
      Node pPrNode = getChildNode(styleNode, "w:pPr");
      if ( pPrNode != null )
      {
        Node jcNode = getChildNode(pPrNode, "w:jc");
        if ( jcNode != null )
          style.jc = getAttributeValue(jcNode, "w:val");
      }
      Node paragraphNode = getChildNode(styleNode, "w:rPr");
      if ( paragraphNode != null )
      {
        Node fontNode = getChildNode(paragraphNode, "wx:font");
        if ( fontNode != null )
          style.font = getAttributeValue(fontNode, "wx:val");
        else
        {
          Node rfontNode = getChildNode(paragraphNode, "w:rFonts");
          if ( rfontNode != null )
            style.font = getAttributeValue(rfontNode, "w:cs");
        }
        Node sizeNode = getChildNode(paragraphNode, "w:sz");
        if ( sizeNode != null )
          style.size = getAttributeValue(sizeNode, "w:val");
        Node grassettoNode = getChildNode(paragraphNode, "w:b");
        if ( grassettoNode != null )
          style.grassetto = getAttributeValue(grassettoNode, "w:val");
        Node italicoNode = getChildNode(paragraphNode, "w:i");
        if ( italicoNode != null )
          style.italico = getAttributeValue(italicoNode, "w:val");
        Node sottolineatoNode = getChildNode(paragraphNode, "w:u");
        if ( sottolineatoNode != null )
          style.sottolineato = getAttributeValue(sottolineatoNode, "w:val");
      }
      styleObjects.addElement(style);
    }
  }

  private String getAttributeValue(Node node, String attributeName)
  {
    NamedNodeMap attributes = node.getAttributes();
    if ( attributes == null )
      return "";
    Node item = attributes.getNamedItem(attributeName);
    if ( item == null )
      return "";
    return item.getNodeValue();
  }

  private Node getChildNode(Node node, String nodeName)
  {
    NodeList childNodes = node.getChildNodes();
    for ( int i = 0; i < childNodes.getLength(); i++)
    {
      Node childNode = childNodes.item(i);
      if ( childNode.getNodeName().equals(nodeName) )
        return childNode;
    }
    return null;
  }

  private void printStyles(PrintWriter pw)
  {
    for ( int i = 0; i < styleObjects.size(); i++)
    {
      Style style = (Style)styleObjects.elementAt(i);
      //System.out.println(style);
      pw.println(style);
    }
  }

  public static void main(String args[])
  {
    new bb();
  }

  class Style
  {
    String name;

    String based;

    String jc;

    String font;

    String size;

    String grassetto;

    String italico;

    String sottolineato;

    public String toString()
    {
      StringBuffer buffer = new StringBuffer();
      if ( name != null )
      {
        buffer.append("Stile: " + name + "\n");
        if ( based != null )
          buffer.append(" Basato su: " + based + "\n");
        if ( jc != null )
          buffer.append(" Jc: " + jc + "\n");
        if ( font != null )
          buffer.append(" Font: " + font + "\n");
        if ( size != null )
          buffer.append(" Dimensione: " + size + "\n");
        if ( grassetto != null )
          buffer.append(" Grassetto " + grassetto + "\n");
        if ( italico != null )
          buffer.append(" Italico " + italico + "\n");
        if ( sottolineato != null )
          buffer.append(" Sottolineato: " + sottolineato + "\n");
      }
      return buffer.toString();
    }
  }

  private void findBodyNodes(Node startingNode)
  {
    NodeList childNodes = startingNode.getChildNodes();
    for ( int i = 0; i < childNodes.getLength(); i++)
    {
      Node actualNode = childNodes.item(i);
      if ( isBodyNode(actualNode) )
        bodyNodes.addElement(actualNode);
      if ( actualNode.hasChildNodes() )
        findBodyNodes(actualNode);
    }
  }

  private boolean isBodyNode(Node node)
  {
    return node.getNodeName().equals("w:p");
  }

  private void createBodyObjects()
  {
    String stile = new String();
    String jc = new String();
    for ( int i = 0; i < bodyNodes.size(); i++)
    {
      Node bodyNode = (Node)bodyNodes.elementAt(i);
      stile = null;
      jc = null;
      Node paragraphNode = getChildNode(bodyNode, "w:pPr");
      if ( paragraphNode != null )
      {
        Node stileNode = getChildNode(paragraphNode, "w:pStyle");
        if ( stileNode != null )
          stile = getAttributeValue(stileNode, "w:val");
        Node jcNode = getChildNode(paragraphNode, "w:jc");
        if ( jcNode != null )
          jc = getAttributeValue(jcNode, "w:val");
      }
      NodeList pNode = getAllChildNode(bodyNode, "w:r");
      for ( int j = 0; j < pNode.getLength(); j++)
      {
        Body body = new Body();
        body.stile = stile;
        body.jc = jc;
        Node rNode = (Node)pNode.item(j);
        Node rPrNode = getChildNode(rNode, "w:rPr");
        if ( rPrNode != null )
        {
          Node rstileNode = getChildNode(rPrNode, "w:rStyle");
          if ( rstileNode != null )
            body.stile = getAttributeValue(rstileNode, "w:val");
          Node fontNode = getChildNode(rPrNode, "wx:font");
          if ( fontNode != null )
            body.font = getAttributeValue(fontNode, "wx:val");
          Node grassettoNode = getChildNode(rPrNode, "w:b");
          if ( grassettoNode != null )
            body.grassetto = getAttributeValue(grassettoNode, "w:val");
          Node italicoNode = getChildNode(rPrNode, "w:i");
          if ( italicoNode != null )
            body.italico = getAttributeValue(italicoNode, "w:val");
          Node sottolineatoNode = getChildNode(rPrNode, "w:u");
          if ( sottolineatoNode != null )
            body.sottolineato = getAttributeValue(sottolineatoNode, "w:val");
          Node sizeNode = getChildNode(rPrNode, "w:sz");
          if ( sizeNode != null )
            body.size = getAttributeValue(sizeNode, "w:val");
        }
        Node pictNode = getChildNode(rNode, "w:pict");
        if ( pictNode != null )
        {
          Node shapeNode = getChildNode(pictNode, "v:shape");
          if ( shapeNode != null )
          {
            Node imagedataNode = getChildNode(shapeNode, "v:imagedata");
            if ( imagedataNode != null )
            {
              body.titolopict = getAttributeValue(imagedataNode, "o:title");
              body.formatopict = getAttributeValue(imagedataNode, "src");
            }
          }
        }
        Node wtNode = getChildNode(rNode, "w:t");
        if ( wtNode != null )
        {
          Node testoNode = getChildNode(wtNode, "#text");
          if ( testoNode != null )
            body.testo = testoNode.getNodeValue();
        }
        bodyObjects.addElement(body);
      }
    }
  }

  private void printBody(PrintWriter pw)
  {
    for ( int i = 0; i < bodyObjects.size(); i++)
    {
      Body body = (Body)bodyObjects.elementAt(i);
      //System.out.println(body);
      pw.println(body);
    }
  }

  private void Based_On()
  {
    for ( int i = 0; i < styleObjects.size(); i++)
    {
      Style style = (Style)styleObjects.elementAt(i);
      if ( style.size == null )
      {
        if ( style.based != null )
        {
          String Based = style.based;
          for ( int j = 0; j < styleObjects.size(); j++)
          {
            Style style1 = (Style)styleObjects.elementAt(j);
            String name = style1.name;
            if ( Based.equals(name) )
              style.size = style1.size;
          }
        }
      }
    }
  }

  private void controlli()
  {
    for ( int i = 0; i < bodyObjects.size(); i++)
    {
      Body body = (Body)bodyObjects.elementAt(i);
      if ( body.testo != null )
      {
        if ( body.testo.equalsIgnoreCase("Alma Mater Studiorum - Universit� degli Studi di Bologna") || body.testo.equalsIgnoreCase("Sede di Cesena") || 
        body.testo.equalsIgnoreCase("FACOLT� DI SCIENZE MATEMATICHE FISICHE E NATURALI") || body.testo.equalsIgnoreCase("Corso di Studi in Scienze dell�Informazione") )
          System.out.println("OK Intestazione iniziale");
        if ( body.testo.equalsIgnoreCase("Tesi di Laurea in:") || body.testo.equalsIgnoreCase("Tesi di Laurea in") )
          System.out.println("OK materia");
        if ( body.testo.equalsIgnoreCase("relatore:") || body.testo.equalsIgnoreCase("relatore") )
          System.out.println("OK relatore");
        if ( body.testo.equalsIgnoreCase("presentata da:") || body.testo.equalsIgnoreCase("presentata da") )
          System.out.println("OK presentata");
        if ( body.testo.equalsIgnoreCase("corelaotre") || body.testo.equalsIgnoreCase("correlatore") || body.testo.equalsIgnoreCase("corelaotre:") || body.testo.equalsIgnoreCase("correlatore:") )
          System.out.println("OK correlatore");
        if ( body.testo.equalsIgnoreCase("sessione i") || body.testo.equalsIgnoreCase("sessione 1") )
          System.out.println("OK Prima sessione");
        if ( body.testo.equalsIgnoreCase("sessione ii") || body.testo.equalsIgnoreCase("sessione 2") )
          System.out.println("OK Seconda sessione");
        if ( body.testo.equalsIgnoreCase("sessione iii") || body.testo.equalsIgnoreCase("sessione 3") )
          System.out.println("OK Terza sessione");
        if ( body.testo.equalsIgnoreCase("indice") || body.testo.equalsIgnoreCase("ndice") )
          System.out.println("OK INDICE");
        if ( body.testo.equalsIgnoreCase("introduzione") || body.testo.equalsIgnoreCase("ntroduzione") )
          System.out.println("OK INTRODUZIONE");
        if ( body.testo.equalsIgnoreCase("conclusioni") || body.testo.equalsIgnoreCase("onclusioni") || body.testo.equalsIgnoreCase("conclusione") || body.testo.equalsIgnoreCase("onclusione") )
          System.out.println("OK CONCLUSIONI");
        if ( body.testo.equalsIgnoreCase("bibliografia") || body.testo.equalsIgnoreCase("ibliografia") || body.testo.equalsIgnoreCase("bibbliografia") || body.testo.equalsIgnoreCase("ibbliografia") )
          System.out.println("OK BIBLIOGRAFIA");
        if ( body.jc == null && body.font == null && body.size == null )
        {
          ArrayList buffer1 = stili();
          for ( int j = 0; j < buffer1.size(); j++)
          {
            if ( body.stile.equals(buffer1.get(j)) )
              System.out.println("Testo rispetta vincoli");
          }
        }
        else
        {
          if ( body.font != null )
            System.out.println("Font diverso: " + body.font + " dimensione diversa: " + body.size + " contiene: " + body.testo);
        }
      }
    }
    System.out.println("WARNING.....");
  }

  class Body
  {
    String stile;

    String jc;

    String font;

    String grassetto;

    String italico;

    String sottolineato;

    String size;

    String testo;

    String titolopict;

    String formatopict;

    public String toString()
    {
      StringBuffer buffer = new StringBuffer();
      if ( stile != null )
        buffer.append("Stile body: " + stile + "\n");
      if ( jc != null )
        buffer.append(" Jc body: " + jc + "\n");
      if ( font != null )
        buffer.append(" Font body: " + font + "\n");
      if ( size != null )
        buffer.append(" Dimensione body: " + size + "\n");
      if ( grassetto != null )
        buffer.append(" Grassetto body " + grassetto + "\n");
      if ( italico != null )
        buffer.append(" Italico body " + italico + "\n");
      if ( sottolineato != null )
        buffer.append(" Sottolineato body: " + sottolineato + "\n");
      if ( testo != null )
        buffer.append(" Testo body: " + testo + "\n");
      if ( titolopict != null )
        buffer.append(" Nome immagine body: " + titolopict + "\n");
      if ( formatopict != null )
        buffer.append(" Formato immagine body: " + formatopict + "\n");
      return buffer.toString();
    }
  }

  private NodeList getAllChildNode(Node node, String nodeName)
  {
    ArrayNodeList arrNodeList = new ArrayNodeList();
    NodeList childNodes = node.getChildNodes();
    for ( int i = 0; i < childNodes.getLength(); i++)
    {
      Node childNode = childNodes.item(i);
      if ( childNode.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE && childNode.getNodeName().equals(nodeName) )
      {
        arrNodeList.add(childNode);
      }
    }
    return arrNodeList;
  }

  class ArrayNodeList implements NodeList
  {
    private ArrayList nodesArray = new ArrayList();

    public void add(Node n)
    {
      nodesArray.add(n);
    }

    public int getLength()
    {
      return nodesArray.size();
    }

    public Node item(int index)
    {
      try
      {
        return (Node)nodesArray.get(index);
      }
      catch (IndexOutOfBoundsException e)
      {
        return null;
      }
    }
  }

  private ArrayList stili()
  {
    String style1 = new String();
    ArrayList buffer1 = new ArrayList();
    for ( int i = 0; i < styleObjects.size(); i++)
    {
      Style style = (Style)styleObjects.elementAt(i);
      if ( style.jc != null && style.jc.equals("both") )
        if ( style.font != null && style.font.equals("Times New Roman") )
          if ( style.size != null )
            if ( style.size.equals("24") || style.size.equals("26") )
              if ( style.grassetto == null && style.italico == null && style.sottolineato == null )
              {
                style1 = style.name;
                buffer1.add(style1);
              }
    }
    return buffer1;
  }
}
__________________
CPU Intel i5-4590, Scheda Madre Asrock H97 Pro4, RAM DDR3 Corsair Vengeance 1600MHz 8GB CL9, Hard Disk WD Caviar Blue 1TB, SSD Crucial MX100 256GB.

Ultima modifica di xxdavide84xx : 23-01-2008 alle 13:39.
xxdavide84xx è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria Recensione vivo X300 Pro: è ancora lui il...
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'...
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti AWS re:Invent 2025: inizia l'era dell'AI-as-a-Se...
Cos'è la bolla dell'IA e perché se ne parla Cos'è la bolla dell'IA e perché se...
BOOX Palma 2 Pro in prova: l'e-reader diventa a colori, e davvero tascabile BOOX Palma 2 Pro in prova: l'e-reader diventa a ...
Xbox Cloud Gaming arriva su Amazon Fire ...
Un blackout a San Francisco manda in til...
Windows 11 è diventato più...
Apple cambia strategia a causa della cri...
007 First Light: uscita rimandata di due...
Samsung Galaxy A37 e A57: il comparto fo...
DAZN lancia la sua offerta di Natale: My...
Gigabyte fa marcia indietro? Sparito il ...
Alcuni rivenditori giapponesi bloccano l...
Le feste non placano Amazon, anzi: aggio...
Roborock Q10 S5+ a un super prezzo: robo...
Formula sceglie WINDTRE BUSINESS per gar...
EXPO 1.20: AMD migliora il supporto all'...
MacBook Pro con chip M4, 24GB di RAM e 1...
Lefant M330 da 6.000Pa a 139€ o ECOVACS ...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 23:27.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v