Is Hidden Field Passed As a String?

2003-12-23 Thread Caroline Jen
I am passing a hidden field from my JSP to my form
bean:



Is the property "parent" considered a String in the
form bean?  Do I have to use 

BeanUtils.copyProperties( postDTO, postForm );

to convert that property to a primitive type int?

__
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: How To Output the Value Of a Hidden Field?

2003-12-17 Thread Robert Taylor
There are a couple (3) ways to do it.

1. Have both JSP#1 and 2 use the same form then have the action that
processes JSP#1 simply
forward to JSP#2 and Struts will auto-populate the field.

2. Have the action that processes JSP#1 forward or redirect to
   JSP#2 whose form has the same property name. Place the create property
   value in the query string and Struts will auto-populate the form
   in JSP#2.

3. Have the action that processes JSP#1 access and populate the form used
   in JSP#2 with the property then forward to JSP#2.

robert

> -Original Message-
> From: Caroline Jen [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 16, 2003 8:33 PM
> To: [EMAIL PROTECTED]
> Subject: How To Output the Value Of a Hidden Field?
>
>
> My JSP #2 receives a hidden field passed from JSP #1:
> 
>
> In the JSP #2, I have a text field:
>  tabindex="1"/>
>
> and I want the value of the hidden field to be the
> text in the text field of the JSP #2.  Please advise
> how to do it?
>
> __
> 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: How To Output the Value Of a Hidden Field?

2003-12-17 Thread Koni Roth
You cannot have two properties with the same name in a form.
Try:

" size="82" maxlength="25" tabindex="1"/>

cheers
Koni
Caroline Jen wrote:

My JSP #2 receives a hidden field passed from JSP #1:

In the JSP #2, I have a text field:

and I want the value of the hidden field to be the
text in the text field of the JSP #2.  Please advise
how to do it?
__
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]


How To Output the Value Of a Hidden Field?

2003-12-16 Thread Caroline Jen
My JSP #2 receives a hidden field passed from JSP #1:


In the JSP #2, I have a text field:


and I want the value of the hidden field to be the
text in the text field of the JSP #2.  Please advise
how to do it?

__
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: Hidden Field

2003-12-16 Thread Ben Janes

Wouldn't


be a better use


Mvh
Benjamin A. Janes

BLUEWAVE SVERIGE

M. +46 (0)40-631 1068
F. +46 (0)40 -631 10 50
F. +46 (0)46-540 03 50
Drottninggatan 18,
S-211 49 Malmö,
Sweden


|-+>
| |   "Jitesh Sinha"   |
| |   <[EMAIL PROTECTED]|
| |   >|
| ||
| |   2003-12-16 09:01 |
| |   Please respond to|
| |   "Struts Users|
| |   Mailing List"|
|-+>
  
>--|
  |
  |
  |   To:   "Struts Users Mailing List" <[EMAIL PROTECTED]>
 |
  |   cc:  
      |
  |   Subject:  RE: Hidden Field   
  |
  
>--|




Caroline, put  just after your definition so correct statement
is :


-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 1:15 PM
To: [EMAIL PROTECTED]
Subject: Hidden Field


I tried to create a variable, assign a value to that
variable, and pass the variable as a hidden field.
What I did was:



Why do I get this error message in the browser?
'According to TLD, tag html:hidden must be empty, but
is not'

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






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



RE: Hidden Field

2003-12-16 Thread Jitesh Sinha
Caroline, put  just after your definition so correct statement
is :


-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 1:15 PM
To: [EMAIL PROTECTED]
Subject: Hidden Field


I tried to create a variable, assign a value to that
variable, and pass the variable as a hidden field.
What I did was:



Why do I get this error message in the browser?
'According to TLD, tag html:hidden must be empty, but
is not'

__
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: Hidden Field

2003-12-16 Thread Aswathy R
Try


Close the tag and try.

-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 1:15 PM
To: [EMAIL PROTECTED]
Subject: Hidden Field


I tried to create a variable, assign a value to that
variable, and pass the variable as a hidden field. 
What I did was:



Why do I get this error message in the browser?
'According to TLD, tag html:hidden must be empty, but
is not'

__
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: Hidden Field

2003-12-16 Thread Budi Rostiarso
quick answer: 
you didn't put the closing tag,



-Original Message-
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 2:45 PM
To: [EMAIL PROTECTED]
Subject: Hidden Field


I tried to create a variable, assign a value to that
variable, and pass the variable as a hidden field. 
What I did was:



Why do I get this error message in the browser?
'According to TLD, tag html:hidden must be empty, but
is not'

__
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: Hidden Field

2003-12-16 Thread Nicklas Karlsson
On Mon, 15 Dec 2003, Caroline Jen wrote:

> Why do I get this error message in the browser?
> 'According to TLD, tag html:hidden must be empty, but
> is not'

Sounds like a classic no /> at end of tag. It is bodyless but now thinks 
the remaining part of the code is within a body...

---
Nicklas "Nik" Karlsson, Murkiogatan 3 B 29 20740 Åbo, 040 9000 724
[EMAIL PROTECTED] ::: http://www.abo.fi/~nickarls ::: [EMAIL PROTECTED]

"If a man speaks in the forest and there is no woman around to hear him -
 Is he still wrong?"


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



Hidden Field

2003-12-16 Thread Caroline Jen
I tried to create a variable, assign a value to that
variable, and pass the variable as a hidden field. 
What I did was:



Why do I get this error message in the browser?
'According to TLD, tag html:hidden must be empty, but
is not'

__
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.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:
> > > > 
> > > > 
> > > > <% 
> > > >String username = request.getRemoteUser(); 
> > > >String userrole = "author"; 
> > > > %>   
> > > > <% out.println("The user name is: " + username
> > > > +".");
> > > > %>
> > > > <% out.println("The role is: " + userrole
> +".");
> > > %>
> > > > 
> > > > 
> > > > 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 ho

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:
> > > > 
> > > > 
> > > > <% 
> > > >String username = request.getRemoteUser(); 
> > > >String userrole = "a

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:
> > > 
> > > 
> > > <% 
> > >String username = request.getRemoteUser(); 
> > >String userrole = "author"; 
> > > %>   
> > > <% out.println("The user name is: " + username
> > > +".");
> > > %>
> > > <% out.println("The role is: " + userrole +".");
> > %>
> > > 
> > > 
> > > 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.  
> > > 
> > > 
> > > 
> > > <% 
> > >String username = request.getRemoteUser(); 
> > >String userrole = "author"; 
> > > %>   
> > > <%out.println("The user name is: " + username
> > > +".");%>
> > &

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:
> > 
> > 
> > <% 
> >String username = request.getRemoteUser(); 
> >String userrole = "author"; 
> > %>   
> > <% out.println("The user name is: " + username
> > +".");
> > %>
> > <% out.println("The role is: " + userrole +".");
> %>
> > 
> > 
> > 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.  
> > 
> > 
> > 
> > <% 
> >String username = request.getRemoteUser(); 
> >String userrole = "author"; 
> > %>   
> > <%out.println("The user name is: " + username
> > +".");%>
> > <%out.println("The role is: " + userrole +".");%>
> >  > value="journal_category"/>
> >  > value="<%=username%>"/>
> > View Articles
> > 
> >  
> > 
> > -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-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:
> 
> 
> <% 
>String username = request.getRemoteUser(); 
>String userrole = "author"; 
> %>   
> <% out.println("The user name is: " + username
> +".");
> %>
> <% out.println("The role is: " + userrole +"."); %>
> 
> 
> 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.  
> 
> 
> 
> <% 
>String username = request.getRemoteUser(); 
>String userrole = "author"; 
> %>   
> <%out.println("The user name is: " + username
> +".");%>
> <%out.println("The role is: " + userrole +".");%>
>  value="journal_category"/>
>  value="<%=username%>"/>
> View Articles
> 
>  
> 
> -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.
> > 
> > 
> > 
> > 
> > 
> > <% String username = request.getRemoteUser();%>
> >  > value="journal_category"/>
> >  > value="<%=use

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:


<% 
   String username = request.getRemoteUser(); 
   String userrole = "author"; 
%>   
<% out.println("The user name is: " + username +".");
%>
<% out.println("The role is: " + userrole +"."); %>


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.  



<% 
   String username = request.getRemoteUser(); 
   String userrole = "author"; 
%>   
<%out.println("The user name is: " + username +".");%>
<%out.println("The role is: " + userrole +".");%>


View Articles

 

-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.
> 
> 
> 
> 
> 
> <% String username = request.getRemoteUser();%>
>  value="journal_category"/>
>  value="<%=username%>"/>
> View Articles
> 
> 
> 
> 
> --- "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 'nu

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




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


View Articles




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



<% 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">
  
   
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 = ne

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]


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:

type="org.apache.struts.scaffold.ProcessAction"

parameter="org.apache.artimus.article.FindEditorData"
name="articleForm"
scope="request"
validate="false">
   

And, it is easy to see that I use container-managed
authentication.  In my JSP, there is 
role="editor"> before reaching <% String
username=request.getRemoteUser(); %> Again, I have
provided my code:

<% 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.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: > > > > <% 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" > > > >nam 
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=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(); > > > EditorServic

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:


   


And, it is easy to see that I use container-managed
authentication.  In my JSP, there is  before reaching <% String
username=request.getRemoteUser(); %> Again, I have
provided my code:


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


View Articles



--- 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.
> >
> >
> ><% 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.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: > > > > <% 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(

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.

<% 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.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: > > > > <% 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 > > th

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.
>
> 
> 
> 
> 
> <% String username = request.getRemoteUser();%>
>  value="journal_category"/>
>  value="<%=username%>"/>
> View Articles
> 
> 
> 
> 
> --- "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:
> >
> > 
> > 
> > <% 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

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.
> 
> 
> 
> 
> 
> <% String username = request.getRemoteUser();%>
>  value="journal_category"/>
>  value="<%=username%>"/>
> View Articles
> 
> 
> 
> 
> --- "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:
> > 
> > 
> > 
> > <% 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:
> > 
> >

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.





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


View Articles




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

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.





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


View Articles




--- "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:
> 
> 
> 
> <% 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 <[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"
> > 

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:



<% 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 unsubscrib

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


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: Hidden Field

2003-10-31 Thread Manish Singla
You may use


just a note:
you may use .

instead of
request.getRemoteUser();

Manish Singla


Caroline Jen wrote:

> 
> works well because "author" is expected literally as
> the value of a property called "dispatch".
>
> I also want to pass
> String username = request.getRemoteUser();
> as the value of a property called "keyValue".
>
> But,
> 
> or
> 
>
> gives me problems.  What is the proper way of doing it?
>
> __
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.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]



Hidden Field

2003-10-30 Thread Caroline Jen

works well because "author" is expected literally as
the value of a property called "dispatch".

I also want to pass 
String username = request.getRemoteUser(); 
as the value of a property called "keyValue".

But,

or


gives me problems.  What is the proper way of doing it?

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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



Re: Struts Validator and Hidden Field

2003-09-01 Thread Joe @ Team345
Octavia,

I bit of a guess on my part, but it sounds like you want to use the 
"requiredif" validator.  This allows a particular field to be required 
(or not) based on other fields.  The fact that this might be a hidden 
field should be, as pointed out by others, transparent to the validator. 
However, also pointed out is the most troubling question: if it is on a 
hidden field and your validation fails, what can your users possibly 
ever do to correct the situation?

Octavia Yung wrote:

Thanks for the responses, David and Wendy.

In order to determine if a particular form field is required, I need to
determine the property of another field.  Therefore, I thought it would be
best to hold this other property in a hidden field.
I have tried to validate it as any other input field, but have not had any
luck.  Any suggestions/ideas?  Thanks much!
- Original Message -
From: "Wendy Smoak" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, August 28, 2003 3:36 PM
Subject: RE: Struts Validator and Hidden Field
 

I was wondering if it is possible to validate a hidden field using the
Struts Validator framework.  If so, an example would be extremely
 

helpful.
 

Validator is a separate project in the Jakarta Commons, it's not part of
Struts proper.
Sure you could validate a hidden field, but what's the poor user supposed
   

to
 

do when you toss back an error that such-and-such field is required?  He
can't DO anything about it, the field is hidden!  (Unless perhaps there's
client side scripting setting a value when he fills in a visible field?)
I don't see it as any different than validating a text box, did you try it
and it didn't work?  By the time the request gets turned into a Form bean,
Struts doesn't know or care that the field was hidden on the HTML form it
came from.
--
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM
   



