第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

我可以在 html 頁面中訪問由 servlet 創(chuàng)建的 cookie 嗎?

我可以在 html 頁面中訪問由 servlet 創(chuàng)建的 cookie 嗎?

德瑪西亞99 2023-02-23 16:28:27
我正在嘗試創(chuàng)建一個(gè)需要所有頁面中的用戶 ID 的預(yù)訂表格。我想知道當(dāng)我將頁面重定向?yàn)?[HTML->servlet->HTML] 時(shí)如何處理會(huì)話
查看完整描述

1 回答

?
慕仙森

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超8個(gè)贊

您可以使用HttpSession.setAttribute?&?HttpSession.getAttribute例如:

JSP 頁面:


? ? ? ?//getting id value?

? ? ? ? String id= request.getParameter("user_id");

? ? ? ? //the variable which is set in session scope you can use anywhere?

? ? ? ? ?request.getSession().setAttribute("id",id);

? ? ? ? ? request.getRequestDispatcher("/yourServleturl").forward(request,response);

現(xiàn)在要獲取該session屬性,如下所示servlet:


? ?HttpSession session=request.getSession();

? ? ? //getting value in session

? ? String id=session.getAttribute("id").toString();

? ? //do further processing

希望這可以幫助 !


查看完整回答
反對(duì) 回復(fù) 2023-02-23
  • 1 回答
  • 0 關(guān)注
  • 75 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)