I use container-managed authentication.
--- "Yee, Richard K,,DMDCWEST" <[EMAIL PROTECTED]> wrote: > Caroline, > Imposible? Look at the HTML that is generated by the > JSP page. I think you > will see that it returns "null". > Take a look at the JavaDoc for > HttpServletRequest.getRemoteUser(); > > getRemoteUser > public java.lang.String getRemoteUser() > Returns the login of the user making this request, > if the user has been > authenticated, or null if the user has not been > authenticated. Whether the > user name is sent with each subsequent request > depends on the browser and > type of authentication. Same as the value of the CGI > variable REMOTE_USER. > > Returns: a String specifying the login of the user > making this request, or > null > > As the JavaDoc says: "Whether the user name is sent > with each subsequent > request depends on the browser and type of > authentication." Are you using > basic authentication or are you authenticating the > user yourself? > If you are doing it yourself (ie. through a db > lookup) then the server > doesn't know about the user being authenticated and > will return null. > > Regards, > > Richard > -----Original Message----- > From: Caroline Jen [mailto:[EMAIL PROTECTED] > Sent: Monday, December 08, 2003 2:56 PM > To: Struts Users Mailing List > Subject: RE: Please Help! Unable to Pass A Hidden > Field To scaffold.Proces > sAction > > > I pass two hidden fields: username and keyName at > the > same time. The keyName is passed and with the > correct > value in it. The username is passed but its value > turns out to be a null. > > It is impossible for request.getRemoteUser(); in my > JSP returning a null. (see code below) Before it > reaches request.getRemoteUser(); the user has > already > been successfully logged in with a valid name. > > <req:isUserInRole role="editor"> > <html:form action="/find/Category"> > <TR> > <TD class="option"> > <% String username = request.getRemoteUser();%> > <html:hidden property="keyName" > value="journal_category"/> > <html:hidden property="username" > value="<%=username%>"/> > <html:submit>View Articles</html:submit> > </TD> > </TR> > </html:form> > </req:isUserInRole> > --- "Yee, Richard K,,DMDCWEST" > <[EMAIL PROTECTED]> wrote: > > Caroline, > > Are you having problems with the username or the > > keyName hidden variable? If > > it is the username, then I'd suspect that > > request.getRemoteUser() in your > > JSP is returning null. > > > > Regards, > > > > Richard > > > > -----Original Message----- > > From: Caroline Jen [mailto:[EMAIL PROTECTED] > > Sent: Monday, December 08, 2003 1:32 PM > > To: Struts Users Mailing List > > Subject: Re: Please Help! Unable to Pass A Hidden > > Field To > > scaffold.ProcessAction > > > > > > I did not mess up lowercase and uppercase of the > > hidden field I want to pass from my JSP to the > scaffold.ProcessAction. > > If it had been the lowercase/uppercase problem, I > would > > have gotten a message > > saying that the variable could not be recognized. > > > > > I pass two hidden fields at the same time. One of > > them is successfully passed with correct value. > The > > other is passed but its value shows a 'null' in > the > > scaffold.ProcessAction. What could go wrong? Let > me show my code > > again: > > > > Two hidden fields: username and keyName are passed > > from a JSP via a SUBMIT button: > > > > <req:isUserInRole role="editor"> > > <html:form action="/find/Category"> > > <% String username = request.getRemoteUser();%> > > <html:hidden property="keyName" > > value="journal_category"/> > > <html:hidden property="username" > > value="<%=username%>"/> > > <html:submit>View Articles</html:submit> > > </html:form> > > </req:isUserInRole> > > > > and an action mapping: > > > > <action > > roles="editor" > > path="/find/Category" > > > > type="org.apache.struts.scaffold.ProcessAction" > > > > > parameter="org.apache.artimus.article.FindEditorData" > > name="articleForm" > > scope="request" > > validate="false"> > > <forward > > name="success" > > path=".article.Result"/> > > </action> > > > > The value of the 'username' is found to be a > 'null' > > in > > the FindEditorData.java while the value of keyName > > is successfully > > retrieved. In the browser, I got: > > > > name=null; kn=journal_category; kv=null > > > > The code of my FindEditorData is shown below: > > > > public final class FindEditorData extends Bean > > { > > public Object execute() throws Exception > > { > > > > // Obtain username > > String username = getUsername(); > > > > EditorService service = new EditorService(); > > String value = service.findEditorData( username > > ); > > > > String property = getKeyName(); > > > > if (( null==property ) || ( null==value )) > > > { > > StringBuffer sb = new StringBuffer(); > > sb.append( "name=" ); > > sb.append( username ); > > sb.append( "; kn=" ); > > sb.append( property ); > > sb.append( "; kv=" ); > > sb.append( value ); > > throw new ParameterException( > > sb.toString() ); > > } > > > > ResultList list = new ResultListBase > > ( > > > > Access.findByProperty( > > this,property,value > > ) > > > > ); > > list.setLegend( property,value ); > > > > return new ProcessResultBase( list ); > > > > } // end execute > > > > } // End FindEditorData > > > > > > > === message truncated === __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]