ciao a tutti,
ho scritto la classe (descrive il docente):


package mypackage;

import mypackage.StringFormat.*;

public class Docente {
...
/**
* restituisce il valore del NOME relativo al docente
*/
public String getNome() {
return (nome == null ? "" : nome);
}

/**
* restituisce il valore del NOME relativo al docente,
* con tutti i caratteri speciali HTML covertiti
*/
public String getNomeFormatted() {
return StringFormat.toHTMLString(getNome());
}

/**
* associa alla proprietà NOME il cognome del docente
*/
public void setNome(String value) {
nome = value;
}
...
}


e la classe (valida i dati inserit inella form e trasforma i caratteri speciali in caratteri"HTML"):


package mypackage

import java.text.*;
import java.util.*;

public class StringFormat {
...
public String toHTMLString(String in) {
StringBuffer out = new StringBuffer();
for (int i = 0; in != null && i < in.length(); i++) {
char c = in.charAt(i);
if (c == '\'') {
out.append("&#39;");
}
else if (c == '\"') {
out.append("&#34;");
}
else if (c == '<') {
out.append("&lt;");
}
else if (c == '>') {
out.append("&gt;");
}
else if (c == '&') {
out.append("&amp;");
}
else {
out.append(c);
}
}
return out.toString();
}
...
}


se compilo StringFormat.java non vi è alcun problema,
ma se compilo Docente.java mi compare l'errore:


C:\Programmi\Apache Group\Tomcat 4.1\webapps\pdsol\WEB-INF\classes\mypackage\Docente.java:45:
non-static method toHTMLString(java.lang.String) cannot be referenced from a static context
return StringFormat.toHTMLString(getNome());


COSA DIAVOLO SIGNIFICA ?!?
cawa