RE: Upgrading to 1.1 final validation problem...

2003-09-27 Thread João Luz
Sorry for the typo "But now when the page is not".  I wanted to say : "But
when the page parameter is not present in request it sends..."
Thanks

-Original Message-
From: João Luz [mailto:[EMAIL PROTECTED]
Sent: domingo, 28 de Setembro de 2003 3:58
To: [EMAIL PROTECTED]
Subject: Upgrading to 1.1 final validation problem...


Hi,

I'm doing upgrade from 1.1 beta to 1.1 final and I found some problems with
validation.

In 1.1 final is not required to call explicitly validate when using
DynaValidatorActionForm. This is great.

But now when the page is not it sends a NullPointerException executing , and
not uses the initial value specified in struts-config.

java.lang.NullPointerException
at
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.jav
a:141)
at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.j
ava:942)

Any clue or this is supposed to happen?

Thanks,
João



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



Upgrading to 1.1 final validation problem...

2003-09-27 Thread João Luz
Hi,

I'm doing upgrade from 1.1 beta to 1.1 final and I found some problems with
validation.

In 1.1 final is not required to call explicitly validate when using
DynaValidatorActionForm. This is great.

But now when the page is not it sends a NullPointerException executing , and
not uses the initial value specified in struts-config.

java.lang.NullPointerException
at
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.jav
a:141)
at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.j
ava:942)

Any clue or this is supposed to happen?

Thanks,
João



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



Re:[PARTLY SOLVED] workflow - Re: integration with other app

2003-09-27 Thread Adam L
Okay.. the back button going to the prior screen.. you'd think i've never
done webapps before.. my no-cache headers were missing. that's resolved.

I've begun to grok the workflow pattern a bit more, and here's what i've
come up with

  I was picturing the overall task as a workflow.  However, if you look at
each discrete unit of work in the entire task, each unit is actually its own
workflow.  And, the pieces/steps of that unit are what you should use to
define individual "workflows" in the sense of the extension.
 Ergo, task 1 has steps 1, 2 and 3.  which gives you workflow1, workflow2,
and workflow3.
each workflow should likely have 2 steps:   display the page (enter
the workflow), and submit data from that page (end of workflow).  along with
these 2 steps, there is also a possible workflow violation, which, ideally,
should flow you to the 'display the page' step.   Each end(termination) of a
workflow's primary flow will lead into the next step's 2ndary workflow
chain.

  granted, this is a very simplistic overview, and not applicable for all
tasks.. but, it's a nice foundation step that wasn't readily obvious in the
documentation (or I was just being horribly dense).

 So, have I grokked this properly ?  Is there something else I"m missing?

-- adam



- Original Message -
From: "Adam L" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, September 27, 2003 2:58 PM
Subject: Re: workflow - Re: integration with other app


> Matthias:
>
>I've been dinking with this workflow extension for awhile, amidst other
> madness, and here's what I've come to observe.   Please let me know if my
> observations are correct, and if there's not a "better/easier" way to
> achieve my goals:
>
>I have a logical process flow for achieving the task of entering new
> data.  This requires 7 different screens on input information, as each
> subsequent entry page requires info from the prior. I originally
defined
> this as one primary "workflow".  Everything flows from one page to the
next,
> so long as I don't use the browser back button and change prior
information.
> If I do this (hit browser back, change  a form field, submit),  the next
> page ends up blank; granted, I haven't added any "back button" links to
the
> page.  This is obviously due to a workflow violation exception being
thrown.
> That's fine.However, in order for the workflow engine to redirect the
> user to the proper page,  it appears i'm going to have to break down my
one
> workflow into 7 individual "workflows", each leading to eachother using
> primary and secondary flows, and then adding in a global foward for a
> violation for each one of those new 7 segments.   Is this correct?  It
seems
> like a lot of work for a simple process, and I'm afraid I'm missing
> something.
>
>Also, back to the browser back button.  In running the demo, I can see
> that hitting the browser back from wizard page 2 will continually redirect
> me back to wizard page 2.  yet, in my application, hitting the back button
> just takes me to the prior screen.  Is this a result of not having the
> violation logic in place?  If so, why isn't there a blank screen like I
> described above?
>
>Thank you for any insight you can provide.
>
> -- adam
>
>
> - Original Message -
> From: "Matthias Bauer" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, September 15, 2003 1:59 AM
> Subject: Re: workflow - Re: integration with other app
>
>
> > Fortunately I am far enough away to avoid your kiss ;-)
> >
> > Please let me know, if you believe something is missing. I am sure I can
> > give you some more hints on how to solve a specific task. The Struts
> > Workflow Extension is a very powerful, yet low-level framework. Thus, it
> > offers very much flexibility but sometimes the right way to achieve a
> > solution is not as apparent as desired.
> >
> > Just in case you are interested: We are also offering commercial support
> > for this extension and Struts itself.
> >
> > --- Matthias
> >
> >
> > Adam Levine wrote:
> >
> > > Matthias:
> > >  I could kiss you!   I've been struggling with this issue and have
> > > been going bald over the last week doing a lot of my own engine
> > > work.   I can't wait to try this out and see if it doesn't work for me
> > > as cleanly as it looks.
> > >
> > >
> > >
> > >
> > > From: Matthias Bauer <[EMAIL PROTECTED]>
> > > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > > To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > > Subject: Re: workflow - Re: integration with other app
> > > Date: Fri, 12 Sep 2003 08:35:36 +0200
> > >
> > > Martin,
> > >
> > > the Struts Workflow Extension http://www.livinglogic.de/Struts/
> > > addresses some of the issues you raise. Especially the thing about a
> > > workflow scope. But it is also easily possible to build reusable
> > > action sequences: Consider for instance a confirmation dialog that
> 

RE: japanese in form

2003-09-27 Thread Amit Rana
Jason,

Thanks for your response.

Setting the filter worked for me. Re-submited forms now show proper
Japanese.

The link you provided is a good resource but point 3 is wrong. Instead
of UTF-8 the encoding there should be the encoding of the source file.

Thanks.
Amit.

