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.

JSP(sessionObjekt)

Empfohlene Antworten

Veröffentlicht


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page language="java" contentType="text/html; charset=ISO-8859-1"

	pageEncoding="ISO-8859-1"%>


<%	String eingabeTextBox = request.getParameter("txtBox");

	String wort = (String)session.getAttribute("wort");

%>



<html>

<head>

<title>_SessionTest</title>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<meta name="GENERATOR"

	content="WebSphere Development Studio Client for iSeries">

</head>

<body>

<form action='<%= response.encodeURL("_SessionTest.jsp") %>'></form>


	<%	if(wort == null){

			session.setAttribute("wort", eingabeTextBox);		

		}

		else{

			wort = (String)session.getAttribute("wort");

		}

	%>


Bitte geben sie ein Wort ein: 

                          <input type="text" name="txtBox" value="test"/>

    		<input type="submit" value="Senden" /><br>

		<input type="text" name="ergebnis2" value="<%= wort %>" />

</body>

</html>

Huhu,

ich möchte gerne die Eingabe in der 1. TextBox in ein Session-Objekt speichern und das beim nächsten request in der 2. TextBox ausgeben.

Funktioniert leider nicht!

Gruß Alex

Deine Input-Felder müssen zumindest schon mal mit zwischen die form-Tags.

Was macht der else-Zweig im zweiten Script-Block? Doch das selbe wie die zweite Zeile im ersten Block, oder? Die kannst Du Dir sparen.

das inputfeld der zweiten textbox ist doch zwischen den tags <%=wort%>

Servus,

ich meine keine JSP-Notation, sondern einfach einen HTML-Felder. Nur Input-Felder, die innerhalb eines <form></form> stehen, gehören zu diesem Formular.

Bei Dir sieht das Formular aber so aus:

<form action='<%= response.encodeURL("_SessionTest.jsp") %>'></form>
Da ist nichts drin. Ich bezweifle deshalb, das das Formular überhaupt abgesendet werden kann.

Peter

ui alles klar, habe ich nicht gesehen ! :)

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.