Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Java Servlet Problem

Empfohlene Antworten

Veröffentlicht

Ich habe folgendes Problem:

Ich habe eine Seite gestaltet, auf der man Checkboxen anklicken kann, falls es in der Datenbank Elemente gibt, d.h. das 2 verschiedene Formulare generiert werden, einmal mit checkbox, einmal ohne. Beide Formulare leiten aber an die selbe Seite weiter und sollen dort ausgewertet werden.

Mit Hilfe von:

String[] checkboxvalue = request.getParameterValues("billcheckbox");

for(int i=0;i<checkboxvalue.length;i++) {

ORDERINGID_LIST.add(Integer.parseInt(checkboxvalue));

}

sollen die Values von der Checkbox in das Array kopiert werden.

Allerdings gibt es eine NullPointerException, wenn auf dem vorrigen Formular keine Checkboxen waren. Da request.getParameterValues("billcheckbox") dann ja nicht funktioniert.

Ich wollte jetzt wissen, ob es irgendwie moeglich ist, vorher zu ueberpruefen ob es ueberhaupt eine postvariable gibt die billcheckbox heisst. Denn falls sie existiert stehen vermutlich auch werte in ihr und falls nicht, soll die for-schleife gar nicht ausgefuehrt werden.

sorry, hab englishe tastatur, deshalb keine umlaute xD

String[] checkboxvalue = request.getParameterValues("billcheckbox");

if( checkboxvalue != null ) {

  // FOR schleife

}

else {

  //kein parameter verfügbar

}

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.