> -Original Message-
> From: Jason Lea [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 26, 2003 12:50 PM
> To: Struts Users Mailing List
> Subject: Re: japanese in form
> 
> Try this link
> 
> http://www.anassina.com/struts/i18n/i18n.html
> 
> and look item number 7.
> 
> The form data being submitted might not be being read as Shift_JIS or
> UTF-8 but instead the default ISO-8859-1 format.
> 
> You need to set the character encoding of the request before Struts
puts
> the request parameters into your ActionForm.  As suggested in the link
> above, a filter can be used to set the encoding.
> 
> Amit Rana wrote:
> 
> > Hi,
> > I am having exactly same problem as in this thread
> >
http://www.mail-archive.com/[EMAIL PROTECTED]/msg38443.html
> > i.e. Japanese in the form elements (textboxes) becomes garbage once
form
> > is re-shown. I have this tiles/struts application Japanese from
> > properties or from form is displayed problem but when form is
> > re-displayed Japanese becomes garbage.
> >
> > I have tried putting all the combinations given in
> >
http://www.mail-archive.com/[EMAIL PROTECTED]/msg12490.html
> >
> >
> > Can anyone suggest what can be done to solve this problem?
> >
> > Regards,
> > Amit.
> >
> >
> >
-
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> --
> Jason Lea
> 



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



Re: Html tags and "indexed" property - how does it work?

2003-09-27 Thread Graham Leggett
Ted Husted wrote:

This is really a USER list question, but you may be looking for the 
indexed properties how-to:

http://jakarta.apache.org/struts/faqs/indexedprops.html
I have gone through this howto, but its description of what to do is 
very vague. Here is what I have tried so far:

I have a DynaActionForm with properties defined like so:

  
  
I populate the above inside my action, and display it successfully 
something like so:


  " size="15" />
  


The above html renders an input text tag, and a submit tag, with correct 
values populated from the DynaActionForm, but incorrect names:

org.apache.struts.taglib.html.BEAN[0].policycoverSumInsureds[0]
policycoverLess[0]
If I submit the form using an external-to-the-above=loop submit button, 
I get no errors, and the DynaActionForm bean is _not_ populated with the 
input text field, which is ignored.

If I attempt to use the "policycoverLess" submit button, struts bombs 
out with the following exception:

java.lang.ArrayIndexOutOfBoundsException
	at java.lang.reflect.Array.set(Native Method)
	at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:459)
	at 
org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(PropertyUtils.java:1414)
	at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1013)
	at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1104)

Can anyone shed any light on what I am doing wrong, or can give me a 
piece of clear example code to show what I should be doing?

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


Re: using JAAS with Struts

2003-09-27 Thread Aymeric Alibert
You might want to check the Virtual Shopping Mall sample application
from Oracle. It uses JAAS.
 http://otn.oracle.com/sample_code/tech/java/j2ee/vsm13/index.html
 
Aymeric.

>>> [EMAIL PROTECTED] 09/27/03 07:59AM >>>
how to use the jaas framework with struts for Oracle9iAS. If anybody
knows about that please help. And also if u have any sample application
please send me at [EMAIL PROTECTED] . Its very urgent. Any
suggestion are welcome.

Thank u in advance
Muthu Subramaniam



Re: BeanMapping WAS: [Poll] action mappings

2003-09-27 Thread Adam Hardy
Yes, it answers my question. I use the BeanUtils.copyProperties() to 
move data back and forth between my transfer objects and my dynaforms 
and I don't like doing that because

(a) it seems an unnecessary step since I'm already marshalling data into 
& out of resultsets

(b) I have to maintain the object field/member variable information in 
yet another place (UML, database schema, xml schema, struts-config (& 
possibly HTML should be on this list too))

(c) BeanUtils won't convert strings based on locale-specific information 
(yet, AFAIK though it might be in the pipeline)

re (b), when I only have to specify that in one place, I know that I 
will have died and gone to programmer heaven :)

On 09/27/2003 05:00 PM Sgarlata Matt wrote:
Hmm well I do sometimes use different types in my DynaForms, but I think I
want to move away from this practice in the future.  There was a fairly good
discussion of this in the post "[repost] Special view information ->
ActionForm or request?" starting on 9/18.
To answer your real question about using DynaForms as transfer objects, I
only use them if I am transferring data from the presentation tier down to
the business tier.  I use the DynaBean interface to do this.  It's pretty
slick how this works.  If for some reason I decide not to use DynaActionForm
at some point in the future you can make a POJO into a DynaBean by just
passing "new WrapDynaBean(pojo)".  If you want your business tier to have
things already nicely placed in the correct type you could always use
ConvertUtils to populate a strongly-typed POJO from your ActionForm.  Or if
you want to use a typed DynaBean I think you can declare your own DynaClass
or something, but I'm not really sure on all the specifics of this process.
Does that answer your question?

Matt
- Original Message - 
From: "Adam Hardy" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, September 27, 2003 10:40 AM
Subject: Re: BeanMapping WAS: [Poll] action mappings



Hey Matt,
do you use different types in your dynaforms or do you stick to just
strings? I was wondering about using dynaforms as transfer objects like
you mention, but I only use strings, since incorrect form entries for
non-string types don't make it back into the form after validation
failure.

And I would want to have types in my transfer objects.

Adam

On 09/26/2003 10:44 PM Sgarlata Matt wrote:

- Original Message - 
From: "Mainguy, Mike" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, September 25, 2003 3:35 PM
Subject: BeanMapping WAS: [Poll] action mappings




I think your way is perfectly acceptable.  I like to try and use the
supplied interfaces (i.e. DynaBean) if they suit my needs and, to date,
DynaBean has served me well.  You can use BeanUtils to map DynaBeans to
POJO's and visa versa (as a matter of fact you can to it to/from  maps
also


I believe).


After working with DynaBeans some more, I agree with you.  I am going to
use

them as my type for transfer objects as well instead of the strategy I
outlined before where I defined my own IInputForm and IDynaInputForm
interfaces.


My only gripe with using the commons-beanutils would be that I would
perhaps


like to have a couple levels of DynaBean and perhaps at the simplest
level

only have an interface like you describe (i.e. fewer methods in
implement).

I would like to see an empty interface called
org.apache.commons.beanutils.Bean, but I can see that being a huge point
of

contention so I'm not going to press for it.

Matt

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

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
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]

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: workflow - Re: integration with other app

2003-09-27 Thread Adam L
Matthias:

   I've been dinking with this workflow extension for awhile, amidst other
madness, and here's what I've come to observe.   Please let me know if my
observations are correct, and if there's not a "better/easier" way to
achieve my goals:

   I have a logical process flow for achieving the task of entering new
data.  This requires 7 different screens on input information, as each
subsequent entry page requires info from the prior. I originally defined
this as one primary "workflow".  Everything flows from one page to the next,
so long as I don't use the browser back button and change prior information.
If I do this (hit browser back, change  a form field, submit),  the next
page ends up blank; granted, I haven't added any "back button" links to the
page.  This is obviously due to a workflow violation exception being thrown.
That's fine.However, in order for the workflow engine to redirect the
user to the proper page,  it appears i'm going to have to break down my one
workflow into 7 individual "workflows", each leading to eachother using
primary and secondary flows, and then adding in a global foward for a
violation for each one of those new 7 segments.   Is this correct?  It seems
like a lot of work for a simple process, and I'm afraid I'm missing
something.

   Also, back to the browser back button.  In running the demo, I can see
