Caroline,
As a sanity check, in your bean, initialize the
username variable to something ie. "XXXXXX". and
re-run your app. This will show if your setUsername is
ever called.
-Richard
--- Caroline Jen <[EMAIL PROTECTED]> wrote:
> I do not fully understand what you say about null or
> "null". Anyway, I did try to write out values in
> the
> FindEditorData.java. What is written out in the
> browser is:
>
> name=null; kn=journal_category; kv=null
>
> And the way I try to write out those crucial fields
> is
> shown below:
>
> // package and import statements omitted
> 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
>
> --- Richard Yee <[EMAIL PROTECTED]> wrote:
> > Caroline,
> > In your FindEditorData.java class, is the value
> for
> > your username variable null or "null"? If it is
> > null,
> > then you are reading the wrong request parameter
> > since
> > request.getParameter() will return null if the
> > parameter doesn't exist. If the String value is
> > "null", then you have a problem with
> getRemoteUser()
> > Why don't you dump request parameters that you are
> > getting in your FindEditorData?
> >
> > Hidden input tags work fine.
> >
> > Regards,
> >
> > Richard
> > --- Caroline Jen <[EMAIL PROTECTED]> wrote:
> > > Hi, I think that we are in different time zones.
> > >
> > > As you have mentioned, I, too, suspected that
> the
> > > statement in my JSP:
> > >
> > > request.getRemoteUser();
> > >
> > > returns nothing. Therefore, I did a test in my
> > JSP.
> > >
> > > In addition to request.getRemoteUser(); I
> created
> > > another String manually:
> > >
> > > <req:isUserInRole role="editor">
> > > <%
> > > String username = request.getRemoteUser();
> > > String userrole = "author";
> > > %>
> > > <% out.println("The user name is: " + username
> > > +".");
> > > %>
> > > <% out.println("The role is: " + userrole +".");
> > %>
> > > </req:isUserInRole>
> > >
> > > And the browser shows:
> > >
> > > The user name is: Gloria Jen. The role is:
> > author.
> > >
> > > Gloria Jen is the name that I provided while
> > logging
> > > on and authenticated by the container.
> Therefore,
> > > the
> > > request.getRemoteUser(); does not return a null.
>
> > > And
> > > I hope that it means I am not passing a null
> value
> > > when I use the hidden field technique.
> > >
> > > Then, I pass two hidden fields (with value in
> > them)
> > > from my JSP to a Java class
> (FindEditorData.java),
> > > which is of scaffold.ProcessAction type. One of
> > the
> > > field is passed with its value correctly
> > retrieved.
> > > The other field is passed with its value found
> to
> > be
> > > null.
> > >
> > > What could go wrong? I have been thinking about
> > it
> > > for days and so do those who try to help me.
> > >
> > > <req:isUserInRole role="editor">
> > > <html:form action="/find/Category">
> > > <%
> > > String username = request.getRemoteUser();
> > > String userrole = "author";
> > > %>
> > > <%out.println("The user name is: " + username
> > > +".");%>
> > > <%out.println("The role is: " + userrole
> +".");%>
> > > <html:hidden property="keyName"
> > > value="journal_category"/>
> > > <html:hidden property="username"
> > > value="<%=username%>"/>
> > > <html:submit>View Articles</html:submit>
> > > </html:form>
> > > </req:isUserInRole>
> > >
> > > -Caroline
> > > --- "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
>
=== message truncated ===
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]