Please Help! Unable to Pass A Hidden Field To scaffold.ProcessAction

2003-12-07 Thread Caroline Jen
I want to pass two hidden fields; username and keyName
from a JSP via a SUBMIT button:



<% String username = request.getRemoteUser();%>


View Articles



and an action mapping:


   


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/

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



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

2003-12-07 Thread Richard Yee
Are you using the  or html:hidden attributes? I 
didn't see it in your email.
If you do, the values will be available in the request.

Regards,

Richard

At 08:20 PM 12/7/2003, you 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: 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/ 
- To 
unsubscribe, e-mail: [EMAIL PROTECTED] For 
additional commands, e-mail: [EMAIL PROTECTED]


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


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

2003-12-07 Thread Caroline Jen
My code was shown in my original message.  I used two 
 tags to pass two hidden fields, one
is successfully passed while the other shows null.  By
the way, I do not use 'request' to retrieve the value
of the hidden field because my Java class is a
scaffold.ProcessAction type.  I simply use getXxx.

Let me show my code again:


<% String username = request.getRemoteUser();%>


View Articles



--- Richard Yee <[EMAIL PROTECTED]> wrote:
> Are you using the  or
> html:hidden attributes? I 
> didn't see it in your email.
> If you do, the values will be available in the
> request.
> 
> Regards,
> 
> Richard
> 
> At 08:20 PM 12/7/2003, you 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: 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/ 
>
>-
> To 
> >unsubscribe, e-mail:
> [EMAIL PROTECTED] For 
> >additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__
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]



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

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



<% String username = request.getRemoteUser();%>


View Articles



and an action mapping:


   


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:
> 
> 
> 
> <% 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 );
> 
>} // end execute
> 
> } // End FindEditorData
> 
> 
> 
> __
> 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]
> 


__
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]



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

2003-12-09 Thread Adam Hardy
Hi Caroline,
have you checked the source of the HTML page in the browser to see what 
the value of username is, client-side? I expect the value is being sent 
to the browser as null.

If that is the case, it is because request.getRemoteUser() is returning 
null and that would be because you don't have or are losing your login 
session.

Adam

On 12/08/2003 10:32 PM Caroline Jen wrote:
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:



<% String username = request.getRemoteUser();%>


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 <[EMAIL PROTECTED]> wrote:

I want to pass two hidden fields; username and
keyName
from a JSP via a SUBMIT button:


<% String username = request.getRemoteUser();%>


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">
  
   
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



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