that hitting the browser back from wizard page 2 will continually redirect
me back to wizard page 2.  yet, in my application, hitting the back button
just takes me to the prior screen.  Is this a result of not having the
violation logic in place?  If so, why isn't there a blank screen like I
described above?

   Thank you for any insight you can provide.

-- adam


- Original Message -
From: "Matthias Bauer" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, September 15, 2003 1:59 AM
Subject: Re: workflow - Re: integration with other app


> Fortunately I am far enough away to avoid your kiss ;-)
>
> Please let me know, if you believe something is missing. I am sure I can
> give you some more hints on how to solve a specific task. The Struts
> Workflow Extension is a very powerful, yet low-level framework. Thus, it
> offers very much flexibility but sometimes the right way to achieve a
> solution is not as apparent as desired.
>
> Just in case you are interested: We are also offering commercial support
> for this extension and Struts itself.
>
> --- Matthias
>
>
> Adam Levine wrote:
>
> > Matthias:
> >  I could kiss you!   I've been struggling with this issue and have
> > been going bald over the last week doing a lot of my own engine
> > work.   I can't wait to try this out and see if it doesn't work for me
> > as cleanly as it looks.
> >
> >
> >
> >
> > From: Matthias Bauer <[EMAIL PROTECTED]>
> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > Subject: Re: workflow - Re: integration with other app
> > Date: Fri, 12 Sep 2003 08:35:36 +0200
> >
> > Martin,
> >
> > the Struts Workflow Extension http://www.livinglogic.de/Struts/
> > addresses some of the issues you raise. Especially the thing about a
> > workflow scope. But it is also easily possible to build reusable
> > action sequences: Consider for instance a confirmation dialog that
> > demands the user to press a "Yes" and "No" button. You will need this
> > multiple times within an application, but you normally want to code
> > the necessary actions only once and reuse them in different contexts
> > (i. e. with a customized question and return action).
> >
> > Please let me know, when you have any questions related to the Struts
> > Workflow Extension.
> >
> > --- Matthias
> >
> > Martin Naskovski wrote:
> >
> >> One thing I find particularly cumbersome in Struts is web page
> >> workflow. Currently, if I want to push "Cancel" for instance, or
> >> "Submit" on a certain page, in the Action itself, I have to hard code
> >> where to go next and/or pass any dynamically generated parameters
> >> through the request scope or the query string (if doing a
> >> sendRedirect). I also have to use hidden form fields to tell each
> >> submission button on a form, where to go next, depending on where I
> >> came from (a certain action mapping, e.g.).
> >>
> >> Is there a better way to do this, where the flow of the screens can be
> >> specified statically, or maybe if not statically at least within a
> >> screen workflow module that each action will tell that module where
> >> to go next, depending on what button was pushed on that form?
> >>
> >> Does JSF address this perhaps? Or has someone independently made a
> >> Struts pluggable module that can control screen flow? It seems there
> >> almost is a need for some sort of a 'workflow' scope, where when I
> >> start a certain use-case from one of the menus in the application, the
> >> 'workflow scope' is preserved throughout the use-case lifetime, and if
> >>

Re: Reasons for using Struts

2003-09-27 Thread David Graham

--- Martin Gainty <[EMAIL PROTECTED]> wrote:
> What are the reasons for using Struts?
> That is what are the Reasons for which Struts would be a more suitable
> choice than say plain JSP/Servlet?
> 

This has been discussed many times on the list so you can find a lot of
reasons in the archives.  You really can't create a good Java webapp
that's bigger than 5 pages without some kind of framework.  Struts is the
most popular one but there are others out there.

David

> Thanks,
> 
> Martin


__
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: html_image property value not submitted

2003-09-27 Thread Norbert Spemm
Hi Steve,

> The "value" attribute of an HTML 'input type="image"' tag (i.e., what 
> the Struts  tag is generating) is apparently ignored by 
> all (most?) browsers.  See:
> 
> http://www.blooberry.com/indexdot/html/tagpages/i/inputimage.htm

wow, that's pretty lame.

> One solution is to have a hidden variable in your HTML form 
> associated with your form bean (let's use the bean property 
> name "action") and then use JavaScript to set this property 

I'm rigid thinking that no web page really _requires_ JavaScript, not at
least because some clients using my application will not allow active
scripting in their browser. Sites like e. g. www.hp.com (view with
disabled JS) make me feel confirmed.

Isn't it possible to iterate the request parameters if there's one that
has ".x" and ".y" suffix? Since no one really wants to submit values
with a name like this I suggest the struts framework automatically
generates a parameter so the handling in the action is consistent as for
a submit button. Of course there has to be some tag defining the name of
the "action" parameter.

Wouldn't that be nice?

This method work for me:

String getActionParameter(Map p_Keys)
{
String l_Key;
Iterator l_iKeys = p_Keys.keySet().iterator();

while (l_iKeys.hasNext())
{
l_Key = (String)l_iKeys.next();
if( l_Key.endsWith(".x") 
 && p_Keys.containsKey(l_Key.substring(0, l_Key.length()-1)
+ "y"))
{
return l_Key;
}
}
return null;
}

To be used in the execute method of the action:

String l_Action = getActionParameter(p_Request.getParameterMap());

Thanks for help
 Nobi


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



Re: Accessing action error problem

2003-09-27 Thread Manish Singla
a) Get ServletContext of Globals.ERROR_KEY.
b) Typecast to ActionErrors
c) Use errors.get(property)
d) (c) wil return Iterator ..


Sgarlata Matt wrote:

