Java
1//これはサーブレットクラスです 2//変数の初期化 3String name = null; 4String kananame = null; 5String sex = null; 6String year = null; 7String month = null; 8String day = null; 9String birthOfDate = null; 10String id = null; 11String pass = null; 12 13//値の正確性が確保できたら以下のようにセッションい保存します。 14session.setAttribute("name", name); 15session.setAttribute("kananame", kananame); 16session.setAttribute("sex", sex); 17session.setAttribute("year", year); 18session.setAttribute("month", month); 19session.setAttribute("day", day); 20session.setAttribute("birthOfDate", birthOfDate); 21session.setAttribute("id", id); 22session.setAttribute("pass", pass); 23System.out.println("You've reached here");
JSP
1//スクリプトレットのみの抜粋です。 2<%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 5 <%@ page import="java.lang.String"%> 6 7<%-- <%@include file="../css/style.css" %> --%> 8 9<% 10 11String year = (String) request.getAttribute("year"); 12String month = (String) request.getAttribute("month"); 13String day = (String) request.getAttribute("day"); 14String birth = year + "/" + month + "/" + day; 15 16%>
問題このJSPファイル内のスクリプトで変数birthを出力すると"null/null/null"と表示されます。
問題は何でしょうか。importの問題ですか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/12 12:27