[?] Struts looses authenticate informations ?

M

Moreno

Hi,

I'm trying to make my first struts application and I'm fighting with
authentication and roles.

I've only one jsp page (index.jsp) that prints authentication type ("BASIC")
and user roles.
<%
authentication+="Authentication " + request.getAuthType();

if (request.isUserInRole("ADMIN")) { role += "ADMIN; " ; }
if (request.isUserInRole("USER")) { role += "USER; " ; }
%>
<br>----------------------------------------------------
<br><%= authentication %>
<br><%= "ROLES : " + role %>
<br>----------------------------------------------------
<br>

Then there's an empty form with a "submit" button.

<html:form action="/index">
<html:submit value="SUBMIT" />
</html:form>


the execute method in action is the following :

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {

String forward = "index";
return mapping.findForward(forward);
}


When I enter my application the first time it shows exactly authentication
BASIC and ROLES : ADMIN
but when I press "submit" it shows "authentication NULL" and "ROLES : "


I'm using tomcat 4.1.18 (I also tried .24 and .27 !) and struts 1.1

WHERE' S THE ERROR ??

Thanks


---
 
H

Himalia

Hi Moreno

I think the reson your getting empty values the second time around is
beacuse your setting them in request and so they get lost on the
second retrive!

I suggest you put them in session, that way the values can be
retrieved as many times as you want it to be :)

ie
session.setAuthType();
and
session.getAuthType();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top