> You can use the attached JSPs to display all the attributes in the request.
> Just look for the attribute that stores the errors.  In general when I was
> starting with Struts I found the attached JSPs very helpful because you can
> see the types of information Struts stores for you and where it is stored.
> Also, if you look at the Globals class the locations for many of these
> attributes are recorded there.  I just find it easier to look at the actual
> attributes in the request using the attached JSPs rather than hunting
> through the javadoc of the Globals class.
>
> Matt
> - Original Message -
> From: "Pete Serafin" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 02, 2003 1:32 PM
> Subject: Accessing action error problem
>
> > Im am trying to determine a way to find out if an ActionError exists in my
> request.  I create an error in my action class as follows:
> >
> > ActionErrors errors = new ActionErrors();
> > errors.add( "startDate",new
> ActionError("error.form.requiredField.startDate") );
> > saveErrors( request, errors );
> >
> > I can access the error using the  tag, but all I actuallt
> want to do is check that the startDate error is not null. How can I try to
> grab this object from the HttpServletRequest object?
> >
> > The whole point is to execute some logic that hides some html if an error
> exists.  Any suggestions?
> >
> > Pete Serafin
> > HealthCare Recruiters International
> >
>
>   
> Name: debug.zip
>debug.zipType: Zip Compressed Data (application/x-zip-compressed)
> Encoding: base64
>
>   
> -
> 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: Access to the form bean from jsp?

2003-09-27 Thread Bjørn T Johansen
Yes, you are absolutely correct; it uses the name I defined in
struts-config, I should have known...

Thanks :)


BTJ

On Sat, 2003-09-27 at 19:11, Anders Hermansen wrote:
> * Bjørn T Johansen ([EMAIL PROTECTED]) wrote:
> > I need to access the form from my jsp page, but I can't seem to find a
> > way to do this.. I need a name of the form to access but what is the
> > name of the form instance that Struts generate? If I have a form named
> > LoginForm does Struts make an instance called loginForm or does it
> > choose a random name or?
> 
> You specify the name when you declare a form bean in struts-config.xml
> 
> in example:
>   
> 
> In the jsp you can define a variable to point to this form using:
>/>
> you can then use myLoginForm in any scriptlet.
> 
> You can also easily extract specific properties:
>   
> 
> or you can print them directly:
>   
> 
> This is all from memory, so I hope it's correct.
> 
> 
> Hope this helps,
> Anders
> 
> --
> Anders Hermansen
> YoYo Mobile as
> 
> -
> 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: Access to the form bean from jsp?

2003-09-27 Thread Anders Hermansen
* Bjørn T Johansen ([EMAIL PROTECTED]) wrote:
> I need to access the form from my jsp page, but I can't seem to find a
> way to do this.. I need a name of the form to access but what is the
> name of the form instance that Struts generate? If I have a form named
> LoginForm does Struts make an instance called loginForm or does it
> choose a random name or?

You specify the name when you declare a form bean in struts-config.xml

in example:
  

In the jsp you can define a variable to point to this form using:
  
you can then use myLoginForm in any scriptlet.

You can also easily extract specific properties:
  

or you can print them directly:
  

This is all from memory, so I hope it's correct.


Hope this helps,
Anders

--
Anders Hermansen
YoYo Mobile as

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



Access to the form bean from jsp?

2003-09-27 Thread Bjørn T Johansen
I need to access the form from my jsp page, but I can't seem to find a
way to do this.. I need a name of the form to access but what is the
name of the form instance that Struts generate? If I have a form named
LoginForm does Struts make an instance called loginForm or does it
choose a random name or?


Regards,

BTJ


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



Re: Accessing action error problem

2003-09-27 Thread Sgarlata Matt
You can use the attached JSPs to display all the attributes in the request.
Just look for the attribute that stores the errors.  In general when I was
starting with Struts I found the attached JSPs very helpful because you can
see the types of information Struts stores for you and where it is stored.
Also, if you look at the Globals class the locations for many of these
attributes are recorded there.  I just find it easier to look at the actual
attributes in the request using the attached JSPs rather than hunting
through the javadoc of the Globals class.

Matt
- Original Message - 
From: "Pete Serafin" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 1:32 PM
Subject: Accessing action error problem


> Im am trying to determine a way to find out if an ActionError exists in my
request.  I create an error in my action class as follows:
>
> ActionErrors errors = new ActionErrors();
> errors.add( "startDate",new
ActionError("error.form.requiredField.startDate") );
> saveErrors( request, errors );
>
> I can access the error using the  tag, but all I actuallt
want to do is check that the startDate error is not null. How can I try to
grab this object from the HttpServletRequest object?
>
> The whole point is to execute some logic that hides some html if an error
exists.  Any suggestions?
>
> Pete Serafin
> HealthCare Recruiters International
>


debug.zip
Description: Zip compressed data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: [Question] Checkbox multi select problem.

2003-09-27 Thread Rajesh M Vasudevan
Hi,
Can you help me with this..
I want to pass the record ids selected by the user using a checkbox, to the
Action Bean, when the page is submitted.
CheckUnique Rec Ids
X1000
X1001
X1002
X1003
The number of rows is dynamic, as it depends on the number of rows retrieved
from the database.

Please advise how to do this?

Thanks very much,
Rajesh



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



Re: Reasons for using Struts

2003-09-27 Thread Sgarlata Matt
http://jakarta.apache.org/struts/userGuide/introduction.html
- Original Message - 
From: "Martin Gainty" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 27, 2003 12:53 AM
Subject: Reasons for using Struts


What are the reasons for using Struts?
That is what are the Reasons for which Struts would be a more suitable
choice than say plain JSP/Servlet?

Thanks,

Martin


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



RE: html_image property value not submitted

2003-09-27 Thread Steve Armstrong
The "value" attribute of an HTML 'input type="image"' tag (i.e., what the
Struts  tag is generating) is apparently ignored by all (most?)
browsers.  See:

http://www.blooberry.com/indexdot/html/tagpages/i/inputimage.htm