-
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: Struts Validator and Hidden Field

2003-08-29 Thread Wendy Smoak
Octavia wrote:
> I have tried to validate it as any other input field, but have not had any
luck.
> Any suggestions/ideas?  Thanks much!

You'll have to post some of your code before anyone will have any idea why
it's not working.

The Validator also logs copious amounts of info, you should be able to tell
if your rule is getting picked up from the XML file by looking in the logs.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 


Re: Struts Validator and Hidden Field

2003-08-28 Thread Octavia Yung
Thanks for the responses, David and Wendy.

In order to determine if a particular form field is required, I need to
determine the property of another field.  Therefore, I thought it would be
best to hold this other property in a hidden field.

I have tried to validate it as any other input field, but have not had any
luck.  Any suggestions/ideas?  Thanks much!


- Original Message -
From: "Wendy Smoak" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, August 28, 2003 3:36 PM
Subject: RE: Struts Validator and Hidden Field


> > I was wondering if it is possible to validate a hidden field using the
> > Struts Validator framework.  If so, an example would be extremely
helpful.
>
>
> Validator is a separate project in the Jakarta Commons, it's not part of
> Struts proper.
>
> Sure you could validate a hidden field, but what's the poor user supposed
to
> do when you toss back an error that such-and-such field is required?  He
> can't DO anything about it, the field is hidden!  (Unless perhaps there's
> client side scripting setting a value when he fills in a visible field?)
>
> I don't see it as any different than validating a text box, did you try it
> and it didn't work?  By the time the request gets turned into a Form bean,
> Struts doesn't know or care that the field was hidden on the HTML form it
> came from.
>
> --
> Wendy Smoak
> Applications Systems Analyst, Sr.
> Arizona State University, PA, IRM
>


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



RE: Struts Validator and Hidden Field

2003-08-28 Thread Wendy Smoak
> I was wondering if it is possible to validate a hidden field using the 
> Struts Validator framework.  If so, an example would be extremely helpful.


Validator is a separate project in the Jakarta Commons, it's not part of
Struts proper.

Sure you could validate a hidden field, but what's the poor user supposed to
do when you toss back an error that such-and-such field is required?  He
can't DO anything about it, the field is hidden!  (Unless perhaps there's
client side scripting setting a value when he fills in a visible field?)

I don't see it as any different than validating a text box, did you try it
and it didn't work?  By the time the request gets turned into a Form bean,
Struts doesn't know or care that the field was hidden on the HTML form it
came from.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 


Re: Struts Validator and Hidden Field

2003-08-28 Thread David Erickson
As far as I was aware validating a hidden field is the exact same as
validating any other field.. just make sure the name of the field in your

To: <[EMAIL PROTECTED]>
Sent: Thursday, August 28, 2003 4:13 PM
Subject: Struts Validator and Hidden Field


Hi Everyone,

I was wondering if it is possible to validate a hidden field using the
Struts Validator framework.  If so, an example would be extremely helpful.
Thanks in advance!

Octavia


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



Struts Validator and Hidden Field

2003-08-28 Thread Octavia Yung
Hi Everyone,

I was wondering if it is possible to validate a hidden field using the Struts 
Validator framework.  If so, an example would be extremely helpful.  Thanks in advance!

Octavia


RE: how to access hidden field value

2003-06-13 Thread Chip Paul
Put it in your Form object, then access it like any other bean property:




