Re: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Adam Hardy
Rats, the thread broke, hence my other reply. Like everyone says, you 
need to check the return value of getRemoteUser() - try looking at the 
value of the hidden field in the HTML via IE's 'Show page source'.

On 12/08/2003 11:55 PM Caroline Jen wrote:
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:submitView 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:submitView 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
 

--- Caroline Jen [EMAIL PROTECTED] wrote:

I want to pass two hidden fields; username and
keyName
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:submitView 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
How come the username is not passed to the
FindEditorData.java while 

the keyName is successfully
passed.  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( 

Re: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Paul Thomas
On 09/12/2003 01:29 Caroline Jen wrote:
I use container-managed authentication.
In which case, why don't you get the user name using 
request.getUserPrincipal().getName() ?

--
Paul Thomas
+--+-+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants | 
http://www.thomas-micro-systems-ltd.co.uk   |
+--+-+

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Caroline Jen
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:submitView 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
 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:submitView 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
  

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Richard Yee
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:submitView 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
  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:submitView 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 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Caroline Jen
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:submitView 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
   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
   

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Richard Yee
Caroline,
As a sanity check, in your bean, initialize the
username variable to something ie. XX. 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:submitView 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 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Caroline Jen
I followed your advice.  In the Bean.java, I did the
following:

private String username = natalie;
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}

and I compiled all the relevant classes, re-run the
application, the FindEditorData.java writes out the
following in the browser:

The process did not complete. Details should follow. 
name=natalie; kn=journal_category; kv=null 

Now, the question is why the Bean.java does not pick
up the value of the hidden field 'username' from my
JSP while successfully picks up the value of the other
hidden field 'keyName'.

There is some data processing activities going on in
the FindEditorData.java:

   String username = getUsername();
   EditorService service = new EditorService();
   String value = service.findEditorData( username );

The above data accessing codes had been tested outside
the environment of the application (the codes did what
I expected them to do without problem) before they
were integrated into the application.

-Caroline
--- Richard Yee [EMAIL PROTECTED] wrote:
 Caroline,
 As a sanity check, in your bean, initialize the
 username variable to something ie. XX. 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 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-09 Thread Caroline Jen
I did another test.  I took out those data access
activities in the FindEditorData.java and ran the
application.  The conclusion is that those few lines
of data access activities have nothing to do with the
value of the 'username' becoming null in the
FindEditorData.java.

-Caroline
--- Richard Yee [EMAIL PROTECTED] wrote:
 Caroline,
 As a sanity check, in your bean, initialize the
 username variable to something ie. XX. 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:submitView 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
 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Yee, Richard K,,DMDCWEST
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:submitView 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
  


--- Caroline Jen [EMAIL PROTECTED] wrote:
 I want to pass two hidden fields; username and
 keyName
 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:submitView 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
 
 How come the username is not passed to the FindEditorData.java while 
 the keyName is successfully
 passed.  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
 
 
 
 __
 Do you Yahoo!?
 New Yahoo! Photos - easier uploading and sharing. 
 http://photos.yahoo.com/
 


RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Caroline Jen
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:submitView 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:submitView 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
   
 
 
 --- Caroline Jen [EMAIL PROTECTED] wrote:
  I want to pass two hidden fields; username and
  keyName
  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:submitView 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
  
  How come the username is not passed to the
 FindEditorData.java while 
  the keyName is successfully
  passed.  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();
 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Yee, Richard K,,DMDCWEST
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:submitView 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:submitView 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
   
 
 
 --- Caroline Jen [EMAIL PROTECTED] wrote:
  I want to pass two hidden fields; 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Caroline Jen
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:submitView 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:submitView 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
  (
  
  

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Richard Yee
Caroline,
Did you check the result of getRemoteUser(). Does it return null or null? 
If so, it's not a problem with your hidden form variables,.

-Richard

At 05:29 PM 12/8/2003, you wrote:
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:submitView 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:submitView 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(
 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Richard Yee
Caroline,
Why are you passing the result of request.getRemoteUser() in a hidden 
variable anyway since it is available as part of the HttpRequest and thus 
will be available in the action class?

-Richard

At 02:55 PM 12/8/2003, you wrote:
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
% String username = request.getRemoteUser();% value=journal_category/ 
value=%=username%/ View Articles
--- Yee, Richard K,,DMDCWEST 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.ProcessActionI 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: % String 
username = request.getRemoteUser();%  value=journal_category/  
value=%=username%/  View Articles and an action mapping:   
roles=editor  path=/find/Category   
type=org.apache.struts.scaffold.ProcessAction   
parameter=org.apache.artimus.article.FindEditorData  
name=articleForm  scope=request  validate=false  
name=success  path=.article.Result/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 --- Caroline Jen wrote:   I want to pass two 
hidden fields; username and   keyName   from a JSP via a SUBMIT 
button: % String username = 
request.getRemoteUser();%value=journal_category/
value=%=username%/   View Articles and an action 
mapping:  roles=editor   path=/find/Category 
type=org.apache.struts.scaffold.ProcessAction  
parameter=org.apache.artimus.article.FindEditorData   
name=articleForm   scope=request   validate=false
name=success   path=.article.Result/   How come the 
username is not passed to the  FindEditorData.java while   the keyName 
is successfully   passed. 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 );  === message truncated === 
__ Do you Yahoo!? New Yahoo! Photos - 
easier uploading and sharing. http://photos.yahoo.com/ 
- 

RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Caroline Jen
I must pass the result of request.getRemoteUser()
because it is a Java class that receives the
hidden field.  If you read my code carefully, you will
see that FindEditorData.java is a Java class and I
cannot use 'request' or 'session' in a Java class.  It
takes a servlet or a class extends Action to use
'request' or 'session'.

But, this class is of ProcessAction type defined in
the struts-config.xml:

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

And, it is easy to see that I use container-managed
authentication.  In my JSP, there is req:isUserInRole
role=editor before reaching % String
username=request.getRemoteUser(); % Again, I have
provided my code:
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:submitView Articles/html:submit
/html:form
/req:isUserInRole

--- Richard Yee [EMAIL PROTECTED] wrote:
 Caroline,
 Why are you passing the result of
 request.getRemoteUser() in a hidden 
 variable anyway since it is available as part of the
 HttpRequest and thus 
 will be available in the action class?
 
 -Richard
 
 At 02:55 PM 12/8/2003, you wrote:
 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
 % String username = request.getRemoteUser();%
 value=journal_category/ 
 value=%=username%/ View Articles
 --- Yee, Richard K,,DMDCWEST 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.ProcessActionI 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: % String 
 username = request.getRemoteUser();% 
 value=journal_category/  
 value=%=username%/  View Articles and
 an action mapping:   
 roles=editor  path=/find/Category   
 type=org.apache.struts.scaffold.ProcessAction  
 

parameter=org.apache.artimus.article.FindEditorData
  
 name=articleForm  scope=request 
 validate=false  
 name=success  path=.article.Result/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 --- Caroline Jen wrote:  
 I want to pass two 
 hidden fields; username and   keyName   from a
 JSP via a SUBMIT 
 button: % String username = 
 request.getRemoteUser();%   
 value=journal_category/
 value=%=username%/   View Articles 
and an action 
 mapping:  roles=editor  
 path=/find/Category 
 type=org.apache.struts.scaffold.ProcessAction  



RE: Please Help! Unable to Pass A Hidden Field To scaffold.Proces sAction

2003-12-08 Thread Richard Yee
Caroline,
What is the return value of getRemoteUser() ?
-Richard

At 07:38 PM 12/8/2003, you wrote:
I must pass the result of request.getRemoteUser()
because it is a Java class that receives the
hidden field.  If you read my code carefully, you will
see that FindEditorData.java is a Java class and I
cannot use 'request' or 'session' in a Java class.  It
takes a servlet or a class extends Action to use
'request' or 'session'.
But, this class is of ProcessAction type defined in
the struts-config.xml:
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
And, it is easy to see that I use container-managed
authentication.  In my JSP, there is req:isUserInRole
role=editor before reaching % String
username=request.getRemoteUser(); % Again, I have
provided my code:
req:isUserInRole role=editor
% String username = request.getRemoteUser(); % 
value=journal_category/ value=%=username%/ View Articles --- 
Richard Yee wrote:  Caroline,  Why are you passing the result of  
request.getRemoteUser() in a hidden  variable anyway since it is 
available as part of the  HttpRequest and thus  will be available in the 
action class?   -Richard   At 02:55 PM 12/8/2003, you wrote:  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.  % 
String username = request.getRemoteUser();%  
value=journal_category/  value=%=username%/ View Articles  --- 
Yee, Richard K,,DMDCWEST 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.ProcessActionI 
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: % String  username = 
request.getRemoteUser();%   
value=journal_category/   value=%=username%/  View 
Articles and  an action mapping:roles=editor  
path=/find/Categorytype=org.apache.struts.scaffold.ProcessAction 
 parameter=org.apache.artimus.article.FindEditorDatanam 
e=articleForm  scope=request   
validate=false   name=success  path=.article.Result/
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=nullThe 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 --- Caroline Jen 
wrote:I want to pass two  hidden fields; username and   
keyName   from a  JSP via a SUBMIT  button: % String 
username =  request.getRemoteUser();% 
value=journal_category/ value=%=username%/   View 
Articles  and an action  mapping:  
roles=editor
path=/find/Category  type=org.apache.struts.scaffold.ProcessAc 
tionparameter=org.apache.artimus.article.FindEditorData  
name=articleForm   scope=request