One solution is to have a hidden variable in your HTML form associated with
your form bean (let's use the bean property name "action") and then use
JavaScript to set this property appropriately on submit.  Something like,





In the action associated with your form, you can then consult the "action"
property of your form bean to determine the type of image button that has
been selected.

Cheers,
-Steve

-Original Message-
From: Norbert Spemm [mailto:[EMAIL PROTECTED]
Sent: Friday, September 26, 2003 9:25 PM
To: [EMAIL PROTECTED]
Subject: html_image property value not submitted


Hi,

I wanted to replace the buttons on my form with images.

Before I had a working application with this tag in the jsp:



now I tried with



The problem with the image-version is, that my action now doesn't
receive a value for the parameter "SubmittedAction" anymore. Instead I
only get the parameters SubmittedAction.x and SubmittedAction.y which
are of no use for me.

What am I doing wrong? I'm using Struts 1.1


-
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 tell invalid session vs session timed out

2003-09-27 Thread Steve Armstrong
Hi,

I use the cookie approach outlined here:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg63933.html

There is also another thread involving this issue starting here:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg72578.html

Cheers,
-Steve

-Original Message-
From: Warren Chen [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 7:06 PM
To: Struts Users Mailing List
Subject: how to tell invalid session vs session timed out


Hi All,

Is there any tool in Struts that can tell if an
invalid session is caused by timeout or simply no
session were ever created?

(In my app, the loginAction creates a session and put
some stuff into the session, in each subsequent
request I'll check if session is valid, if not, send
user back to login page - in order to send more
meaningful message to user, I want to tell if invalid
session is caused by timeout out or simply the user
never logged in) 

Thanks a lot!

Warren

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



Re: BeanMapping WAS: [Poll] action mappings

2003-09-27 Thread Sgarlata Matt
Hmm well I do sometimes use different types in my DynaForms, but I think I
want to move away from this practice in the future.  There was a fairly good
discussion of this in the post "[repost] Special view information ->
ActionForm or request?" starting on 9/18.

To answer your real question about using DynaForms as transfer objects, I
only use them if I am transferring data from the presentation tier down to
the business tier.  I use the DynaBean interface to do this.  It's pretty
slick how this works.  If for some reason I decide not to use DynaActionForm
at some point in the future you can make a POJO into a DynaBean by just
passing "new WrapDynaBean(pojo)".  If you want your business tier to have
things already nicely placed in the correct type you could always use
ConvertUtils to populate a strongly-typed POJO from your ActionForm.  Or if
you want to use a typed DynaBean I think you can declare your own DynaClass
or something, but I'm not really sure on all the specifics of this process.

Does that answer your question?

Matt
- Original Message - 
From: "Adam Hardy" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, September 27, 2003 10:40 AM
Subject: Re: BeanMapping WAS: [Poll] action mappings


> Hey Matt,
> do you use different types in your dynaforms or do you stick to just
> strings? I was wondering about using dynaforms as transfer objects like
> you mention, but I only use strings, since incorrect form entries for
> non-string types don't make it back into the form after validation
failure.
>
> And I would want to have types in my transfer objects.
>
> Adam
>
> On 09/26/2003 10:44 PM Sgarlata Matt wrote:
> > - Original Message - 
> > From: "Mainguy, Mike" <[EMAIL PROTECTED]>
> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > Sent: Thursday, September 25, 2003 3:35 PM
> > Subject: BeanMapping WAS: [Poll] action mappings
> >
> >
> >
> >>I think your way is perfectly acceptable.  I like to try and use the
> >>supplied interfaces (i.e. DynaBean) if they suit my needs and, to date,
> >>DynaBean has served me well.  You can use BeanUtils to map DynaBeans to
> >>POJO's and visa versa (as a matter of fact you can to it to/from  maps
> >
> > also
> >
> >>I believe).
> >
> >
> > After working with DynaBeans some more, I agree with you.  I am going to
use
> > them as my type for transfer objects as well instead of the strategy I
> > outlined before where I defined my own IInputForm and IDynaInputForm
> > interfaces.
> >
> >
> >>My only gripe with using the commons-beanutils would be that I would
> >
> > perhaps
> >
> >>like to have a couple levels of DynaBean and perhaps at the simplest
level
> >>only have an interface like you describe (i.e. fewer methods in
> >
> > implement).
> >
> > I would like to see an empty interface called
> > org.apache.commons.beanutils.Bean, but I can see that being a huge point
of
> > contention so I'm not going to press for it.
> >
> > Matt
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -- 
> struts 1.1 + tomcat 4.1.27 + java 1.4.2
> Linux 2.4.20 RH9
>
>
> -
> 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: BeanMapping WAS: [Poll] action mappings

2003-09-27 Thread Adam Hardy
Hey Matt,
do you use different types in your dynaforms or do you stick to just 
strings? I was wondering about using dynaforms as transfer objects like 
you mention, but I only use strings, since incorrect form entries for 
non-string types don't make it back into the form after validation failure.

And I would want to have types in my transfer objects.

Adam

On 09/26/2003 10:44 PM Sgarlata Matt wrote:
- Original Message - 
From: "Mainguy, Mike" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, September 25, 2003 3:35 PM
Subject: BeanMapping WAS: [Poll] action mappings



I think your way is perfectly acceptable.  I like to try and use the
supplied interfaces (i.e. DynaBean) if they suit my needs and, to date,
DynaBean has served me well.  You can use BeanUtils to map DynaBeans to
POJO's and visa versa (as a matter of fact you can to it to/from  maps
also

I believe).


After working with DynaBeans some more, I agree with you.  I am going to use
them as my type for transfer objects as well instead of the strategy I
outlined before where I defined my own IInputForm and IDynaInputForm
interfaces.

My only gripe with using the commons-beanutils would be that I would
perhaps

like to have a couple levels of DynaBean and perhaps at the simplest level
only have an interface like you describe (i.e. fewer methods in
implement).

I would like to see an empty interface called
org.apache.commons.beanutils.Bean, but I can see that being a huge point of
contention so I'm not going to press for it.
Matt

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

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [OT]Combining sites

2003-09-27 Thread Adam Hardy
Hi Denis,
sounds like a bizarre request to make - what is the difference between 
the two authentication mechanisms that can't be reprogrammed on the 
other site? I assume you are not using container-managed authentication 
otherwise it wouldn't be a problem.

You could set up a filter to send a redirect to the other site using a 
JSP that attaches any parameters, such as where to go back to.

Adam
On 09/26/2003 09:28 PM [EMAIL PROTECTED] wrote:
Hello, 

Ok, I have a major problem, and I am ill equipped to handle it.  We developed two websites for a client, hosted on the same server.  One is completely done with struts, the other less so.  Now, my sup has left for his vacation and the client of course pulls a fast one on me.  He wants the second website to handle the secure layer portion for the first website.  IE, someone wants to register at site A.  They come in, are redirected to site B (without noticing), enter SSL, start and complete their registration in SSL, exit SSL, and are redirected back to site A.  I have all the actions to handle registration in site A, but I am not sure how to integrate it seamlessly into site B.  

Can anyone help, offer advice, and point to literature/websites that will educate me on the matter, or at least set me on the right path.

Thank you, 

Denis
--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: DynaActionForm and disabled textfield.

2003-09-27 Thread Adam Hardy
I find using a hidden field easier.

On 09/27/2003 03:25 AM Jan Van Stalle wrote:
Hello,

in IE disabled controls are not submitted (I don't know if this is browser
dependent); you might make a workaround by writing a small javascript which
enables you controls when the user submits the form.
Jan

"Kazda Juraj" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello all,

I just have a quick question:



Is it true, that if I have



it will not transfer to my DynaActionForm, so I am not able to get it's
value in my action?
Or am I something missing?



Thank you for your comments.

-juraj.




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

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


using JAAS with Struts

2003-09-27 Thread Muthu
how to use the jaas framework with struts for Oracle9iAS. If anybody knows about that 
please help. And also if u have any sample application please send me at [EMAIL 
PROTECTED] . Its very urgent. Any suggestion are welcome.

Thank u in advance
Muthu Subramaniam


Re: logic:iterate problem

2003-09-27 Thread Manfred Wolff
Thats not. You use something like  or an other tag that 
uses message resources. But the Struts-Framework can't find the 
resourceBundle..

Manfred

Gregory F. March wrote:

Make sure your getters and setters conform to the Java naming conventions - I 
got burned by something similar and that was the root cause...

HTH...

/greg

On Sep 26, 2003, "MaFai" <[EMAIL PROTECTED]>  wrote:

|Hello, struts-user,
|
|[code]
|
|
|
|
|[/code]
|
|customers is set by request.setAttribute
|
|pps is string value.
|testb is a int value
|
|If remove the testb ,it run smoonthly.
|If change testb to boolean,it also run smoothly.
|Otherwise
|
|It always throw the exception
|
|org.apache.jasper.JasperException: Cannot find message resources under key or
| g.apache.struts.action.MESSAGE
|
|Why?I'm stun at these 2 days.
|
|
|
|
|
|Best regards. 
|
|MaFai
|[EMAIL PROTECTED]
|2003-09-26
|
|
|
|-
|To unsubscribe, e-mail: [EMAIL PROTECTED]
|For additional commands, e-mail: [EMAIL PROTECTED]



--
Gregory F. March-=-http://www.gfm.net:81/~march-=-AIM:GfmNet


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

--
===
Dipl.-Inf. Manfred Wolff
---
phone neusta  : +49 421 20696-27
phone : +49 421 534522
mobil : +49 178 49 18 434
eFax  : +49 1212 6 626 63 965 33
---

Diese E-Mail enthält möglicherweise vertrauliche und/oder rechtlich geschützte 
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich 
erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese 
Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht 
gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



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


Re: how to tell invalid session vs session timed out

2003-09-27 Thread Adam Hardy
Hi,
do you mean you are getting IllegalStateExceptions because you are 
trying to access an invalid session?

Have you tried session.isNew() ?

Adam

On 09/26/2003 01:06 AM Warren Chen wrote:
Hi All,

Is there any tool in Struts that can tell if an
invalid session is caused by timeout or simply no
session were ever created?
(In my app, the loginAction creates a session and put
some stuff into the session, in each subsequent
request I'll check if session is valid, if not, send
user back to login page - in order to send more
meaningful message to user, I want to tell if invalid
session is caused by timeout out or simply the user
never logged in) 

Thanks a lot!

Warren

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

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Going from https on /member.do, back to http on index.jsp?

2003-09-27 Thread Adam Hardy
An elegant solution by Amazon is to require a login everytime the user 
switches into SSL - even if they are logged in already.

Session hijacking still worries me though because the app I am building 
at the moment is quite data intensive, and the customers of the website 
who will use it to enter and store their data will obviously hold it in 
high value. It worries me that some discontented session-hijacker could 
easily destroy the data belonging to someone else.

The problem is that the average surfer would probably consider it weird 
that the whole site runs under SSL. Currently only sites such as PayPal 
do that. How much that could affect sales is something I will have to 
consider.

Adam

On 09/27/2003 03:38 AM Craig R. McClanahan wrote:
Jayaraman Dorai wrote:
-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 10:55 PM
To: Struts Users Mailing List
Subject: Re: Going from https on /member.do, back to http on index.jsp?
Max Cooper wrote:
Creating an index.do is one option. If it is not marked as 
secure, sslext
will write an absolute URL back to http:// for it. Many Struts users
advocate that all requests should be served by Actions, even 
if the action
merely forwards to a JSP.
I actually have a more important concern about doing this -- exposing 
information to people who can listen in on the packets that go back 
and forth.

Many people would like, for example, to have the login form be secure 
so that your password is not sent across the wire encrypted, but then 
go back to http for the rest of the session for the better 
performance.  The seemingly ideal solution is to have the destination 
of the login submit require SSL, and then switch back.  Using a 
 security constraint, you can even let the 
container worry about the http->https transition for you.  Or, you 
can use things like SSLext that is nicely integrated into Struts.

However, the servlet spec offers no help in switching back to http, 
because it is not a recommended practice.  Why?  Consider the fact 
that you now trust subsequent transactions from the same user, and 
are typically using the session that was established earlier (whether 
the session was originally created in http or https turns out not to 
matter).  But the session id is no longer encrypted (it's either in a 
cookie or in rewritten URLs), so it can be easily forged by anyone 
with a network snooper between you and the server.  How do you 
guarantee that an after-login request on that session is not being 
sent by someone who is forging the session id because they snooped it?

I'm a conservative on security issues -- if I have an app that needs 
SSL sometimes, I arrange things to never accept a non-SSL request on 
the same session again, once I've switched to SSL (easy to do with a 
Filter, for example).  If you're concerned enough to protect the 
password, you should be concerned enough to pay the CPU overhead for 
SSL the remainder of the session.  Otherwise, it's likely that 
encrypting the login form will just give you a false sense of security.