-Original Message-
From: Kommana, Sridhar [mailto:[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 4:16 PM
To: Struts Users Mailing List
Subject: how to access hidden field value


i have a hidden value getting from the form and how can i access the hidden
field value on the same jsp without using javascript.

-
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: how to access hidden field value

2003-06-13 Thread Josh Rayls
You can't (assuming you mean actually accessing the ).

You could always set the value into a page scoped variable with JSTL:



-Josh

-Original Message-
From: Kommana, Sridhar [mailto:[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 5:16 PM
To: Struts Users Mailing List
Subject: how to access hidden field value


i have a hidden value getting from the form and how can i access the hidden
field value on the same jsp without using javascript.

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


how to access hidden field value

2003-06-13 Thread Kommana, Sridhar
i have a hidden value getting from the form and how can i access the hidden field 
value on the same jsp without using javascript.

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



Re: Get request property value into Hidden field?

2003-06-13 Thread Alen Ribic
seems like request processor will populate my request object with "id" form
property.
this sounds perfect, I'll try this out.
all I need to do is add the action mapping for the one that just forwards to
deleteItem.jsp page.
this should result in population of my "id" property.
my delete action method already does the right thing when deleteItem.jsp is
posted.

Thanks again for your help.
--Alen


- Original Message -
From: "Krishnakumar N" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 13, 2003 3:45 PM
Subject: RE: Get request property value into Hidden field?


> > -Original Message-
> > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 13, 2003 6:32 PM
> > To: Struts Users Mailing List
> > Subject: Re: Get request property value into Hidden field?
> >
> >
> >
> >
> > - Original Message -
> > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Friday, June 13, 2003 2:12 PM
> > Subject: RE: Get request property value into Hidden field?
> >
> >
> > > Its considered "best practice" to always route the requests
> > thru an action
> > > mapping which can be just an empty forward as follows:
> > >
> >
> > >  > forward="deleteitem.jsp"/>
> > will this automatically create a "deleteForm" bean with my
> > "id" parameter
> > and store it as an request/session attribute?
> >
> > then I understand how the  will
> > get populated.
> >
> > --Alen
>
> yes, it should.
>
> snippet from request processor:
>
> // Process any ActionForm bean related to this request
> ActionForm form = processActionForm(request, response, mapping);
> processPopulate(request, response, form, mapping);
> if (!processValidate(request, response, form, mapping)) {
> return;
> }
>
> // Process a forward or include specified by this mapping
> if (!processForward(request, response, mapping)) {
> return;
> }
>
> >
> > >
> > > Coz then you are able to add processing logic later (if the
> > need arises)
> > by
> > > changing the action mapping without touching the pages
> > which have the
> > link.
> > >
> > > In your case, this mechanism would help populate the action form
> > > (deleteform) with the id value.
> > >
> > > Cheers,
> > > Krishna
> > >
> > > > -Original Message-
> > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, June 13, 2003 4:35 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Get request property value into Hidden field?
> > > >
> > > >
> > > > why do I need to go the action before I have given the user a
> > > > e.g. delete
> > > > "yes/no" option?
> > > > my deleteItem.jsp?id=20 gives them the ui yes/no options.
> > > > is this because I would need to set the form bean as a
> > > > attribute there or?
> > > > something like this in action method...
> > > > request.setAttribute("deleteForm", new
> > > > Item().setId(request.getParameter("id")));
> > > > then forward to the deleteItem.jsp page?
> > > > is this necessary?
> > > > because after that I need to post again to delete the actual
> > > > object from
> > > > persistence storage.
> > > >
> > > > I know what the "id" is and that's the only info I need, and
> > > > I just wish to
> > > > grab into hidden field and post it to the delete action.
> > > >
> > > > --Alen
> > > >
> > > >
> > > >
> > > > - Original Message -
> > > > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > > Sent: Friday, June 13, 2003 1:03 PM
> > > > Subject: RE: Get request property value into Hidden field?
> > > >
> > > >
> > > > > > -Original Message-
> > > > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > > > Sent: Friday, June 13, 2003 4:05 PM
> > > > > > To: Struts Users Mailing List
>

RE: Get request property value into Hidden field?

2003-06-13 Thread Krishnakumar N
> -Original Message-
> From: Alen Ribic [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 13, 2003 6:32 PM
> To: Struts Users Mailing List
> Subject: Re: Get request property value into Hidden field?
> 
> 
> 
> 
> - Original Message -
> From: "Krishnakumar N" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, June 13, 2003 2:12 PM
> Subject: RE: Get request property value into Hidden field?
> 
> 
> > Its considered "best practice" to always route the requests 
> thru an action
> > mapping which can be just an empty forward as follows:
> >
> 
> >  forward="deleteitem.jsp"/>
> will this automatically create a "deleteForm" bean with my 
> "id" parameter
> and store it as an request/session attribute?
> 
> then I understand how the  will 
> get populated.
> 
> --Alen

yes, it should.

snippet from request processor:

// Process any ActionForm bean related to this request
ActionForm form = processActionForm(request, response, mapping);
processPopulate(request, response, form, mapping);
if (!processValidate(request, response, form, mapping)) {
return;
}

// Process a forward or include specified by this mapping
if (!processForward(request, response, mapping)) {
return;
}

> 
> >
> > Coz then you are able to add processing logic later (if the 
> need arises)
> by
> > changing the action mapping without touching the pages 
> which have the
> link.
> >
> > In your case, this mechanism would help populate the action form
> > (deleteform) with the id value.
> >
> > Cheers,
> > Krishna
> >
> > > -Original Message-
> > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, June 13, 2003 4:35 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Get request property value into Hidden field?
> > >
> > >
> > > why do I need to go the action before I have given the user a
> > > e.g. delete
> > > "yes/no" option?
> > > my deleteItem.jsp?id=20 gives them the ui yes/no options.
> > > is this because I would need to set the form bean as a
> > > attribute there or?
> > > something like this in action method...
> > > request.setAttribute("deleteForm", new
> > > Item().setId(request.getParameter("id")));
> > > then forward to the deleteItem.jsp page?
> > > is this necessary?
> > > because after that I need to post again to delete the actual
> > > object from
> > > persistence storage.
> > >
> > > I know what the "id" is and that's the only info I need, and
> > > I just wish to
> > > grab into hidden field and post it to the delete action.
> > >
> > > --Alen
> > >
> > >
> > >
> > > - Original Message -
> > > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Friday, June 13, 2003 1:03 PM
> > > Subject: RE: Get request property value into Hidden field?
> > >
> > >
> > > > > -Original Message-
> > > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > > Sent: Friday, June 13, 2003 4:05 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: Get request property value into Hidden field?
> > > > >
> > > > >
> > > > > oops.
> > > > > thanks.
> > > > > I mean getParameter() of course.
> > > > >
> > > > > It's just simply an Id that gets passed as a parameter that I
> > > > > will need to
> > > > > store in hidden field and then post of to another 
> action method.
> > > > >
> > > > > So, it's like this.
> > > > >
> > > > > > listItems.jsp
> > > > > ---
> > > > > ...
> > > > > href="./deleteItem.jsp?id=20"
> > > >
> > > > Link to a deleteItem.do, the action mapping of which has
> > > the same action
> > > > form as for the delete.do. The action can be an empty
> > > forward to the jsp.
> > > >
> > > > > ...
> > > > > ---
> > > > >
> > 

Re: Get request property value into Hidden field?

2003-06-13 Thread Alen Ribic


- Original Message -
From: "Krishnakumar N" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 13, 2003 2:12 PM
Subject: RE: Get request property value into Hidden field?


> Its considered "best practice" to always route the requests thru an action
> mapping which can be just an empty forward as follows:
>

> 
will this automatically create a "deleteForm" bean with my "id" parameter
and store it as an request/session attribute?

then I understand how the  will get populated.

--Alen

>
> Coz then you are able to add processing logic later (if the need arises)
by
> changing the action mapping without touching the pages which have the
link.
>
> In your case, this mechanism would help populate the action form
> (deleteform) with the id value.
>
> Cheers,
> Krishna
>
> > -Original Message-
> > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 13, 2003 4:35 PM
> > To: Struts Users Mailing List
> > Subject: Re: Get request property value into Hidden field?
> >
> >
> > why do I need to go the action before I have given the user a
> > e.g. delete
> > "yes/no" option?
> > my deleteItem.jsp?id=20 gives them the ui yes/no options.
> > is this because I would need to set the form bean as a
> > attribute there or?
> > something like this in action method...
> > request.setAttribute("deleteForm", new
> > Item().setId(request.getParameter("id")));
> > then forward to the deleteItem.jsp page?
> > is this necessary?
> > because after that I need to post again to delete the actual
> > object from
> > persistence storage.
> >
> > I know what the "id" is and that's the only info I need, and
> > I just wish to
> > grab into hidden field and post it to the delete action.
> >
> > --Alen
> >
> >
> >
> > - Original Message -
> > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Friday, June 13, 2003 1:03 PM
> > Subject: RE: Get request property value into Hidden field?
> >
> >
> > > > -Original Message-
> > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, June 13, 2003 4:05 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Get request property value into Hidden field?
> > > >
> > > >
> > > > oops.
> > > > thanks.
> > > > I mean getParameter() of course.
> > > >
> > > > It's just simply an Id that gets passed as a parameter that I
> > > > will need to
> > > > store in hidden field and then post of to another action method.
> > > >
> > > > So, it's like this.
> > > >
> > > > > listItems.jsp
> > > > ---
> > > > ...
> > > > href="./deleteItem.jsp?id=20"
> > >
> > > Link to a deleteItem.do, the action mapping of which has
> > the same action
> > > form as for the delete.do. The action can be an empty
> > forward to the jsp.
> > >
> > > > ...
> > > > ---
> > > >
> > > > > deleteItem.jsp?id=20
> > > > -----
> > > > 
> > > > 
> > > > ...
> > > > 
> > > > 
> > > > -
> > > >
> > > > When Struts renders the html, in browser / view source,
> > > >  tag
> > > > doesn't store the "id" parameter value.
> > > > 
> > > > should of course be
> > > > 
> > > >
> > > > Does this make sense? :)
> > > > If not, I'll need to look into the issue a bit more myself
> > > > with regards to
> > > > the design.
> > > >
> > > > Thanks
> > > > --Alen
> > > >
> > > >
> > > >
> > > >
> > > > - Original Message -
> > > > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > > Sent: Friday, June 13, 2003 12:27 PM
> > > > Subject: RE: Get request property value into Hidden field?
> > > &

Re: Get request property value into Hidden field?

2003-06-13 Thread Alen Ribic
thanks Krishna for your reply again
you right.
I rethought my design, use case, and have determined that the best way to go
about it is to send it to the action method
first then forward it to my delete view page.
This will give me more control over the item deletion request. (e.g. check
"id" correctness, if not ok then announce error.)
I'll have a same delete action method that will accommodate both call from
listItems.jsp as request for deletion and deleteItem.jsp view that will
perform the post to action for actual deletion process.

So I'm thinking something like this in words...

public ActionForward deleteItem(...) {
[if Form Bean not set as request attribute,
set it with new Item bean and set "id" parameter in bean.
Then forward to "deleteItem.jsp"]

   [Otherwise if Form Bean attribute is set (in this case if deleteForm has
been posted)
then run the delete business logic process command and forward to
Success page!]
}

does this sound right to you? :)

--Alen






- Original Message -
From: "Krishnakumar N" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 13, 2003 2:12 PM
Subject: RE: Get request property value into Hidden field?


> Its considered "best practice" to always route the requests thru an action
> mapping which can be just an empty forward as follows:
>
> 
>
> Coz then you are able to add processing logic later (if the need arises)
by
> changing the action mapping without touching the pages which have the
link.
>
> In your case, this mechanism would help populate the action form
> (deleteform) with the id value.
>
> Cheers,
> Krishna
>
> > -Original Message-
> > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 13, 2003 4:35 PM
> > To: Struts Users Mailing List
> > Subject: Re: Get request property value into Hidden field?
> >
> >
> > why do I need to go the action before I have given the user a
> > e.g. delete
> > "yes/no" option?
> > my deleteItem.jsp?id=20 gives them the ui yes/no options.
> > is this because I would need to set the form bean as a
> > attribute there or?
> > something like this in action method...
> > request.setAttribute("deleteForm", new
> > Item().setId(request.getParameter("id")));
> > then forward to the deleteItem.jsp page?
> > is this necessary?
> > because after that I need to post again to delete the actual
> > object from
> > persistence storage.
> >
> > I know what the "id" is and that's the only info I need, and
> > I just wish to
> > grab into hidden field and post it to the delete action.
> >
> > --Alen
> >
> >
> >
> > - Original Message -
> > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Friday, June 13, 2003 1:03 PM
> > Subject: RE: Get request property value into Hidden field?
> >
> >
> > > > -----Original Message-
> > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, June 13, 2003 4:05 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Get request property value into Hidden field?
> > > >
> > > >
> > > > oops.
> > > > thanks.
> > > > I mean getParameter() of course.
> > > >
> > > > It's just simply an Id that gets passed as a parameter that I
> > > > will need to
> > > > store in hidden field and then post of to another action method.
> > > >
> > > > So, it's like this.
> > > >
> > > > > listItems.jsp
> > > > ---
> > > > ...
> > > > href="./deleteItem.jsp?id=20"
> > >
> > > Link to a deleteItem.do, the action mapping of which has
> > the same action
> > > form as for the delete.do. The action can be an empty
> > forward to the jsp.
> > >
> > > > ...
> > > > ---
> > > >
> > > > > deleteItem.jsp?id=20
> > > > -
> > > > 
> > > > 
> > > > ...
> > > > 
> > > > 
> > > > -
> > > >
> > > > When Struts renders the html, in browser / view source,
> > > >  tag
> > > > doesn't store the "id" parameter value.

RE: Get request property value into Hidden field?

2003-06-13 Thread Krishnakumar N
Its considered "best practice" to always route the requests thru an action
mapping which can be just an empty forward as follows:



Coz then you are able to add processing logic later (if the need arises) by
changing the action mapping without touching the pages which have the link.

In your case, this mechanism would help populate the action form
(deleteform) with the id value.

Cheers,
Krishna 

> -Original Message-
> From: Alen Ribic [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 13, 2003 4:35 PM
> To: Struts Users Mailing List
> Subject: Re: Get request property value into Hidden field?
> 
> 
> why do I need to go the action before I have given the user a 
> e.g. delete
> "yes/no" option?
> my deleteItem.jsp?id=20 gives them the ui yes/no options.
> is this because I would need to set the form bean as a 
> attribute there or?
> something like this in action method...
> request.setAttribute("deleteForm", new
> Item().setId(request.getParameter("id")));
> then forward to the deleteItem.jsp page?
> is this necessary?
> because after that I need to post again to delete the actual 
> object from
> persistence storage.
> 
> I know what the "id" is and that's the only info I need, and 
> I just wish to
> grab into hidden field and post it to the delete action.
> 
> --Alen
> 
> 
> 
> - Original Message -
> From: "Krishnakumar N" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, June 13, 2003 1:03 PM
> Subject: RE: Get request property value into Hidden field?
> 
> 
> > > -Original Message-
> > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, June 13, 2003 4:05 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Get request property value into Hidden field?
> > >
> > >
> > > oops.
> > > thanks.
> > > I mean getParameter() of course.
> > >
> > > It's just simply an Id that gets passed as a parameter that I
> > > will need to
> > > store in hidden field and then post of to another action method.
> > >
> > > So, it's like this.
> > >
> > > > listItems.jsp
> > > ---
> > > ...
> > > href="./deleteItem.jsp?id=20"
> >
> > Link to a deleteItem.do, the action mapping of which has 
> the same action
> > form as for the delete.do. The action can be an empty 
> forward to the jsp.
> >
> > > ...
> > > ---
> > >
> > > > deleteItem.jsp?id=20
> > > -
> > > 
> > > 
> > > ...
> > > 
> > > 
> > > -
> > >
> > > When Struts renders the html, in browser / view source,
> > >  tag
> > > doesn't store the "id" parameter value.
> > > 
> > > should of course be
> > > 
> > >
> > > Does this make sense? :)
> > > If not, I'll need to look into the issue a bit more myself
> > > with regards to
> > > the design.
> > >
> > > Thanks
> > > --Alen
> > >
> > >
> > >
> > >
> > > - Original Message -
> > > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Friday, June 13, 2003 12:27 PM
> > > Subject: RE: Get request property value into Hidden field?
> > >
> > >
> > > > request does not have a getProperty as far as I can see, so
> > > do you mean
> > > > getParameter()?
> > > >
> > > > In that case, the easy way to handle this is to get the
> > > value into the
> > > > action form (which happens automatically if the action form
> > > has a matching
> > > > property) and then populate the html:hidden from the action
> > > form (which is
> > > > also automatic, if you are on the same form).
> > > >
> > > > 
> > > >
> > > > Cheers,
> > > > Krishna
> > > >
> > > > > -Original Message-
> > > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > > Sent: Friday, June 13, 2003 1:14 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Get request property value into Hidden fiel

Re: Get request property value into Hidden field?

2003-06-13 Thread Alen Ribic
why do I need to go the action before I have given the user a e.g. delete
"yes/no" option?
my deleteItem.jsp?id=20 gives them the ui yes/no options.
is this because I would need to set the form bean as a attribute there or?
something like this in action method...
request.setAttribute("deleteForm", new
Item().setId(request.getParameter("id")));
then forward to the deleteItem.jsp page?
is this necessary?
because after that I need to post again to delete the actual object from
persistence storage.

I know what the "id" is and that's the only info I need, and I just wish to
grab into hidden field and post it to the delete action.

--Alen



- Original Message -
From: "Krishnakumar N" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 13, 2003 1:03 PM
Subject: RE: Get request property value into Hidden field?


> > -Original Message-
> > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 13, 2003 4:05 PM
> > To: Struts Users Mailing List
> > Subject: Re: Get request property value into Hidden field?
> >
> >
> > oops.
> > thanks.
> > I mean getParameter() of course.
> >
> > It's just simply an Id that gets passed as a parameter that I
> > will need to
> > store in hidden field and then post of to another action method.
> >
> > So, it's like this.
> >
> > > listItems.jsp
> > ---
> > ...
> > href="./deleteItem.jsp?id=20"
>
> Link to a deleteItem.do, the action mapping of which has the same action
> form as for the delete.do. The action can be an empty forward to the jsp.
>
> > ...
> > ---
> >
> > > deleteItem.jsp?id=20
> > -
> > 
> > 
> > ...
> > 
> > 
> > -
> >
> > When Struts renders the html, in browser / view source,
> >  tag
> > doesn't store the "id" parameter value.
> > 
> > should of course be
> > 
> >
> > Does this make sense? :)
> > If not, I'll need to look into the issue a bit more myself
> > with regards to
> > the design.
> >
> > Thanks
> > --Alen
> >
> >
> >
> >
> > - Original Message -
> > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Friday, June 13, 2003 12:27 PM
> > Subject: RE: Get request property value into Hidden field?
> >
> >
> > > request does not have a getProperty as far as I can see, so
> > do you mean
> > > getParameter()?
> > >
> > > In that case, the easy way to handle this is to get the
> > value into the
> > > action form (which happens automatically if the action form
> > has a matching
> > > property) and then populate the html:hidden from the action
> > form (which is
> > > also automatic, if you are on the same form).
> > >
> > > 
> > >
> > > Cheers,
> > > Krishna
> > >
> > > > -Original Message-
> > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, June 13, 2003 1:14 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Get request property value into Hidden field?
> > > >
> > > >
> > > > Hi Everyone,
> > > >
> > > > How do I get a request property value into Hidden field
> > > > without writing any
> > > > java code.
> > > > (no <%=request.getProperty("Id")%>)
> > > > I tried using  with combination of
> > > >  with no
> > > > success. (maybe I was doing it wrong or something)
> > > >
> > > > How do I accomplish this task?
> > > >
> > > > Thanks
> > > > --Alen
> > > >
> > > >
> > > >
> > -
> > > > 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]
> > >
> >
> >
> > -
> > 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]
>


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



RE: Get request property value into Hidden field?

2003-06-13 Thread Krishnakumar N
> -Original Message-
> From: Alen Ribic [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 13, 2003 4:05 PM
> To: Struts Users Mailing List
> Subject: Re: Get request property value into Hidden field?
> 
> 
> oops.
> thanks.
> I mean getParameter() of course.
> 
> It's just simply an Id that gets passed as a parameter that I 
> will need to
> store in hidden field and then post of to another action method.
> 
> So, it's like this.
> 
> > listItems.jsp
> ---
> ...
> href="./deleteItem.jsp?id=20"

Link to a deleteItem.do, the action mapping of which has the same action
form as for the delete.do. The action can be an empty forward to the jsp. 

> ...
> ---
> 
> > deleteItem.jsp?id=20
> -
> 
> 
> ...
> 
> 
> -
> 
> When Struts renders the html, in browser / view source, 
>  tag
> doesn't store the "id" parameter value.
> 
> should of course be
> 
> 
> Does this make sense? :)
> If not, I'll need to look into the issue a bit more myself 
> with regards to
> the design.
> 
> Thanks
> --Alen
> 
> 
> 
> 
> - Original Message -
> From: "Krishnakumar N" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, June 13, 2003 12:27 PM
> Subject: RE: Get request property value into Hidden field?
> 
> 
> > request does not have a getProperty as far as I can see, so 
> do you mean
> > getParameter()?
> >
> > In that case, the easy way to handle this is to get the 
> value into the
> > action form (which happens automatically if the action form 
> has a matching
> > property) and then populate the html:hidden from the action 
> form (which is
> > also automatic, if you are on the same form).
> >
> > 
> >
> > Cheers,
> > Krishna
> >
> > > -Original Message-
> > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, June 13, 2003 1:14 PM
> > > To: Struts Users Mailing List
> > > Subject: Get request property value into Hidden field?
> > >
> > >
> > > Hi Everyone,
> > >
> > > How do I get a request property value into Hidden field
> > > without writing any
> > > java code.
> > > (no <%=request.getProperty("Id")%>)
> > > I tried using  with combination of
> > >  with no
> > > success. (maybe I was doing it wrong or something)
> > >
> > > How do I accomplish this task?
> > >
> > > Thanks
> > > --Alen
> > >
> > >
> > > 
> -
> > > 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]
> >
> 
> 
> -
> 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: Get request property value into Hidden field?

2003-06-13 Thread Alen Ribic
I think this might be something in my form config. that the parameter is not
being pulled through.
I'll work it out. Probably something silly anyway :)
Thx
--Alen


- Original Message -
From: "Alen Ribic" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 13, 2003 12:34 PM
Subject: Re: Get request property value into Hidden field?


> oops.
> thanks.
> I mean getParameter() of course.
>
> It's just simply an Id that gets passed as a parameter that I will need to
> store in hidden field and then post of to another action method.
>
> So, it's like this.
>
> > listItems.jsp
> ---
> ...
> href="./deleteItem.jsp?id=20"
> ...
> ---
>
> > deleteItem.jsp?id=20
> -
> 
> 
> ...
> 
> 
> -
>
> When Struts renders the html, in browser / view source, 
tag
> doesn't store the "id" parameter value.
> 
> should of course be
> 
>
> Does this make sense? :)
> If not, I'll need to look into the issue a bit more myself with regards to
> the design.
>
> Thanks
> --Alen
>
>
>
>
> - Original Message -
> From: "Krishnakumar N" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, June 13, 2003 12:27 PM
> Subject: RE: Get request property value into Hidden field?
>
>
> > request does not have a getProperty as far as I can see, so do you mean
> > getParameter()?
> >
> > In that case, the easy way to handle this is to get the value into the
> > action form (which happens automatically if the action form has a
matching
> > property) and then populate the html:hidden from the action form (which
is
> > also automatic, if you are on the same form).
> >
> > 
> >
> > Cheers,
> > Krishna
> >
> > > -Original Message-
> > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, June 13, 2003 1:14 PM
> > > To: Struts Users Mailing List
> > > Subject: Get request property value into Hidden field?
> > >
> > >
> > > Hi Everyone,
> > >
> > > How do I get a request property value into Hidden field
> > > without writing any
> > > java code.
> > > (no <%=request.getProperty("Id")%>)
> > > I tried using  with combination of
> > >  with no
> > > success. (maybe I was doing it wrong or something)
> > >
> > > How do I accomplish this task?
> > >
> > > Thanks
> > > --Alen
> > >
> > >
> > > -
> > > 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]
> >
>
>
> -
> 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: Get request property value into Hidden field?

2003-06-13 Thread Alen Ribic
oops.
thanks.
I mean getParameter() of course.

It's just simply an Id that gets passed as a parameter that I will need to
store in hidden field and then post of to another action method.

So, it's like this.

> listItems.jsp
---
...
href="./deleteItem.jsp?id=20"
...
---

> deleteItem.jsp?id=20
-


...


-

When Struts renders the html, in browser / view source,  tag
doesn't store the "id" parameter value.

should of course be


Does this make sense? :)
If not, I'll need to look into the issue a bit more myself with regards to
the design.

Thanks
--Alen




- Original Message -
From: "Krishnakumar N" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 13, 2003 12:27 PM
Subject: RE: Get request property value into Hidden field?


> request does not have a getProperty as far as I can see, so do you mean
> getParameter()?
>
> In that case, the easy way to handle this is to get the value into the
> action form (which happens automatically if the action form has a matching
> property) and then populate the html:hidden from the action form (which is
> also automatic, if you are on the same form).
>
> 
>
> Cheers,
> Krishna
>
> > -Original Message-
> > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 13, 2003 1:14 PM
> > To: Struts Users Mailing List
> > Subject: Get request property value into Hidden field?
> >
> >
> > Hi Everyone,
> >
> > How do I get a request property value into Hidden field
> > without writing any
> > java code.
> > (no <%=request.getProperty("Id")%>)
> > I tried using  with combination of
> >  with no
> > success. (maybe I was doing it wrong or something)
> >
> > How do I accomplish this task?
> >
> > Thanks
> > --Alen
> >
> >
> > -
> > 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]
>


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



RE: Get request property value into Hidden field?

2003-06-13 Thread Krishnakumar N
request does not have a getProperty as far as I can see, so do you mean
getParameter()?

In that case, the easy way to handle this is to get the value into the
action form (which happens automatically if the action form has a matching
property) and then populate the html:hidden from the action form (which is
also automatic, if you are on the same form).



Cheers,
Krishna 

> -Original Message-
> From: Alen Ribic [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 13, 2003 1:14 PM
> To: Struts Users Mailing List
> Subject: Get request property value into Hidden field?
> 
> 
> Hi Everyone,
> 
> How do I get a request property value into Hidden field 
> without writing any
> java code.
> (no <%=request.getProperty("Id")%>)
> I tried using  with combination of 
>  with no
> success. (maybe I was doing it wrong or something)
> 
> How do I accomplish this task?
> 
> Thanks
> --Alen
> 
> 
> -
> 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]



Get request property value into Hidden field?

2003-06-13 Thread Alen Ribic
Hi Everyone,

How do I get a request property value into Hidden field without writing any
java code.
(no <%=request.getProperty("Id")%>)
I tried using  with combination of  with no
success. (maybe I was doing it wrong or something)

How do I accomplish this task?

Thanks
--Alen


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



Nested Iterate Proerty value in a hidden field

2003-03-06 Thread ashokd
Hi,

How to capture a nested iterate property value into a hidden field. I am
displaying only one record depending upon the condition, At this time i wan
to captrue some values into a hidden fields. How can we do this?

Thanks & Regards,
Ashok.D


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



Hidden field String[]

2002-07-30 Thread Zimmer, Robin (SSABSA)

Does anyone have sample code or tips for setting hidden fields from a
String[] in a form bean. Many thanks, Robin.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Setting a hidden field from an array element in a bean

2002-06-12 Thread Trieu, Danny

you have to have an getter for you indexed property B

> -Original Message-
> From: geoge m [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, June 12, 2002 1:27 PM
> To:   [EMAIL PROTECTED]
> Subject:  Setting a hidden field from an array element in a bean
> 
> I am trying to set a hidden field from one of the
> array elements in a bean like:
> 
> I have a bean A with String[] B.
> 
> I am trying to do 
> 
> 
> What method do I need in this form class to have this
> value set.
> 
> I have created a method like get/setB().. but it is
> giving an error:
> 
> java.lang.IllegalArgumentException: array element type
> mismatch
>   at java.lang.reflect.Array.set(Native Method)
>   at
> org.apache.struts.util.PropertyUtils.setIndexedProperty(PropertyUtils.java
> :851)
>   at
> org.apache.struts.util.PropertyUtils.setIndexedProperty(PropertyUtils.java
> :785)
>   at
> org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:
> 902)
>   at
> org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)
>   at
> org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509)
>   at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772)
>   at
> org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:
> 2061)
>   at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
>   at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
>   at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>   at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 
> Can someone please throw some light on this.
> 
> thanks. george
> 
> __
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>

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




Setting a hidden field from an array element in a bean

2002-06-12 Thread geoge m

I am trying to set a hidden field from one of the
array elements in a bean like:

I have a bean A with String[] B.

I am trying to do 


What method do I need in this form class to have this
value set.

I have created a method like get/setB().. but it is
giving an error:

java.lang.IllegalArgumentException: array element type
mismatch
at java.lang.reflect.Array.set(Native Method)
at
org.apache.struts.util.PropertyUtils.setIndexedProperty(PropertyUtils.java:851)
at
org.apache.struts.util.PropertyUtils.setIndexedProperty(PropertyUtils.java:785)
at
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:902)
at
org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)
at
org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

Can someone please throw some light on this.

thanks. george

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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




Re: How to store a String[] in a hidden field?

2002-01-16 Thread Keith Bacon

Just looked at this reply - I wonder why I said put these methods in an object in the 
session?
They can just be static methods of any class.
Keith.

--- Keith Bacon <[EMAIL PROTECTED]> wrote:
> How about putting a helper class in your session which has methods:-
> 
> String stringArrayToTokenizedString(String[] array)
>//store array elements delimted by some char that's not in the data.
> 
> String[] tokenizedStringToStringArray.
>//Use StringTokeniser to build the array again.
> 
> Then you need only store 1 big long string.
> Personally that seems fairly horrible too but at least there's less JSP code.
> Keith.
> 
> --- Christian Bouessay <[EMAIL PROTECTED]> wrote:
> > Well, I've found one solution:
> > 
> > 
> > > collection="<%=request.getParameterValues("fields")%>">
> > 
> >  
> > 
> >
> > 
> > 
> > Is there a better way to do this?
> > 
> > --
> > C. Bouessay
> > 
> > Christian Bouessay wrote:
> > 
> > > Hi,
> > > I have a form with a multiple select box.
> > > 
> > > class myForm1 extends ActionForm {
> > > String[] getFields() { ...}
> > > void setFields(String[] fields )
> > > ...
> > > }
> > > 
> > >  > > labelProperty="label"/>
> > > 
> > > 
> > > When I submit the form and validate() return null, it forwards to an 
> > > other view of the same form where I would like to store this property in 
> > > a hidden field.
> > > 
> > > And HTML output is:
> > > 
> > > 
> > > 
> > > How can I tell struts to store it in a "String" format?
> > > 
> > > 
> > > Thanks for help.
> > > -- 
> > > C. Bouessay
> > > 
> > > 
> > > -- 
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > 
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: How to store a String[] in a hidden field?

2002-01-16 Thread Keith Bacon

How about putting a helper class in your session which has methods:-

String stringArrayToTokenizedString(String[] array)
   //store array elements delimted by some char that's not in the data.

String[] tokenizedStringToStringArray.
   //Use StringTokeniser to build the array again.

Then you need only store 1 big long string.
Personally that seems fairly horrible too but at least there's less JSP code.
Keith.

--- Christian Bouessay <[EMAIL PROTECTED]> wrote:
> Well, I've found one solution:
> 
> 
> collection="<%=request.getParameterValues("fields")%>">
> 
>  
> 
>
> 
> 
> Is there a better way to do this?
> 
> --
> C. Bouessay
> 
> Christian Bouessay wrote:
> 
> > Hi,
> > I have a form with a multiple select box.
> > 
> > class myForm1 extends ActionForm {
> > String[] getFields() { ...}
> > void setFields(String[] fields )
> > ...
> > }
> > 
> >  > labelProperty="label"/>
> > 
> > 
> > When I submit the form and validate() return null, it forwards to an 
> > other view of the same form where I would like to store this property in 
> > a hidden field.
> > 
> > And HTML output is:
> > 
> > 
> > 
> > How can I tell struts to store it in a "String" format?
> > 
> > 
> > Thanks for help.
> > -- 
> > C. Bouessay
> > 
> > 
> > -- 
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: How to store a String[] in a hidden field?

2002-01-16 Thread Christian Bouessay

Well, I've found one solution:


   ">

 

   


Is there a better way to do this?

--
C. Bouessay

Christian Bouessay wrote:

> Hi,
> I have a form with a multiple select box.
> 
> class myForm1 extends ActionForm {
> String[] getFields() { ...}
> void setFields(String[] fields )
> ...
> }
> 
>  labelProperty="label"/>
> 
> 
> When I submit the form and validate() return null, it forwards to an 
> other view of the same form where I would like to store this property in 
> a hidden field.
> 
> And HTML output is:
> 
> 
> 
> How can I tell struts to store it in a "String" format?
> 
> 
> Thanks for help.
> -- 
> C. Bouessay
> 
> 
> -- 
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 




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




How to store a String[] in a hidden field?

2002-01-16 Thread Christian Bouessay

Hi,
I have a form with a multiple select box.

class myForm1 extends ActionForm {
 String[] getFields() { ...}
 void setFields(String[] fields )
 ...
}

 


When I submit the form and validate() return null, it forwards to an 
other view of the same form where I would like to store this property in 
a hidden field.

And HTML output is:



How can I tell struts to store it in a "String" format?


Thanks for help.
--
C. Bouessay


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




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-30 Thread Erik Hatcher

I believe Ted actually means 'reset()' instead of 'init()'.


- Original Message -
From: "Ted Husted" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, November 29, 2001 11:15 AM
Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla html?


> In Struts 1.0.1, init() is called if the ActionForm is instantiated by
> the JavaServer Page. In Struts 1.0, this only happens when the
> ActionForm is instantiated by the ActionServlet. Of course, any default
> values assigned to the fields in the ActionForm class itself will be
> available in either case. The recommended control flow is to go through
> an Action first, and populate the ActionForm there. Populating the
> ActionForm from the JSP is a Model 1 strategy.
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel +1 716 737-3463
> -- http://www.husted.com/struts/
>
>
> David Lauta wrote:
> >
> > Is there a method in the framework that gets invoked allowing you to
> > initialize the ActionForm before the JSP is displayed?
> >
> > Brett Porter wrote:
> >
> > > That's an interesting design decision. I have always had a form bean
and
> > > then another bean containing the actual data. The action copies it
across,
> > > processes it, and stores it.
> > >
> > > The reason I'd do it that way is that I imagine the message is a
"business
> > > class", and you don't really want you model "polluted" by extending an
> > > ActionForm. Maybe I've been living in OOAD land too long though ;)
> > >
> > > This can trip you up though - at least once I have added the form
element,
> > > added it to the bean, added it to the form bean, and forgetten to do
the
> > > setter in the action :) The way around that is probably a function in
the
> > > form bean that says "fill my business class" and "fill from a business
> > > class". Actually, I might put that in my todo list :D
> > >
> > > Cheers,
> > > Brett
> > >
> > > -Original Message-
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, 29 November 2001 12:48 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > ht ml?
> > >
> > > The data I am storing in the bean is logically different from what the
> > > hidden field value is,  I have a message
> > >
> > > message
> > > {
> > >string  Recipent
> > >string  From
> > >string  MessageBode
> > > }
> > >
> > > And the hidden field is   action=sendMessage and I didn't think that
> > >
> > > message
> > > {
> > >string  Action
> > >string  Recipent
> > >string  From
> > >string  MessageBode
> > > }
> > >
> > > would be the correct thing to do, but I am open to suggestions.  If it
> > > works out easier to put this extra field in my message formbean then I
> > > will do it.  What do you think?
> > >
> > > Cheers
> > >
> > > Tony
> > >
> > > Brett Porter wrote:
> > >
> > > > The question I ask is why you wouldn't put it in your form bean?
> > > >
> > > > I prefer form.getAction() over httpServletRequest.getParameter(
"action" )
> > > > any day! :)
> > > >
> > > > -Original Message-
> > > > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, 29 November 2001 12:36 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Hidden Field in a form. Do I use struts taglib or
vanilla
> > > > html?
> > > >
> > > >
> > > > Yup, using the taglib makes it compulsory to have that field in your
> > > > FormBean
> > > >
> > > > On Thursday 29 November 2001 09:25 am, you wrote:
> > > >
> > > >>Hi
> > > >>
> > > >>I want to include a hidden field in a form which I have.  I do not
want
> > > >>this information to be included in the formbean which is defined for
> > > >>this page.  How can I do this?  Should I just use plain html
> > > >>
> > > >>
> > > >>
> > > >>without using the html taglib supplied with struts?
> > > >>
> > > >>Cheers
> > > >>
> > > >>Tony
> > > >>
> > > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> >
> > --
> > Thank you,
> > David Lauta
> > [EMAIL PROTECTED]
> > (561)272-2698
> > (561)289-0502 cell
> >
> > --
> > To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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




AW: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-30 Thread "Moritz Björn-Hendrik, HH"

Ted,

a great idea, but you need to know the name of the actionForm in the
jsp-Page. If you change the name in the struts-config.xml, you have to
change it here, too. Doesn't this hurt struts design principles? Isn't it
better (at least until struts 1.1 is released) to have two methods on the
actionForm-class, one for the values and one for the values, which
internally (i.e. in java-Code) map to a method named getNames?

Björn-H. Moritz

> -Ursprüngliche Nachricht-
> Von:  Ted Husted [SMTP:[EMAIL PROTECTED]]
> Gesendet am:  Donnerstag, 29. November 2001 22:19
> An:   Struts Users Mailing List
> Betreff:  Re: Hidden Field in a form.  Do I use struts taglib or
> vanilla html?
> 
> The cleanest thing is to put the ArrayList on the ActionForm. The syntax
> of the options tag is suboptimal, so you need to expose the property as
> a bean. 
> 
> 
>property="names" type="java.util.Collection"/>
>  labelProperty="label"/>
> 
> 
> So, you go through an Action, and have it setup the names list. 
> 
> If there's validation involved, use the same Action as the input path,
> so the list gets made again.
> 
> This also makes it much easier to retrieve the list from a database or
> static class that is on the business tier.
> 
> David Lauta wrote:
> > 
> > Wow,
> > Thanks Ted this is great info.
> > 
> > I have narrowed my problem down to:
> > I want to use a  Tag on a form and I want the options to be
> > populated when the form is first displayed.
> > To do this I need to set an ArrayList of valueLabel pairs in the page
> Context
> > 
> >  pageContext.setAttribute("names", actionForm.getNames());
> > // getNames returns an ArrayList
> > // each Item in the arrayList has a getValue() and getLabel() accessor.
> > This works but is coded in the JSP ( tightly coupling the UI with the
> Model ).
> > I'm looking for a way to set the attribute outside of the JSP
> > so that the following will work
> > 
> >>property="namesId"
> >onchange="javascript:submitForm()" >
> > labelProperty="label" />
> >   
> > 
> > In the sequence of events listed below when is the earliest that I can
> obtain the
> > pageContext
> > to call the setAttribute() method on it. I'm guessing that the
> PageContext of the JSP is
> > the same as the
> > ServletContext of the HTTPServlet
> > 
> > Could my problem be related to I am using the ActionForm instead of the
> ActionFormBean
> > class?
> >
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>

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




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-30 Thread Greg Callaghan

Ted,

Again this is great information. I think it confirms something I have been 
struggling with -:

I am trying to handle the CANCEL case of an "edit a record" screen which was 
arrived at from the previous "list of records" screen.  They use the same 
formbean which has an "action" field.  When entering the first "list of 
records" screen it is set to "action=display", and when entering the "edit a 
record" screen it is set to edit/add/delete as approrpriate.  The reason for 
this is my formbean validation differs in the two cases (another story).

