Commit e5d5c32b by Patryk Czarnik

Drugi program

parent 25d48dd6
...@@ -7,7 +7,7 @@ import ogloszenia.generated.OgloszenieSamochodowe; ...@@ -7,7 +7,7 @@ import ogloszenia.generated.OgloszenieSamochodowe;
import java.util.List; import java.util.List;
public class OdczytajWszystkie { public class Klient1_OdczytajWszystkie {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
System.out.println("Startujemy..."); System.out.println("Startujemy...");
......
package ogloszenia.klient;
import java.util.Scanner;
import ogloszenia.generated.*;
public class Klient2_JednoOgloszenie {
public static void main(String[] args) {
OgloszeniaService service = new OgloszeniaService();
Ogloszenia proxy = service.getOgloszeniaPort();
System.out.println("Ujemne id kończy program");
Scanner sc = new Scanner(System.in);
while(true) {
System.out.print("Podaj id szukanego ogłoszenia: ");
int id = sc.nextInt();
if(id <= 0) break;
try {
OgloszenieSamochodowe ogl = proxy.readOne(id);
System.out.printf("%s %s za %s\n", ogl.getMarka(), ogl.getModel(), ogl.getCena());
System.out.println(ogl.getTytul());
System.out.println(ogl.getOpis());
} catch (NieznanyRekord_Exception e) {
System.out.println(e.getMessage());
} catch (BladBazyDanych_Exception e) {
System.out.println("Inny błąd serwera: " + e);
} catch (Exception e) {
System.out.println("Inny błąd: " + e);
}
}
}
}
// alt+Enter intellij =~= Ctrl+1 w eclipse
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment