Электронный магазин на Java и XML

         

Начало кода методов...



Листинг 4.17. Начало кода методов и переменных экземпляра (Product Formatter.java)

String[] elem, style ; String resourcePath ; String aLink ; int linkN ; // when aLink is supplied, it should be something like // "/servlet/catalog?action=showproduct", then the doListOutput will build a // complete link adding &id=xxxxxx to attach to the first parameter public void setALink(String s, int pos ) { aLink = s ; linkN = pos ;} public void setResourcePath( String s ){ resourcePath = s ; } // throws exception if unknown format public ProductFormatter( String frmt ){ if( frmt.equals("short")){ elem = shortEl ; style = shortSt ; } else if( frmt.equals("full")){ elem = fullEl ; style = fullSt ; } else { throw new IllegalArgumentException ("ProductFormatter: " + frmt );
} }



Содержание раздела