The problem I have is if the use hits CANCEL on the "edit a record" screen I 
wanted to send them back to the "display list of records" screen via the 
associated action (cf directly to the JSP), ie so that the action sets up 
appropriate objects required (don't want to recode this).

The catch seems to be I need to set the "action" request parameter back to 
DISPLAY from say EDIT in the "edit a record" action prior to forwarding to 
the "display list of records" action.

It seems this may not be possible??

- setting action element in the form from within the action prior to the 
forward doesn't work as the pseudo code below indicates that "If a form bean 
is in play, the ActionServlet resets and populates
it from the HTTP request"

- I still haven't found a way to override a request parameters value from an 
action yet??? (it seems possible using a JSP tag, ie the forward tag, so 
maybe I just haven't worked it out yet)

Other this this maybe I need to re-think the design?  :-)

Ideas anyone?

Cheers
Greg
Original Message Follows
From: Ted Husted <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: Hidden Field in a form.  Do I use struts taglib or vanilla 
html?
Date: Thu, 29 Nov 2001 14:16:11 -0500

The general order of things is

1) Client requests an Action URI (the path from the ActionMapping)
2) The container passes the request to the ActionServlet
3) The ActionServlet looks up the mapping for the path
4) If the mapping specifies a form bean, the ActionServlet sees if there
is one already, or creates one.
4.1) If a form bean is in play, the ActionServlet resets and populates
it from the HTTP request
4.2) If the mapping has validate set to true, it calls validate on the
form bean. If it fails, it forwards to the path specified by the input
property, and this control flow ends
5) If the mapping specifies an Action type, it is instantiated if
needed, or reused if already there
5.1) The Action's perform method is called, with the instantiated form
bean
5.2) The Action may populate the form bean, call business objects,and do
whatever else is needed
5.3) The Action returns an ActionForward to the ActionServlet

If the ActionForward is to another Action URI, we begin again, else it's
off to a JSP or something.

If the ActionForward is to a JSP
1) Jasper, or the equivalent, renders the page
2) If the Struts html tags see the ActionForm in the request (from 4),
it populate the controls from the ActionForm. Else the html:form tag
creates one, and uses its default values in its tags.

(Can't draw, but I sure can number;-)

If you just need to create a blank form (4), you can use a "continue
Action" to pass control through an Action and then out to the JSP.

 public ActionForward perform(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
 throws IOException, ServletException {

 return mapping.findForward(request.getParameter("continue"));

 }

So in the mapping you specify the ActionForm for this instance,
validate=false, and a local forward for the JSP input form.

David Lauta wrote:
 >
 > Thanks for the reply,
 > I understand that you would like me to seperate the UI from the Model
 > Can you be more specific about
 > 'The recommended control flow is to go through an Action first'
 > I'm trying to get a one page does it all UI - Is there a tag I should use 
to invoke
 > some kind
 > of preprocess action?
 >
 > What I am after is populating the List boxes with data from (ultimately) 
EJB's
 > I need to decide where I am going to instantiate and initialize my EJB's 
( Session
 > Beans )
 >
 > To this point in my model I have subclassed ActionForm, Action, and 
ActionMapping
 > my struts-config.xml is:
 >  
 >   name="StrutsTestForm"
 >type="web.StrutsTestForm" />
 >  
 >
 >  
 >   name="StrutsTestForm"
 >path="/StrutsTest"
 >type="web.StrutsTestAction"
 >i

Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread Ted Husted

The cleanest thing is to put the ArrayList on the ActionForm. The syntax
of the options tag is suboptimal, so you need to expose the property as
a bean. 






So, you go through an Action, and have it setup the names list. 

If there's validation involved, use the same Action as the input path,
so the list gets made again.

This also makes it much easier to retrieve the list from a database or
static class that is on the business tier.

David Lauta wrote:
> 
> Wow,
> Thanks Ted this is great info.
> 
> I have narrowed my problem down to:
> I want to use a  Tag on a form and I want the options to be
> populated when the form is first displayed.
> To do this I need to set an ArrayList of valueLabel pairs in the page Context
> 
>  pageContext.setAttribute("names", actionForm.getNames());
> // getNames returns an ArrayList
> // each Item in the arrayList has a getValue() and getLabel() accessor.
> This works but is coded in the JSP ( tightly coupling the UI with the Model ).
> I'm looking for a way to set the attribute outside of the JSP
> so that the following will work
> 
>   property="namesId"
>onchange="javascript:submitForm()" >
>
>   
> 
> In the sequence of events listed below when is the earliest that I can obtain the
> pageContext
> to call the setAttribute() method on it. I'm guessing that the PageContext of the 
>JSP is
> the same as the
> ServletContext of the HTTPServlet
> 
> Could my problem be related to I am using the ActionForm instead of the 
>ActionFormBean
> class?
>

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread David Lauta
 Name
> > 5 Create another ActionForm (Servlet is null)
> > 6 Some magic I haven't been able to trace yet
> > 7 The JSP appears and the list boxes are filled in
> >
> > It seems like I have two instances of ActionMapping and two instances of ActionForm
> >
> > How should the initialization really occur?
> >
> > Thanks for your attention
> > -David Lauta
> > [EMAIL PROTECTED]
> >
> > Ted Husted wrote:
> >
> > > In Struts 1.0.1, init() is called if the ActionForm is instantiated by
> > > the JavaServer Page. In Struts 1.0, this only happens when the
> > > ActionForm is instantiated by the ActionServlet. Of course, any default
> > > values assigned to the fields in the ActionForm class itself will be
> > > available in either case. The recommended control flow is to go through
> > > an Action first, and populate the ActionForm there. Populating the
> > > ActionForm from the JSP is a Model 1 strategy.
> > >
> > > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > > -- Custom Software ~ Technical Services.
> > > -- Tel +1 716 737-3463
> > > -- http://www.husted.com/struts/
> > >
> > > David Lauta wrote:
> > > >
> > > > Is there a method in the framework that gets invoked allowing you to
> > > > initialize the ActionForm before the JSP is displayed?
> > > >
> > > > Brett Porter wrote:
> > > >
> > > > > That's an interesting design decision. I have always had a form bean and
> > > > > then another bean containing the actual data. The action copies it across,
> > > > > processes it, and stores it.
> > > > >
> > > > > The reason I'd do it that way is that I imagine the message is a "business
> > > > > class", and you don't really want you model "polluted" by extending an
> > > > > ActionForm. Maybe I've been living in OOAD land too long though ;)
> > > > >
> > > > > This can trip you up though - at least once I have added the form element,
> > > > > added it to the bean, added it to the form bean, and forgetten to do the
> > > > > setter in the action :) The way around that is probably a function in the
> > > > > form bean that says "fill my business class" and "fill from a business
> > > > > class". Actually, I might put that in my todo list :D
> > > > >
> > > > > Cheers,
> > > > > Brett
> > > > >
> > > > > -Original Message-
> > > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, 29 November 2001 12:48 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > > > ht ml?
> > > > >
> > > > > The data I am storing in the bean is logically different from what the
> > > > > hidden field value is,  I have a message
> > > > >
> > > > > message
> > > > > {
> > > > >string  Recipent
> > > > >string  From
> > > > >string  MessageBode
> > > > > }
> > > > >
> > > > > And the hidden field is   action=sendMessage and I didn't think that
> > > > >
> > > > > message
> > > > > {
> > > > >string  Action
> > > > >string  Recipent
> > > > >string  From
> > > > >string  MessageBode
> > > > > }
> > > > >
> > > > > would be the correct thing to do, but I am open to suggestions.  If it
> > > > > works out easier to put this extra field in my message formbean then I
> > > > > will do it.  What do you think?
> > > > >
> > > > > Cheers
> > > > >
> > > > > Tony
> > > > >
> > > > > Brett Porter wrote:
> > > > >
> > > > > > The question I ask is why you wouldn't put it in your form bean?
> > > > > >
> > > > > > I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> > > > > > any day! :)
> > > > > >
> > > > > > -Original Message-
> > > > > > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > > > > 

Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread David Lauta
gt; > available in either case. The recommended control flow is to go through
> > > an Action first, and populate the ActionForm there. Populating the
> > > ActionForm from the JSP is a Model 1 strategy.
> > >
> > > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > > -- Custom Software ~ Technical Services.
> > > -- Tel +1 716 737-3463
> > > -- http://www.husted.com/struts/
> > >
> > > David Lauta wrote:
> > > >
> > > > Is there a method in the framework that gets invoked allowing you to
> > > > initialize the ActionForm before the JSP is displayed?
> > > >
> > > > Brett Porter wrote:
> > > >
> > > > > That's an interesting design decision. I have always had a form bean and
> > > > > then another bean containing the actual data. The action copies it across,
> > > > > processes it, and stores it.
> > > > >
> > > > > The reason I'd do it that way is that I imagine the message is a "business
> > > > > class", and you don't really want you model "polluted" by extending an
> > > > > ActionForm. Maybe I've been living in OOAD land too long though ;)
> > > > >
> > > > > This can trip you up though - at least once I have added the form element,
> > > > > added it to the bean, added it to the form bean, and forgetten to do the
> > > > > setter in the action :) The way around that is probably a function in the
> > > > > form bean that says "fill my business class" and "fill from a business
> > > > > class". Actually, I might put that in my todo list :D
> > > > >
> > > > > Cheers,
> > > > > Brett
> > > > >
> > > > > -Original Message-
> > > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, 29 November 2001 12:48 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > > > ht ml?
> > > > >
> > > > > The data I am storing in the bean is logically different from what the
> > > > > hidden field value is,  I have a message
> > > > >
> > > > > message
> > > > > {
> > > > >string  Recipent
> > > > >string  From
> > > > >string  MessageBode
> > > > > }
> > > > >
> > > > > And the hidden field is   action=sendMessage and I didn't think that
> > > > >
> > > > > message
> > > > > {
> > > > >string  Action
> > > > >string  Recipent
> > > > >string  From
> > > > >string  MessageBode
> > > > > }
> > > > >
> > > > > would be the correct thing to do, but I am open to suggestions.  If it
> > > > > works out easier to put this extra field in my message formbean then I
> > > > > will do it.  What do you think?
> > > > >
> > > > > Cheers
> > > > >
> > > > > Tony
> > > > >
> > > > > Brett Porter wrote:
> > > > >
> > > > > > The question I ask is why you wouldn't put it in your form bean?
> > > > > >
> > > > > > I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> > > > > > any day! :)
> > > > > >
> > > > > > -Original Message-
> > > > > > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Thursday, 29 November 2001 12:36 PM
> > > > > > To: Struts Users Mailing List
> > > > > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > > > > html?
> > > > > >
> > > > > >
> > > > > > Yup, using the taglib makes it compulsory to have that field in your
> > > > > > FormBean
> > > > > >
> > > > > > On Thursday 29 November 2001 09:25 am, you wrote:
> > > > > >
> > > > > >>Hi
> > > > > >>
> > > > > >>I want to include a hidden field in a form which I have.  I do not want
> > > > > >>this information to be included in the formbean which is defined for
> > > > > >>this page.  How can I do this?  Should I just use plain html
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>without using the html taglib supplied with struts?
> > > > > >>
> > > > > >>Cheers
> > > > > >>
> > > > > >>Tony
> > > > > >>
> > > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > > For additional commands, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > > --
> > > > Thank you,
> > > > David Lauta
> > > > [EMAIL PROTECTED]
> > > > (561)272-2698
> > > > (561)289-0502 cell
> > > >
> > > > --
> > > > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> > --
> > Thank you,
> > David Lauta
> > [EMAIL PROTECTED]
> > (561)272-2698
> > (561)289-0502 cell
> >
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel +1 716 737-3463
> -- http://www.husted.com/struts/
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
Thank you,
David Lauta
[EMAIL PROTECTED]
(561)272-2698
(561)289-0502 cell



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




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread Ted Husted
gt; > >
> > > > That's an interesting design decision. I have always had a form bean and
> > > > then another bean containing the actual data. The action copies it across,
> > > > processes it, and stores it.
> > > >
> > > > The reason I'd do it that way is that I imagine the message is a "business
> > > > class", and you don't really want you model "polluted" by extending an
> > > > ActionForm. Maybe I've been living in OOAD land too long though ;)
> > > >
> > > > This can trip you up though - at least once I have added the form element,
> > > > added it to the bean, added it to the form bean, and forgetten to do the
> > > > setter in the action :) The way around that is probably a function in the
> > > > form bean that says "fill my business class" and "fill from a business
> > > > class". Actually, I might put that in my todo list :D
> > > >
> > > > Cheers,
> > > > Brett
> > > >
> > > > -Original Message-
> > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, 29 November 2001 12:48 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > > ht ml?
> > > >
> > > > The data I am storing in the bean is logically different from what the
> > > > hidden field value is,  I have a message
> > > >
> > > > message
> > > > {
> > > >string  Recipent
> > > >string  From
> > > >string  MessageBode
> > > > }
> > > >
> > > > And the hidden field is   action=sendMessage and I didn't think that
> > > >
> > > > message
> > > > {
> > > >string  Action
> > > >string  Recipent
> > > >string  From
> > > >string  MessageBode
> > > > }
> > > >
> > > > would be the correct thing to do, but I am open to suggestions.  If it
> > > > works out easier to put this extra field in my message formbean then I
> > > > will do it.  What do you think?
> > > >
> > > > Cheers
> > > >
> > > > Tony
> > > >
> > > > Brett Porter wrote:
> > > >
> > > > > The question I ask is why you wouldn't put it in your form bean?
> > > > >
> > > > > I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> > > > > any day! :)
> > > > >
> > > > > -Original Message-
> > > > > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, 29 November 2001 12:36 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > > > html?
> > > > >
> > > > >
> > > > > Yup, using the taglib makes it compulsory to have that field in your
> > > > > FormBean
> > > > >
> > > > > On Thursday 29 November 2001 09:25 am, you wrote:
> > > > >
> > > > >>Hi
> > > > >>
> > > > >>I want to include a hidden field in a form which I have.  I do not want
> > > > >>this information to be included in the formbean which is defined for
> > > > >>this page.  How can I do this?  Should I just use plain html
> > > > >>
> > > > >>
> > > > >>
> > > > >>without using the html taglib supplied with struts?
> > > > >>
> > > > >>Cheers
> > > > >>
> > > > >>Tony
> > > > >>
> > > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > Thank you,
> > > David Lauta
> > > [EMAIL PROTECTED]
> > > (561)272-2698
> > > (561)289-0502 cell
> > >
> > > --
> > > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> --
> Thank you,
> David Lauta
> [EMAIL PROTECTED]
> (561)272-2698
> (561)289-0502 cell
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/

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




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread David Lauta

