-
1. Re: Can I capture the J_username when FORM of AUTH is submit
l.g. Aug 2, 2002 5:55 PM (in response to dudoes)See attachment
-
2. Re: Can I capture the J_username when FORM of AUTH is submit
dudoes Aug 3, 2002 4:43 PM (in response to dudoes)Think you, L.G.
I can the user's name and other info from UserId.
I can redirect the pages, but the Next Page can't received Session attributes setted before.
How can I share Session attriute among each pages of .wars?
Sorry, I need your help again.
BELOW IS PAGE FILE
======================
<%@page session="true" %>
<%request.setCharacterEncoding("GB2312");%>
<jsp:useBean id="eQ" scope="page" class="com.rongji.hrm.employee.EmployeeQuery"/>
<%
String userId = (String)session.getAttribute("j_username");
System.out.println("UserId is ..............."+userId);
String username = eQ.getEmployeeName(userId);
System.out.println("Username is................."+username);
session.setAttribute("userId",userId);
session.setAttribute("username",username);
%>
Untitled Document
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
String url = response.encodeURL("/applicant/index.jsp");
%>
URL
\
====================
I try "response.sendRedirect(response.encodeRedirectURL("/applicant/index.jsp"))"
but it can't work. -
3. Re: Can I capture the J_username when FORM of AUTH is submit
l.g. Aug 5, 2002 4:21 PM (in response to dudoes)Make sure the page you redirect to has this line
<%@page session="true" %> -
4. Re: Can I capture the J_username when FORM of AUTH is submit
dudoes Aug 6, 2002 12:48 AM (in response to dudoes)Yes, I do it, but It don't work.
-
5. Re: Can I capture the J_username when FORM of AUTH is submit
l.g. Aug 6, 2002 11:50 AM (in response to dudoes)Are you using
<%String name = (String)session.getAttribute("username");%>
and this does not return anything? Very strange.
Anyway, you can try:
<%
String url = response.encodeURL("/applicant/index.jsp?usernae=username&userId=userId");
%>
URL -
6. Re: Can I capture the J_username when FORM of AUTH is submit
l.g. Aug 6, 2002 11:51 AM (in response to dudoes)Are you using
<%String name = (String)session.getAttribute("username");%>
and this does not return anything? Very strange.
Anyway, you can try:
<%
String url = response.encodeURL("/applicant/index.jsp?usernae=username&userId=userId");
%>
URL -
7. Re: Can I capture the J_username when FORM of AUTH is submit
dudoes Aug 7, 2002 12:19 AM (in response to dudoes)Thinks, L.G.
My application have several .war,one is Root.war, and the other are applicant.war,contract.war,etc.
I login system by JAAS in Root.war, and get user's informations from database.These infos should stores as session's attributes for other .war, for example,applicant.war, to be shared.
so, I session.setAttribute("username",username) in Root.war,
but (String)session.getAttribute("username") is null in applicant.war.
In other words, I think Session can't transfer its values from a .war to another, and you?
I am sure
<%
String url = response.encodeURL("/applicant/index.jsp?usernae=username&userId=userId");
%>
must run well, but it isn't through SESSION.
when I pack my application to a single Root.war which includes all .jsp files from applicant.war,contract.war,etc , SESSION have no problem,
(String)session.getAttribute("username") return a useful value.
My workfellow have the same question as me.
you can refer my speaking to myself:
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ -
8. Re: Can I capture the J_username when FORM of AUTH is submit
l.g. Aug 7, 2002 12:31 PM (in response to dudoes)I don't think you can have the same session in different applications.
-
9. Re: Can I capture the J_username when FORM of AUTH is submit
dudoes Aug 7, 2002 1:38 PM (in response to dudoes)You means every .war is a single application?
do You "agree" with me or sun? -
10. Re: Can I capture the J_username when FORM of AUTH is submit
l.g. Aug 8, 2002 11:40 AM (in response to dudoes)In servlet-2.3 spec SRV.7.3.:
...
if a servlet uses the
RequestDispatcher to call a servlet in another web application, any sessions
created for and visible to the callee servlet must be different from those visible to
the calling servlet.