我已經成功實現了基於表單的身份驗證,現在我想從servlet中獲取用於在javamail中初始化會話對象的用戶名和密碼。我怎樣才能做到這一點?我可以使用方法request.getRemoteUser()獲取登錄用戶名,但我不知道如何獲取密碼。如何在servlets中獲取登錄密碼
如果我創建像任何會話對象:
authentication = new PasswordAuthentication(user,password);
Properties props = new Properties();
props.put("mail.host", "localhost");
props.put("mail.debug",true);
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
Session session = Session.getInstance(props, this);
那麼我怎樣才能根據特定的用戶名和密碼,從郵件服務器的郵件收件箱,如果我不通過從servlet來的PasswordAuthentication對象的任何密碼?