Thanks for the reply,
I understand that you would like me to seperate the UI from the Model
Can you be more specific about
'The recommended control flow is to go through an Action first'
I'm trying to get a one page does it all UI - Is there a tag I should use to invoke
some kind
of preprocess action?

What I am after is populating the List boxes with data from (ultimately) EJB's
I need to decide where I am going to instantiate and initialize my EJB's ( Session
Beans )

To this point in my model I have subclassed ActionForm, Action, and ActionMapping
my struts-config.xml is:
 
  
 

 
  

   
  

 


Should I be using the ActionFormBean instead or in conjunction with the ActionForm
subclass?
>From the ActionForm I can get the ActionMapping through
ActionServlet.findMapping(String)
At what point in time is the servlet associated with ActionForm valid.

Most of my confusion comes from the order of things.
So far my model
1 Create the ActionForm  ( Servlet is null )
2 Initialize the JSP ( all form values are null )
3 Get ActionMapping Name
4 Get ActionMapping Name
5 Create another ActionForm (Servlet is null)
6 Some magic I haven't been able to trace yet
7 The JSP appears and the list boxes are filled in


It seems like I have two instances of ActionMapping and two instances of ActionForm

How should the initialization really occur?


Thanks for your attention
-David Lauta
[EMAIL PROTECTED]

Ted Husted wrote:

> In Struts 1.0.1, init() is called if the ActionForm is instantiated by
> the JavaServer Page. In Struts 1.0, this only happens when the
> ActionForm is instantiated by the ActionServlet. Of course, any default
> values assigned to the fields in the ActionForm class itself will be
> available in either case. The recommended control flow is to go through
> an Action first, and populate the ActionForm there. Populating the
> ActionForm from the JSP is a Model 1 strategy.
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel +1 716 737-3463
> -- http://www.husted.com/struts/
>
> David Lauta wrote:
> >
> > Is there a method in the framework that gets invoked allowing you to
> > initialize the ActionForm before the JSP is displayed?
> >
> > Brett Porter wrote:
> >
> > > That's an interesting design decision. I have always had a form bean and
> > > then another bean containing the actual data. The action copies it across,
> > > processes it, and stores it.
> > >
> > > The reason I'd do it that way is that I imagine the message is a "business
> > > class", and you don't really want you model "polluted" by extending an
> > > ActionForm. Maybe I've been living in OOAD land too long though ;)
> > >
> > > This can trip you up though - at least once I have added the form element,
> > > added it to the bean, added it to the form bean, and forgetten to do the
> > > setter in the action :) The way around that is probably a function in the
> > > form bean that says "fill my business class" and "fill from a business
> > > class". Actually, I might put that in my todo list :D
> > >
> > > Cheers,
> > > Brett
> > >
> > > -Original Message-
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, 29 November 2001 12:48 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > ht ml?
> > >
> > > The data I am storing in the bean is logically different from what the
> > > hidden field value is,  I have a message
> > >
> > > message
> > > {
> > >string  Recipent
> > >string  From
> > >string  MessageBode
> > > }
> > >
> > > And the hidden field is   action=sendMessage and I didn't think that
> > >
> > > message
> > > {
> > >string  Action
> > >string  Recipent
> > >string  From
> > >string  MessageBode
> > > }
> > >
> > > would be the correct thing to do, but I am open to suggestions.  If it
> > > works out easier to put this extra field in my message formbean then I
> > > will do it.  What do you think?
> > >
> > > Cheers
> > >
> > > Tony
> > >
> > > Brett Porter wrote:
> > >
> > > > The question I ask is why you wouldn't put it in your form bean?
> > > >
> > > > I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> > 

Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread Ted Husted

In Struts 1.0.1, init() is called if the ActionForm is instantiated by
the JavaServer Page. In Struts 1.0, this only happens when the
ActionForm is instantiated by the ActionServlet. Of course, any default
values assigned to the fields in the ActionForm class itself will be
available in either case. The recommended control flow is to go through
an Action first, and populate the ActionForm there. Populating the
ActionForm from the JSP is a Model 1 strategy.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


David Lauta wrote:
> 
> Is there a method in the framework that gets invoked allowing you to
> initialize the ActionForm before the JSP is displayed?
> 
> Brett Porter wrote:
> 
> > That's an interesting design decision. I have always had a form bean and
> > then another bean containing the actual data. The action copies it across,
> > processes it, and stores it.
> >
> > The reason I'd do it that way is that I imagine the message is a "business
> > class", and you don't really want you model "polluted" by extending an
> > ActionForm. Maybe I've been living in OOAD land too long though ;)
> >
> > This can trip you up though - at least once I have added the form element,
> > added it to the bean, added it to the form bean, and forgetten to do the
> > setter in the action :) The way around that is probably a function in the
> > form bean that says "fill my business class" and "fill from a business
> > class". Actually, I might put that in my todo list :D
> >
> > Cheers,
> > Brett
> >
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, 29 November 2001 12:48 PM
> > To: Struts Users Mailing List
> > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > ht ml?
> >
> > The data I am storing in the bean is logically different from what the
> > hidden field value is,  I have a message
> >
> > message
> > {
> >string  Recipent
> >string  From
> >string  MessageBode
> > }
> >
> > And the hidden field is   action=sendMessage and I didn't think that
> >
> > message
> > {
> >string  Action
> >string  Recipent
> >string  From
> >string  MessageBode
> > }
> >
> > would be the correct thing to do, but I am open to suggestions.  If it
> > works out easier to put this extra field in my message formbean then I
> > will do it.  What do you think?
> >
> > Cheers
> >
> > Tony
> >
> > Brett Porter wrote:
> >
> > > The question I ask is why you wouldn't put it in your form bean?
> > >
> > > I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> > > any day! :)
> > >
> > > -Original Message-
> > > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, 29 November 2001 12:36 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > > html?
> > >
> > >
> > > Yup, using the taglib makes it compulsory to have that field in your
> > > FormBean
> > >
> > > On Thursday 29 November 2001 09:25 am, you wrote:
> > >
> > >>Hi
> > >>
> > >>I want to include a hidden field in a form which I have.  I do not want
> > >>this information to be included in the formbean which is defined for
> > >>this page.  How can I do this?  Should I just use plain html
> > >>
> > >>
> > >>
> > >>without using the html taglib supplied with struts?
> > >>
> > >>Cheers
> > >>
> > >>Tony
> > >>
> > >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> 
> --
> Thank you,
> David Lauta
> [EMAIL PROTECTED]
> (561)272-2698
> (561)289-0502 cell
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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




RE: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread Jon.Ridgway

Hi,

No. You need (I think) to code it yourself. See my previous response to
'hidden tag and request object'. 

It would be nice if you could specify that you wanted your form
pre-populated. 


Jon.

-Original Message-
From: David Lauta [mailto:[EMAIL PROTECTED]] 
Sent: 29 November 2001 14:04
To: Struts Users Mailing List
Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

Is there a method in the framework that gets invoked allowing you to
initialize the ActionForm before the JSP is displayed?


Brett Porter wrote:

> That's an interesting design decision. I have always had a form bean and
> then another bean containing the actual data. The action copies it across,
> processes it, and stores it.
>
> The reason I'd do it that way is that I imagine the message is a "business
> class", and you don't really want you model "polluted" by extending an
> ActionForm. Maybe I've been living in OOAD land too long though ;)
>
> This can trip you up though - at least once I have added the form element,
> added it to the bean, added it to the form bean, and forgetten to do the
> setter in the action :) The way around that is probably a function in the
> form bean that says "fill my business class" and "fill from a business
> class". Actually, I might put that in my todo list :D
>
> Cheers,
> Brett
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 29 November 2001 12:48 PM
> To: Struts Users Mailing List
> Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> ht ml?
>
> The data I am storing in the bean is logically different from what the
> hidden field value is,  I have a message
>
> message
> {
>string  Recipent
>string  From
>string  MessageBode
> }
>
> And the hidden field is   action=sendMessage and I didn't think that
>
> message
> {
>string  Action
>string  Recipent
>string  From
>string  MessageBode
> }
>
> would be the correct thing to do, but I am open to suggestions.  If it
> works out easier to put this extra field in my message formbean then I
> will do it.  What do you think?
>
> Cheers
>
> Tony
>
> Brett Porter wrote:
>
> > The question I ask is why you wouldn't put it in your form bean?
> >
> > I prefer form.getAction() over httpServletRequest.getParameter( "action"
)
> > any day! :)
> >
> > -Original Message-
> > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, 29 November 2001 12:36 PM
> > To: Struts Users Mailing List
> > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > html?
> >
> >
> > Yup, using the taglib makes it compulsory to have that field in your
> > FormBean
> >
> > On Thursday 29 November 2001 09:25 am, you wrote:
> >
> >>Hi
> >>
> >>I want to include a hidden field in a form which I have.  I do not want
> >>this information to be included in the formbean which is defined for
> >>this page.  How can I do this?  Should I just use plain html
> >>
> >>
> >>
> >>without using the html taglib supplied with struts?
> >>
> >>Cheers
> >>
> >>Tony
> >>
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>

