473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

[?] Struts looses authenticate informations ?

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
---
Jul 17 '05 #1
1 2265
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();
"Moreno" <mo******@yahoo.com> wrote in message news:<bg**********@adenine.netfront.net>...
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
---

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Cedric | last post by:
Hello, I'm developping my first Struts application. I've got this error: Cannot find message resources under key org.apache.struts.action.MESSAGE web.xml <servlet>...
4
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
3
by: Sharon | last post by:
Hi guys , What is the apache struts equivalent in the .net world ? (if any ..) Thank you Sharon
1
by: nithiya sri | last post by:
i am new to struts.I try running struts application in Eclipse with the tomcat plug in .. it shows the following error:; please help me in this... SEVERE: Error loading WebappClassLoader ...
3
by: shanmukhi | last post by:
hi all, i got a problem with struts. iam unable to find it. i have written an action class, form bean class and a jsp page on submitting form, request is going to action class but it is not...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
8
by: ajos | last post by:
hi frnds, the situation is im developing a web application in struts-- my specifications-eclipse3.2.2,struts1.1,tomcat5.5.23 mysql5.0 db. the scenario-i have a jsp page which adds the...
1
by: NamelessNumberheadMan | last post by:
I can't seem to get Struts 2 validations to work. I have been converting from Strust 1 to Struts 2. So far I've refactored all the code (for this particular module) on the back end, rewrote the jsp...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.