I think you can also use the secure attribute in the sslext 
tags to indicate
whether the target of the link or form should be accessed 
securely. In this
case, you would add secure="false" to the sslext:link tag 
that goes back to
/index.jsp.

-Max
Craig
Will it be useful for cases like where credit card information are 
sent through SSL and hence are secured. They might snoop the session, 
if it is switched back to http, but still the credit card information 
is not. Similarly, snooper might steal the sessionId, but the password 
is not stolen and is secured. Is that not better than nothing? Am I 
missing something?

The credit card information is not going back and forth across the wire 
unencrypted, but your session identifier is (for servlet based apps, 
it's normally in a cookie or encoded into the URLs).

In at least some ecommerce apps I'm familiar with, the credit card 
number *is* stored in an HttpSession (or something analogous for 
non-servlet technologies), so that the customer can go back and buy some 
more stuff, and do an expedited checkout the second time.  If I know 
that your app works that way, I can snoop the wire until the user goes 
to https (which I can't read, but can see happening) and then back to 
http (which I can see).  Now, I've got the cleartext version of the 
session id, assume that the user has gone through the checkout, and can 
submit false additional purchase transactions to your app based on that 
session id, without having to resubmit a credit card number.

Protecting just the password, but not the remainder of the current 
session, is *not* better than nothing -- IMHO it is substantially worse 
because it gives you a *false* sense of security.

Craig


--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e

RE: javax.servlet.ServletException: BeanUtils.populate

2003-09-27 Thread Gaurav Gupta
Is it Krishna Mohan , previously with MTC India ??

sorry for botheration



-Original Message-
From: krishnamohan [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 27, 2003 3:56 PM
To: [EMAIL PROTECTED]
Subject: javax.servlet.ServletException: BeanUtils.populate


Hi,
I am writing a small page based on struts guidelines for creating map-backed
forms. I am using struts 1.1. I have a jsp in which I have some dynamic
fields. I used a for loop for these,currently. In the ActionForm, I have
declared a HashMap for collecting values of these fields. However, when I
submit the page, I am getting the error- javax.servlet.ServletException:
BeanUtils.populate Root cause: java.lang.IllegalArgumentException: No bean
specified. Pl. help me understand what went wrong.


The following is the jsp page
<%@ page language="java" session="true"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

 






 
 
<% for (int i=0; i <=2; i++) { String name = "value(foo-" + i + ")"; %>
 

<%} %>  
  

The following is the ActionForm class

package com.trx.kms.questionbank; import
javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;


public final class CreateQuestionForm extends ActionForm{
private String questionName=null;
private String questionDesc=null;
private String submit=null;
private String reset=null;
private final Map values = new HashMap();


public void setValue(String key, Object value) {
values.put(key, value); }
public Object getValue(String key) {
return values.get(key); }
public String getQuestionDesc() {
return questionDesc; }
public String getQuestionName() {
return questionName; }
public void setQuestionDesc(String string) {
questionDesc = string; }
public void setQuestionName(String string) {
questionName = string; }
public String getReset() {
return reset; }
public String getSubmit() {
return submit; }
public void setReset(String string) {
reset = string; }
public void setSubmit(String string) {
submit = string; }


public String getQuestions()
{
StringBuffer sb = new StringBuffer();
if ((values!=null && !values.isEmpty())) {
Iterator it = values.keySet().iterator();
while (it.hasNext()) {
String paramName = (String)it.next();
String paramValue = (String)values.get(paramName);
sb.append(paramName);
sb.append(paramValue);
} } return sb.toString();
}


public void reset(ActionMapping mapping, HttpServletRequest request) {
this.questionName=null;
this.questionDesc=null;
}


public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
return errors; } }


The following is the action class


package com.trx.kms.questionbank;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;

public final class CreateQuestionAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException {
String questions=((CreateQuestionForm)form).getQuestions();
ActionErrors errors = new ActionErrors();
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput())); }
return (mapping.findForward("success")); }
}



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



javax.servlet.ServletException: BeanUtils.populate

2003-09-27 Thread krishnamohan
Hi, 
I am writing a small page based on struts guidelines for creating map-backed
forms. I am using struts 1.1. I have a jsp in which I have some dynamic
fields. I used a for loop for these,currently. In the ActionForm, I have
declared a HashMap for collecting values of these fields. However, when I
submit the page, I am getting the error- javax.servlet.ServletException:
BeanUtils.populate Root cause: java.lang.IllegalArgumentException: No bean
specified. Pl. help me understand what went wrong. 


The following is the jsp page
<%@ page language="java" session="true"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

 


 
 
 

  
  
<% for (int i=0; i <=2; i++) { String name = "value(foo-" + i + ")"; %>
  

<%} %>   
   

The following is the ActionForm class 

package com.trx.kms.questionbank; import
javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;


public final class CreateQuestionForm extends ActionForm{ 
private String questionName=null;
private String questionDesc=null;
private String submit=null; 
private String reset=null; 
private final Map values = new HashMap(); 


public void setValue(String key, Object value) {
values.put(key, value); } 
public Object getValue(String key) {
return values.get(key); } 
public String getQuestionDesc() {
return questionDesc; }
public String getQuestionName() {
return questionName; }
public void setQuestionDesc(String string) {
questionDesc = string; } 
public void setQuestionName(String string) {
questionName = string; } 
public String getReset() {
return reset; } 
public String getSubmit() {
return submit; }
public void setReset(String string) {
reset = string; } 
public void setSubmit(String string) {
submit = string; } 


public String getQuestions()
{
StringBuffer sb = new StringBuffer();
if ((values!=null && !values.isEmpty())) {
Iterator it = values.keySet().iterator();
while (it.hasNext()) {
String paramName = (String)it.next();
String paramValue = (String)values.get(paramName);
sb.append(paramName);
sb.append(paramValue);
} } return sb.toString(); 
} 


public void reset(ActionMapping mapping, HttpServletRequest request) {
this.questionName=null; 
this.questionDesc=null; 
} 


public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
return errors; } } 


The following is the action class 


package com.trx.kms.questionbank;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;

public final class CreateQuestionAction extends Action { 
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException { 
String questions=((CreateQuestionForm)form).getQuestions(); 
ActionErrors errors = new ActionErrors();
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput())); }
return (mapping.findForward("success")); }
}



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



Re: ActionErrors and Servlet Filters

2003-09-27 Thread Manish Singla
In addition to below reply:
you may set  name in html:error and .
request.setAttribute(name, errors)
errors can be string, string[], ActionErrors, ErrorMesssages

Manish Singla wrote:

> you may use following
> request.setAttribute(Globals.ERROR_KEY, errors);
> to set global parameter of errors..
>
> set action error as usual...
>
> Nate Drake wrote:
>
> > I have a Servlet Filter that checks that the user has permission to
> > access the requested page.  If the user does not, I want to send them
> > back to home.jsp.  In home.jsp, I want to use the  tag to
> > display an error message.
> >
> > In the filter I do this:
> >
> > ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED);
> >
> > ActionErrors errors = new ActionErrors();
> > errors.add(ActionErrors.GLOBAL_ERROR, error);
> >
> > request.setAttribute("errparam", errors);
> >
> > RequestDispatcher rd = request.getRequestDispatcher("home.jsp");
> >
> > rd.forward(request, response);
> > return;
> >
> > In home.jsp I've tried both:
> >
> > 
> > 
> >
> > It forwards back to home.jsp, but the error messages are not displayed.
> > Is it possible to use ActionErrors outside of an Action?
> >
> > Thanks,
> > Nate
> >
> > -
> > 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: [Question] Image path - Best way?

2003-09-27 Thread Max Cooper
Struts has a tag that will put the context path on the front of the src URL
for you. Here's an example:



If you want to reserve the option to internationalize what image gets
displayed, Struts has good support for that, too. For instance, if you have
a button image with some text on it, and you want to be able to show
different images for different languages, you can put the image path in the
ApplicationResources.properties file and use something like this:



You can also use the altKey attribute of the  tag to
internationalize the ALT, um, thingy.



In your base ApplicationResources.properties file, you might have something
like this:

button.clickMe.src=/images/button_clickMe.jpg
button.clickMe.alt=Click Me

You can override these values for other languages in locale-specific
versions of the ApplicationResources.properties file.

One thing to be careful of with specifying images this way is that if you
set the size in the  tag (which is a good idea to speed rendering
performance in the browser), make sure that all the images for a given
button match the size that is specified.

They don't exist now, but it might be useful if heightKey and widthKey
attributes were added to the  tag to allow those to be looked up
in the properties file as well. That way you could specify different sizes
for the images if they happen to be different for different locales.

For complete documentation, see the online docs for , here:
http://jakarta.apache.org/struts/userGuide/struts-html.html#img

-Max

- Original Message - 
From: "Rajesh M Vasudevan" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, September 26, 2003 11:32 PM
Subject: Re: [Question] Image path - Best way?


> Hi guys,
>
> I tried the following, and it seems to work good:
>  height="80" border="0" alt="">
>
> Is this the right way?  Is there a way to specify it as a Resource? Can
you
> give me a tutorial link of how to do that..
>
> Thanks
> Rajesh
>
> > Hi
> >
> > What is the best way to give image paths in JSP pages?  I see that an
> image
> > path given in a certain way works for .jsp files, but the same path
fails
> > for pages loaded through a .do and vice versa.
> >
> > Is there a standard way that struts instructs by which images can be
> defined
> > in a resource configuration file and refer to them in the jsp pages as
> > resource strings, just like application resources?  OR Is there a way to
> > refer to an image which works well for both .do or .jsp.
> >
> > Please advise..
> >
> > Regards,
> > Rajesh
> >
> >
> >
> > -
> > 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: change dynamically ApplicationResources path

2003-09-27 Thread Manish Singla
You may use following to set bundleName defined in struts-config.xml...
request.setAttribute(Globals.MESSAGES_KEY, bundleName);
but bundleName is MessageResources object . and bundleName is  key
attribute of message-resources in struts-config.xml...

OR
If above do not meet your requirements...
than you have write factory of message-resources and overload loadLocale
method of  PropertyMessageResources...


Caroline Lauferon wrote:

> Hello,
>
> I would like to know if it is possible to set the path of the
> ApplicationResources.properties file without hard-coding it in
> struts-config.xml.
> Indeed, I would like to read a property file (whose path is in an
> environment property) which would contain the path of the
> ApplicationResources to use.
> This would allow me to deploy my EAR, and then, without having to
> re-generate it and re-deploy it, change the ApplicationResources file.
>
> Thanks,
>
> Caroline


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



Re: ActionErrors and Servlet Filters

2003-09-27 Thread Manish Singla
you may use following
request.setAttribute(Globals.ERROR_KEY, errors);
to set global parameter of errors..

set action error as usual...

Nate Drake wrote:

> I have a Servlet Filter that checks that the user has permission to
> access the requested page.  If the user does not, I want to send them
> back to home.jsp.  In home.jsp, I want to use the  tag to
> display an error message.
>
> In the filter I do this:
>
> ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED);
>
> ActionErrors errors = new ActionErrors();
> errors.add(ActionErrors.GLOBAL_ERROR, error);
>
> request.setAttribute("errparam", errors);
>
> RequestDispatcher rd = request.getRequestDispatcher("home.jsp");
>
> rd.forward(request, response);
> return;
>
> In home.jsp I've tried both:
>
> 
> 
>
> It forwards back to home.jsp, but the error messages are not displayed.
> Is it possible to use ActionErrors outside of an Action?
>
> Thanks,
> Nate
>
> -
> 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: Including 4 's into 1 page with includes?

2003-09-27 Thread paul
Make sure you do request.setAttribute
("FormName",dynaActionFormObjectInstance); for each of the forms you have
manually populated.  Because, what you don't see struts do in the
background is that everyform you receive in your actions the form is
automatically added to the request object.  Because you are populating
these forms yourself you must add them to the request object manually in
order for your tags to be able to see them.

> OK, I got the forms to display, but I have an issue with the data in
> each page being displayed. There is not data actually populating the
> pages, when I  KNOW there is data in the given Form Object
>
> I have several ActionForms that as a JSP alone, they work fine,
> But then I have this new page that has as DynaActionForm with the
> following attributes:
>
>dynamic="true"
>type="org.apache.struts.action.DynaActionForm">
>
>
> type="com.baselogic.yoursos.user.AllergiesActionForm" />
> type="com.baselogic.yoursos.user.DiseaseActionForm" />
> type="com.baselogic.yoursos.user.ProsthesisActionForm" />
> type="com.baselogic.yoursos.user.SurgeryActionForm" />
> type="com.baselogic.yoursos.user.TreatmentActionForm" />
> type="com.baselogic.yoursos.user.VaccinationActionForm" />
>
>
> Then, I have the following includes:
>
> 
> 
> 
> 
> 
> 
>
>
> Please help. I appreciate anyone taking a minute to look at this. I am
> really in crunch time as I have a demo for over 2,000 persons in the
> next 1.5 weeks. So I am very stressed!
> Again, heaps of appreciation in advance for you help!
>
> ---
> Thanks
> Mick Knutson
>
> coming soon:
> Your SOS: Your personal emergency contact system.
> http://YourSos.com
>
> +001(805) 563-0666 Office
> +001 (708) 570-2772 Fax
> ---
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, September 26, 2003 5:50 PM
> Subject: Re: Including 4 's into 1 page with includes?
>
>
>> I have used the jsp:include directive to include jsp pages that have
>> other struts forms in them.  Works great as long as you make sure all
>> the forms get added to the request object.
>>
>> > I have 4 different read-only forms that are each in their own jsp
>> > page. I want to create a master jsp page that has all 4 forms on it.
>> > I can have the main action collect all 4 DTO's for each of the
>> > forms, and then add it to a DyaActionForm, but I don't know if this
>> > is even going to work.
>> >
>> > I just don't want to copy-n-paste JSP code into this master view, as
>> > I also will have the need to show the same FORM by itself.
>> >
>> > Has anyone done anything like this and able to help me figure out
>> > what to do?
>> >
>> >
>> > ---
>> > Thanks
>> > Mick Knutson
>> > http://www.baselogic.com
>> >
>> > +001(805) 563-0666 Office
>> > +001 (708) 570-2772 Fax
>> > ---
>> >
>> > -
>> > 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]