--
Thank you,
David Lauta
[EMAIL PROTECTED]
(561)272-2698
(561)289-0502 cell



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

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




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread David Lauta

Is there a method in the framework that gets invoked allowing you to
initialize the ActionForm before the JSP is displayed?


Brett Porter wrote:

> That's an interesting design decision. I have always had a form bean and
> then another bean containing the actual data. The action copies it across,
> processes it, and stores it.
>
> The reason I'd do it that way is that I imagine the message is a "business
> class", and you don't really want you model "polluted" by extending an
> ActionForm. Maybe I've been living in OOAD land too long though ;)
>
> This can trip you up though - at least once I have added the form element,
> added it to the bean, added it to the form bean, and forgetten to do the
> setter in the action :) The way around that is probably a function in the
> form bean that says "fill my business class" and "fill from a business
> class". Actually, I might put that in my todo list :D
>
> Cheers,
> Brett
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 29 November 2001 12:48 PM
> To: Struts Users Mailing List
> Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> ht ml?
>
> The data I am storing in the bean is logically different from what the
> hidden field value is,  I have a message
>
> message
> {
>string  Recipent
>string  From
>string  MessageBode
> }
>
> And the hidden field is   action=sendMessage and I didn't think that
>
> message
> {
>string  Action
>string  Recipent
>string  From
>string  MessageBode
> }
>
> would be the correct thing to do, but I am open to suggestions.  If it
> works out easier to put this extra field in my message formbean then I
> will do it.  What do you think?
>
> Cheers
>
> Tony
>
> Brett Porter wrote:
>
> > The question I ask is why you wouldn't put it in your form bean?
> >
> > I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> > any day! :)
> >
> > -Original Message-
> > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, 29 November 2001 12:36 PM
> > To: Struts Users Mailing List
> > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > html?
> >
> >
> > Yup, using the taglib makes it compulsory to have that field in your
> > FormBean
> >
> > On Thursday 29 November 2001 09:25 am, you wrote:
> >
> >>Hi
> >>
> >>I want to include a hidden field in a form which I have.  I do not want
> >>this information to be included in the formbean which is defined for
> >>this page.  How can I do this?  Should I just use plain html
> >>
> >>
> >>
> >>without using the html taglib supplied with struts?
> >>
> >>Cheers
> >>
> >>Tony
> >>
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>

--
Thank you,
David Lauta
[EMAIL PROTECTED]
(561)272-2698
(561)289-0502 cell



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




Re: Hidden Field in a form. Do I use struts taglib or vanilla ht ml?

2001-11-29 Thread Ted Husted

If the ActionForm were a business object, then you would be right in
thinking that the data is logically different. 

But since the ActionForm is a presention object, it makes perfect sense
to store the "action" here.

The purpose of the ActionForm is to store the user gestures, which then
are mapped to business objects. But the ActionForm itself is not the
"message" object. It is what we use to create a business object based on
what the user tells us. Here part of what the user is telling us is
"sendMessage".

So, add it here, just don't add it to your internal "message" object,
which probably has a sendMessage method instead.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


[EMAIL PROTECTED] wrote:
> 
> The data I am storing in the bean is logically different from what the
> hidden field value is,  I have a message
> 
> message
> {
>string  Recipent
>    string  From
>string  MessageBode
> }
> 
> And the hidden field is   action=sendMessage and I didn't think that
> 
> message
> {
>string  Action
>string  Recipent
>string  From
>string  MessageBode
> }
> 
> would be the correct thing to do, but I am open to suggestions.  If it
> works out easier to put this extra field in my message formbean then I
> will do it.  What do you think?
> 
> Cheers
> 
> Tony
> 
> Brett Porter wrote:
> 
> > The question I ask is why you wouldn't put it in your form bean?
> >
> > I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> > any day! :)
> >
> > -Original Message-
> > From: Yee Keat [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, 29 November 2001 12:36 PM
> > To: Struts Users Mailing List
> > Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> > html?
> >
> >
> > Yup, using the taglib makes it compulsory to have that field in your
> > FormBean
> >
> > On Thursday 29 November 2001 09:25 am, you wrote:
> >
> >>Hi
> >>
> >>I want to include a hidden field in a form which I have.  I do not want
> >>this information to be included in the formbean which is defined for
> >>this page.  How can I do this?  Should I just use plain html
> >>
> >>
> >>
> >>without using the html taglib supplied with struts?
> >>
> >>Cheers
> >>
> >>Tony
> >>
> >
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-29 Thread Ted Husted

Brett Porter wrote:
> This can trip you up though - at least once I have added the form element,
> added it to the bean, added it to the form bean, and forgetten to do the
> setter in the action :) The way around that is probably a function in the
> form bean that says "fill my business class" and "fill from a business
> class". Actually, I might put that in my todo list :D

If it helps, here are some methods that do that using reflection. Set
fills this object from another object. Populate fills another object
from this object. I have the luxury of placing these on my base business
class, but, given comparable exceptions, they would work just as well on
an ActionForm. (Hmmm.)

public void set(Object o) throws ModelException {
try {
BeanUtils.populate(this,BeanUtils.describe(o));
} catch (Throwable t) {
throw new ModelPopulateException(t);
  }
};

public void populate(Object o) throws ModelException {
try {
BeanUtils.populate(o,BeanUtils.describe(this));
} catch (Throwable t) {
throw new ModelPopulateException(t);
  }
}

If there were a mismatch between the property names, one way around that
would be to replace the call to BeanUtils.describe withy a custom
version that generated the appropriate hashmap for the target bean.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-28 Thread Shri

by having a 'HTML' hidden field, you will loose the mapping of form elements
to properties in the form bean, action class cannot access the value of it.

Shri

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 29 November 2001 12:26 PM
To: Struts Users Mailing List
Subject: Hidden Field in a form. Do I use struts taglib or vanilla html?


Hi

I want to include a hidden field in a form which I have.  I do not want
this information to be included in the formbean which is defined for
this page.  How can I do this?  Should I just use plain html



without using the html taglib supplied with struts?

Cheers

Tony



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


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




RE: Hidden Field in a form. Do I use struts taglib or vanilla ht ml?

2001-11-28 Thread Brett Porter

That's an interesting design decision. I have always had a form bean and
then another bean containing the actual data. The action copies it across,
processes it, and stores it.

The reason I'd do it that way is that I imagine the message is a "business
class", and you don't really want you model "polluted" by extending an
ActionForm. Maybe I've been living in OOAD land too long though ;)

This can trip you up though - at least once I have added the form element,
added it to the bean, added it to the form bean, and forgetten to do the
setter in the action :) The way around that is probably a function in the
form bean that says "fill my business class" and "fill from a business
class". Actually, I might put that in my todo list :D

Cheers,
Brett

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 29 November 2001 12:48 PM
To: Struts Users Mailing List
Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
ht ml?


The data I am storing in the bean is logically different from what the 
hidden field value is,  I have a message

message
{
   string  Recipent
   string  From
   string  MessageBode
}

And the hidden field is   action=sendMessage and I didn't think that

message
{
   string  Action
   string  Recipent
   string  From
   string  MessageBode
}

would be the correct thing to do, but I am open to suggestions.  If it 
works out easier to put this extra field in my message formbean then I 
will do it.  What do you think?

Cheers

Tony



Brett Porter wrote:

> The question I ask is why you wouldn't put it in your form bean?
> 
> I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> any day! :)
> 
> -Original Message-
> From: Yee Keat [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 29 November 2001 12:36 PM
> To: Struts Users Mailing List
> Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> html?
> 
> 
> Yup, using the taglib makes it compulsory to have that field in your
> FormBean
> 
> On Thursday 29 November 2001 09:25 am, you wrote:
> 
>>Hi
>>
>>I want to include a hidden field in a form which I have.  I do not want
>>this information to be included in the formbean which is defined for
>>this page.  How can I do this?  Should I just use plain html
>>
>>
>>
>>without using the html taglib supplied with struts?
>>
>>Cheers
>>
>>Tony
>>
> 




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



Re: Hidden Field in a form. Do I use struts taglib or vanilla ht ml?

2001-11-28 Thread antony

The data I am storing in the bean is logically different from what the 
hidden field value is,  I have a message

message
{
   string  Recipent
   string  From
   string  MessageBode
}

And the hidden field is   action=sendMessage and I didn't think that

message
{
   string  Action
   string  Recipent
   string  From
   string  MessageBode
}

would be the correct thing to do, but I am open to suggestions.  If it 
works out easier to put this extra field in my message formbean then I 
will do it.  What do you think?

Cheers

Tony



Brett Porter wrote:

> The question I ask is why you wouldn't put it in your form bean?
> 
> I prefer form.getAction() over httpServletRequest.getParameter( "action" )
> any day! :)
> 
> -Original Message-
> From: Yee Keat [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 29 November 2001 12:36 PM
> To: Struts Users Mailing List
> Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
> html?
> 
> 
> Yup, using the taglib makes it compulsory to have that field in your
> FormBean
> 
> On Thursday 29 November 2001 09:25 am, you wrote:
> 
>>Hi
>>
>>I want to include a hidden field in a form which I have.  I do not want
>>this information to be included in the formbean which is defined for
>>this page.  How can I do this?  Should I just use plain html
>>
>>
>>
>>without using the html taglib supplied with struts?
>>
>>Cheers
>>
>>Tony
>>
> 




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




Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-28 Thread Erik Hatcher

Won't hurt.

You'll just have to use request.getParameter("action") in your Action to get
it.


- Original Message -
From: <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, November 28, 2001 8:25 PM
Subject: Hidden Field in a form. Do I use struts taglib or vanilla html?


> Hi
>
> I want to include a hidden field in a form which I have.  I do not want
> this information to be included in the formbean which is defined for
> this page.  How can I do this?  Should I just use plain html
>
> 
>
> without using the html taglib supplied with struts?
>
> Cheers
>
> Tony
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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




RE: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-28 Thread Brett Porter

The question I ask is why you wouldn't put it in your form bean?

I prefer form.getAction() over httpServletRequest.getParameter( "action" )
any day! :)

-Original Message-
From: Yee Keat [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 29 November 2001 12:36 PM
To: Struts Users Mailing List
Subject: Re: Hidden Field in a form. Do I use struts taglib or vanilla
html?


Yup, using the taglib makes it compulsory to have that field in your
FormBean

On Thursday 29 November 2001 09:25 am, you wrote:
> Hi
>
> I want to include a hidden field in a form which I have.  I do not want
> this information to be included in the formbean which is defined for
> this page.  How can I do this?  Should I just use plain html
>
> 
>
> without using the html taglib supplied with struts?
>
> Cheers
>
> Tony

-- 
Cheers,

Yee Keat

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



Re: Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-28 Thread Yee Keat

Yup, using the taglib makes it compulsory to have that field in your FormBean

On Thursday 29 November 2001 09:25 am, you wrote:
> Hi
>
> I want to include a hidden field in a form which I have.  I do not want
> this information to be included in the formbean which is defined for
> this page.  How can I do this?  Should I just use plain html
>
> 
>
> without using the html taglib supplied with struts?
>
> Cheers
>
> Tony

-- 
Cheers,

Yee Keat

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




Hidden Field in a form. Do I use struts taglib or vanilla html?

2001-11-28 Thread antony

Hi

I want to include a hidden field in a form which I have.  I do not want 
this information to be included in the formbean which is defined for 
this page.  How can I do this?  Should I just use plain html



without using the html taglib supplied with struts?

Cheers

Tony



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