Re: =

2005-01-11 Thread Nicolas De Loof
Another option is to use a submit button (that will post the form) and 
CSS to make it look as a link :




   .submit {
   border:0px;
   background-color:#fff;
   cursor: pointer;
   text-decoration:underline;
   }



  
 
  


Nico
Jeff Beal a écrit :
You need to have the link fire off a JavaScript function that will 
submit the form.  I don't think you'll want to use the  
tag in this case, since you won't need to do anything fancy with a 
request URI.

Here's a really quick example that will run in Internet Explorer.  I 
haven't done enough JavaScript in other browsers to make any 
guarantees with those, but modifications to this shouldn't be all that 
difficult:

Submit
For FORMNAME, you need to use the name attribute of the FORM element. 
IIRC, Struts uses the name of the Form Bean here.  The easiest way to 
be sure is to run your app and view the generated source, though.

-- Jeff
Flávio Maldonado wrote:
Hello...
How can I do to make a  works like a  ??
For example...
I have this button: 
 
 
and I'd like to make a Link to do the same thing.
thanks for help!
Flávio Vilasboas Maldonado
Diretor de Desenvolvimento
SedNet Soluções
(35)3471-9381

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the person 
to whom it is addressed. If you are not the intended recipient,  you are not 
authorized to read, print, retain, copy, disseminate,  distribute, or use this 
message or any part thereof. If you receive this  message in error, please 
notify the sender immediately and delete all  copies of this message.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


JAAS implement RBAC in struts

2005-01-11 Thread Cliff
Hi,

could anyone get me some idea to implement a RBAC (role base access control) 
using JAAS in struts ??

I have no idea to implement it and try to find a lot of information about 
security of J2EE, JAAS login module . to read.

Anyone can help me ??

Best wishes,
Cliff Lam
Reinfo Technology Limited

"驕傲只啟爭競;聽勸言的,郤有智慧"(箴13:10)

RE: Database connection question - seeking expert opinion

2005-01-11 Thread Amit Gupta
Hi Manisha,

Struts database method uses DBCP. It offer database connection pooling. So I 
think struts db method is better

Amit Gupta
Mobile: 91-9891062552
Yahoo IM: amitguptainn
MSN IM : amitguptainn
-Original Message-
From: Manisha Sathe [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 12, 2005 11:40 AM
To: user@struts.apache.org
Subject: Database connection question - seeking expert opinion

I am still new to struts and even servlets. Last time when i developed 
servlets, i created one common class method to get the connection (with regular 
JDBC call). All database related parameters i stored in a constant variable 
file.
 
Now in struts i found out that we can specify the datasource inside 
struts-config.xml. 
 
I want to know which methodology is better ? Can i continue with my existing 
method ? or struts database method is better ? 
 
regards
Manisha 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Database connection question - seeking expert opinion

2005-01-11 Thread Manisha Sathe
I am still new to struts and even servlets. Last time when i developed 
servlets, i created one common class method to get the connection (with regular 
JDBC call). All database related parameters i stored in a constant variable 
file.
 
Now in struts i found out that we can specify the datasource inside 
struts-config.xml. 
 
I want to know which methodology is better ? Can i continue with my existing 
method ? or struts database method is better ? 
 
regards
Manisha 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

RE: Handling the exceptions in struts

2005-01-11 Thread Manisha Sathe

I would like to thanks all of u for your replies. Definitely this will help me 
to improve my coding practice.

regards and have a nice day,

Manisha

 


-
Do you Yahoo!?
 The all-new My Yahoo! – Get yours free!

Re: [OT]Hashtable Vs Hashmap, Vector Vs ArrayList

2005-01-11 Thread Caroline Jen
A Map is a class that stores key-value pairs and
provides a way to locate a value based on the key.

The Hashtable class is a synchronized implementation
of the Map interface.

The HashMap is better in terms performance because the
hashing algorithm it uses.   The Hashtable is
synchronized so performance is slightly worse.

As to the difference between a Vector and an
ArrayList:

I. Synchronization
 
Vectors are synchronized. Any method that touches the
Vector's contents is thread safe. ArrayList, on the
other hand, is unsynchronized, making them, therefore,
not thread safe. With that difference in mind, using
synchronization will incur a performance hit. So if
you don't need a thread-safe collection, use the
ArrayList. Why pay the price of synchronization
unnecessarily?
 
II. Data growth
 
Internally, both the ArrayList and Vector hold onto
their contents using an Array. You need to keep this
fact in mind while using either in your programs. When
you insert an element into an ArrayList or a Vector,
the object will need to expand its internal array if
it runs out of room. A Vector defaults to doubling the
size of its array, while the ArrayList increases its
array size by 50 percent. Depending on how you use
these classes, you could end up taking a large
performance hit while adding new elements. It's always
best to set the object's initial capacity to the
largest capacity that your program will need. By
carefully setting the capacity, you can avoid paying
the penalty needed to resize the internal array later.
If you don't know how much data you'll have, but you
do know the rate at which it grows, Vector does
possess a slight advantage since you can set the
increment value.
 
III. Usage patterns
 
Both the ArrayList and Vector are good for retrieving
elements from a specific position in the container or
for adding and removing elements from the end of the
container. All of these operations can be performed in
constant time -- O(1). However, adding and removing
elements from any other position proves more expensive
-- linear to be exact: O(n-i), where n is the number
of elements and i is the index of the element added or
removed. These operations are more expensive because
you have to shift all elements at index i and higher
over by one element. So what does this all mean? 
It means that if you want to index elements or add and
remove elements at the end of the array, use either a
Vector or an ArrayList. If you want to do anything
else to the contents, go find yourself another
container class. For example, the LinkedList can add
or remove an element at any position in constant time
-- O(1). However, indexing an element is a bit slower
-- O(i) where i is the index of the element.
Traversing an ArrayList is also easier since you can
simply use an index instead of having to create an
iterator. The LinkedList also creates an internal
object for each element inserted. So you have to be
aware of the extra garbage being created. 
  
--- Ashish Kulkarni <[EMAIL PROTECTED]>
wrote:

> Hi
> what is difference between Hashtable and Hashmap ,
> also Vector and ArrayList.
> What are key points to consider when selecting one
> over the other
> 
> Ashish
> 
> 
> 
>   
> __ 
> Do you Yahoo!? 
> Yahoo! Mail - 250MB free storage. Do more. Manage
> less. 
> http://info.mail.yahoo.com/mail_250
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 




__ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


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



Re: [OT]Hashtable Vs Hashmap, Vector Vs ArrayList

2005-01-11 Thread kjc
Ashish Kulkarni wrote:
Hi
what is difference between Hashtable and Hashmap ,
also Vector and ArrayList.
What are key points to consider when selecting one
over the other
Ashish

		
__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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

The first is thread safe,the second isn't
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [OT] WinCVS problem (free beer!)

2005-01-11 Thread Lucas González Pearson
The latest version of winCVS has a repository browser feature... i´ve just
done that to see wich module to download...

JIdea 4.0 and upper also has it, and the same goes for eclipse...

hope it helped


- Original Message -
From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
To: "Daniel Perry" <[EMAIL PROTECTED]>
Cc: "Struts Users Mailing List" 
Sent: Thursday, January 06, 2005 6:48 PM
Subject: Re: [OT] WinCVS problem (free beer!)


> Yep, TortoiseCVS is what I'm using, as it was the only one I got working
> :) Does the job though.
>
> I was under the impression that you could browse a CVS repository with
> most of these tools, and that doesn't seem to be the case.  Maybe the
> one in Eclipse can do it, but most don't seem to have that capability.
> With that in mind, TortoiseCVS seems the past of least resistance for me.
>
> Thanks for your help!
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
>
> Daniel Perry wrote:
> > Give tortoisecvs a try.  I personally prefer it to wincvs.
> >
> > http://www.tortoisecvs.org/download.shtml
> >
> > After trying both (and eclipse), i came up with the conclusions:
> >
> > eclipse is the easiest (so use it if using eclipse)
> >
> > tortoise provides nice shell integration that gives an almost 'human'
> > perspective on cvs.
> >
> > wincvs gives a gui interface to the command line tools, with lots of
menus
> > etc. As i had no real cvs knowledge, wincvs confused me!  I found
tortoise
> > far far easier to use.
> >
> > Daniel.
> >
> >
> >>-Original Message-
> >>From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
> >>Sent: 05 January 2005 22:35
> >>To: David G. Friedman
> >>Cc: Struts Users Mailing List; Commons User
> >>Subject: Re: [OT] WinCVS problem (free beer!)
> >>
> >>
> >>Indirectly I've thought about it... A lot of guys are using WASD at
> >>work, which is of course Eclipse-based, but I've been resisting.  I've
> >>used a number of IDEs over the years, and I've always found that they
> >>get in my way far more than they help.  That's just me, but it's been my
> >>experience.  At this point I have such a refined work style between
> >>UltraEdit and Tomcat that I can actually work more efficiently overall
> >>than with any IDE I've tried (and I have actually spent some time
> >>playing with WSAD, and it doesn't seem to be any different in terms of
> >>that).  They don't call me the Batch File King (tm) at work for nothin'
:)
> >>
> >>FYI, I'm trying to let WinCVS run it's course right now as per Glenn's
> >>suggestion.  I also tried hitting escape as Matt suggested, but it
> >>didn't unfreeze it, so it wouldn't appear to be that problem (plus I'm
> >>not seeing any drive activity, which I'd expect to see if it was doing
> >>what Glenn suggested).
> >>
> >>It's weird, I can move the window around no problem, but I can't do
> >>anything with any part of the interface (and large parts of the
> >>interface get "erased" when I move any window over it, typical Windows
> >>frozen app syndrom)
> >>
> >>--
> >>Frank W. Zammetti
> >>Founder and Chief Software Architect
> >>Omnytex Technologies
> >>http://www.omnytex.com
> >>
> >>David G. Friedman wrote:
> >>
> >>>Frank,
> >>>
> >>>Ever think of using Eclipse (v3.X) ?  I use it for
> >>
> >>Java/Struts/Tomcat (Via
> >>
> >>>the Sysdeo plug-in) development and it includes a built-in CVS client.
> >>>Add-ons also allow for SVN.
> >>>
> >>>Regards,
> >>>David Friedman / [EMAIL PROTECTED]
> >>>
> >>>-Original Message-
> >>>From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
> >>>Sent: Wednesday, January 05, 2005 5:11 PM
> >>>To: Commons User; Struts User
> >>>Subject: [OT] WinCVS problem (free beer!)
> >>>
> >>>
> >>>Ok, no free beer, I lied ;)  Got your attention though!
> >>>
> >>>I'm just now trying to use CVS for the first time, and I'm having a
> >>>problem I haven't been able to figure out, and I'm sure at least some
of
> >>>you here are using WinCVS, so I hope no one minds an OT question (FYI,
I
> >>>couldn't find a WinCVS support forum)...
> >>>
> >>>I've installed WinCVS 1.3 (the latest from the WinCVW.org site,
> >>>downloaded today) on Windows XP.  I haven't however installed Python or
> >>>TCL, as they are optional.  The install went fine.
> >>>
> >>>But, when I try to run it, it freezes.  I see the splash screen, and
the
> >>>popup mentioning Python.  I click OK, and it's just frozen, can't do
> >>>anything.  I can close it via right-clicking the taskbar item, but
> >>>nothing else.  It works on my work PC by the way, although I can't do
> >>>anything with it there because of firewall restrictions, so I really
> >>>need it working at home.
> >>>
> >>>I've checked to be sure the CvsNT and CvsNT Locking services are
> >>>running, and they are (not even sure that's necassery, but still).
I've
> >>>spent 30 minutes or so Googling for an answer but haven't had any luck.
> >>>
> >>>Any ideas from anyone around here?  Again, sorry for the OT po

[OT]Hashtable Vs Hashmap, Vector Vs ArrayList

2005-01-11 Thread Ashish Kulkarni
Hi
what is difference between Hashtable and Hashmap ,
also Vector and ArrayList.
What are key points to consider when selecting one
over the other

Ashish




__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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



Re: JSF and Struts (off topic)

2005-01-11 Thread Ted Husted
Check out Mastering JavaServer Faces by Bill Dudley et al.

[http://www.amazon.com/exec/obidos/ASIN/0471462071/apachesoftwar-20]

(Buying a book through this link benefits the ASF.)

It does thing like compare writing the same application with JSF and Struts.

-Ted.

On Tue, 11 Jan 2005 18:58:06 -0300 (ART), Leandro Melo wrote:
> Hi all,
> I need to start up very quick with JSF for a project! Actually, I'm
> just gonna check it out to see if it's worth a change! Does anyone
> know somekinda guide "From Struts to JSF"?? It could be just a
> beginner one. Thanks. ltcmelo



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



Re: questions about ActionForm, ValidatorForm, etc.

2005-01-11 Thread Hubert Rabago
On Tue, 11 Jan 2005 17:50:58 -0600, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> The ActionForm (there is no ActionFormBean) is the basic form bean.
 
> Note that ActionFormBean is a configuration object,
> DynaActionFormClass is a DynaClass implementation; neither of these
> are ActionForm subclasses and should not be used as form beans.
> 

Oops, forgot to correct the top portion.

Hubert


> 
> On Tue, 11 Jan 2005 15:52:17 -0700, Daniel Watrous <[EMAIL PROTECTED]> wrote:
> > It would seem that every form in my web application requires a form class 
> > (JavaBean).

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



Re: questions about ActionForm, ValidatorForm, etc.

2005-01-11 Thread Hubert Rabago
The ActionForm (there is no ActionFormBean) is the basic form bean. 
You can use this or any subclass for Struts form beans.  You use them
to hold the values passed from the browser.  These values can come
from a , from multiple s through multiple pages, or even
from parameters at the end of a URL (like
"/webapp/path.do?fname=Bill&lname=Ding").

For ValidatorForm, DynaValidatorForm, and DynaValidatorActionForm, see
http://marc.theaimsgroup.com/?l=struts-user&m=110375387629389&w=2

ValidatorActionForm is the non-dynaform version of
DynaValidatorActionForm.  What this means is, you can specify how it's
validated through XML, and the Validator plugin will find the set of
rules to apply to it based on which path it gets submitted to.

LazyValidatorForm is a dyna form that doesn't need to have its fields
specified in a config file.  You can declare a bean to be a
LazyValidatorForm and it'll create the necessary fields as values are
passed to it.

BeanValidatorForm is a new form bean which can be backed by a POJO. 
Through this class, you can use your own business object to back a
form bean.  I believe this will work better if you're using 1.2.5 or
higher.

Note that ActionFormBean is a configuration object,
DynaActionFormClass is a DynaClass implementation; neither of these
are ActionForm subclasses and should not be used as form beans.

Hubert 


On Tue, 11 Jan 2005 15:52:17 -0700, Daniel Watrous <[EMAIL PROTECTED]> wrote:
> It would seem that every form in my web application requires a form class 
> (JavaBean).  I think I understand that a Form is a loose term, not 
> necessarily referring to one  tag set on a given page, but 
> rather a form may span many pages and requests.  Is this correct so far?
> 
> I think that I also understand the mechanism DynaActionForm, which builds a 
> type of "Bean" from an XML definition of the form, rather than hardcoding an 
> ActionForm subclass for the form.  These two beans also provide a validate 
> method (one inherited) which I can override (optionally) to perform 
> validation.
> 
> My question relates to several other classes that all seem to do similar 
> things, but I'm not finding clarification about how to use them in the 
> Javadocs, or User/Developer documentation.  Most of them relate to 
> validation.  Of the following list, when is the most appropriate time to use 
> each one, and what are their differences?
> 
> ActionFormBean
> DynaActionFormClass
> BeanValidatorForm
> DynaValidatorActionForm
> DynaValidatorForm
> LazyValidatorForm
> ValidatorActionForm
> ValidatorForm
> 
> I will continue with the Javadocs.  Please send links to documentation that 
> may clarify the use of each of these classes.  Thanks in advance...
> 
> Daniel
>

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



Re: How to view the actual HTTP generated by a struts action.

2005-01-11 Thread Jason Lea
For Mozilla + Firefox you can use this extension to view the POSTed headers
http://livehttpheaders.mozdev.org/
Doesn't help if you want to see what IE is sending, some of the other 
suggestions would work in that case.

kjc wrote:
Is there a way to log the HTTP post string that is sent by the browser when
clicking on

buttonOps is an instance of ImageButton pattern. I'm sure readers of the 
group are familiar with it.

Thanks in advance.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

--
Jason Lea

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 2005.01.10
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


questions about ActionForm, ValidatorForm, etc.

2005-01-11 Thread Daniel Watrous
It would seem that every form in my web application requires a form class 
(JavaBean).  I think I understand that a Form is a loose term, not necessarily 
referring to one  tag set on a given page, but rather a form may 
span many pages and requests.  Is this correct so far?

I think that I also understand the mechanism DynaActionForm, which builds a 
type of "Bean" from an XML definition of the form, rather than hardcoding an 
ActionForm subclass for the form.  These two beans also provide a validate 
method (one inherited) which I can override (optionally) to perform validation.

My question relates to several other classes that all seem to do similar 
things, but I'm not finding clarification about how to use them in the 
Javadocs, or User/Developer documentation.  Most of them relate to validation.  
Of the following list, when is the most appropriate time to use each one, and 
what are their differences?

ActionFormBean
DynaActionFormClass
BeanValidatorForm
DynaValidatorActionForm
DynaValidatorForm
LazyValidatorForm
ValidatorActionForm
ValidatorForm

I will continue with the Javadocs.  Please send links to documentation that may 
clarify the use of each of these classes.  Thanks in advance...

Daniel

RE: How to view the actual HTTP generated by a struts action.

2005-01-11 Thread Karr, David
This could be done with Ethereal, which allows you to listen in on
traffic without having to manually insert an observer in the chain.  If
you use "Follow TCP Stream" after generating the packet data, you can
see all the back and forth HTTP traffic in a single buffer.

> -Original Message-
> From: kjc [mailto:[EMAIL PROTECTED] 
> Sent: Monday, January 10, 2005 2:25 PM
> To: Struts Users Mailing List
> Subject: How to view the actual HTTP generated by a struts action.
> 
> 
> Is there a way to log the HTTP post string that is sent by 
> the browser when clicking on
> 
> 
> 
> buttonOps is an instance of ImageButton pattern. I'm sure 
> readers of the 
> group are familiar with it.
> 
> Thanks in advance.
> 
> -
> 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: [almost OT] Struts in Practice

2005-01-11 Thread t t
Thanks. I would like to get a web designer to help me. But I don't have money 
to do that. :(

Vincent <[EMAIL PROTECTED]> wrote:Congrats. So this your demo site? If it is in 
production, you may
want think about getting a web designer to help you with the layout.
It kind of reminds me of a 1998 webpage.
No offense intended.

t t wrote:
> If you are a sports lover, or Struts lover, please take a look at this 
> website:
> www.sportslovers.net . It's based on Struts. Have a good day!
> Sorry if this email bothers you.
> 
> 
> 
> -
> Do you Yahoo!?
> Meet the all-new My Yahoo! ?Try it today! 


-- 
Plato is my friend, Aristotle is my friend,
but my greatest friend is truth.
- Isaac Newton

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




-
Do you Yahoo!?
 Yahoo! Mail - Find what you need with new enhanced search. Learn more.

JSF and Struts (off topic)

2005-01-11 Thread Leandro Melo
Hi all,
I need to start up very quick with JSF for a project!
Actually, I'm just gonna check it out to see if it's
worth a change!
Does anyone know somekinda guide "From Struts to
JSF"??
It could be just a beginner one.
Thanks.
ltcmelo



__ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 

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



Re:

2005-01-11 Thread Rick Reumann
Ashish Kulkarni wrote the following on 1/11/2005 12:24 PM:
But really hoped to be able to use Hashtable rather
then adding this code
I assume this will work with Hashtable (not sure why you need to use a 
Hashtable over a HashMap).



${mapItem.value.someProperty}


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


RE: Dispatch action and java script?

2005-01-11 Thread Durham David R Jr Contr 805 CSPTS/SCE
> 

The problem could be that you aren't returning anything.

Try doing something like this:

   onclick="return validate();"

Then:

   function validate() {
  if (...) // fails
 return false;
  }
  // else
  return true;
   }

So, you return a Boolean from the validate function that is then
returned to the "onclick" event.  False means halt the normal event
propagation which, in this case, is form submission.



> I don't know if I can do this with dispatch action.  

Well, if I understand you correctly, you are having problems with the
Javascript validation.  Or, are you having problems with the
ActionForm's validate method.  If it's the latter, then maybe this will
work for you:

public Dispatch ... {

public dispatchedActionWithValidation(...) {

ActionErrors errors = form.validate(mapping, request);

if (errors != null && !errors.isEmpty()) {
saveErrors(request, errors);
return mapping.findForward("errorPage");
}

...

}

Then in your struts-config action mapping, you would set:

 validate="false"

I can explain why you might want to use this method, if you like.


- Dave

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



Re: Validating DynaBean nested beans with a custom validator.

2005-01-11 Thread Kishore Senji
This shoud do it. Isn't it?

private static PersonFormBean getPersonFormBean(Object bean, String property)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException{
   
   return (PersonFormBean) BeanUtils.getProperty(bean, property);
}





On Tue, 11 Jan 2005 11:39:53 -, Daffin, Miles (Company IT)
<[EMAIL PROTECTED]> wrote:
> Dear All,
> 
> I have a DynaValidatorActionForm like this:
> 
> 
> type="org.apache.struts.validator.DynaValidatorActionForm">
>
> size="0" />
> type="com.plok.validator.beans.PersonFormBean"/>
>
> 
> 
> When the related form is submitted the action adds the 'newPerson' to
> the 'personList' and replaces newPerson, on the DynaBean, with a new
> PersonFormBean. This all works fine. Now I want to add declarative
> validation for the newPerson, so only valid newPersons reach the action
> code that adds them to the list.
> 
> The thing is that PersonFormBeans (in this example) have a start and end
> date (a period). The validation rules for these fields are:
> * start date and end date must be dates (dd/MM/)
> * start date must be before end date
> * end date must be after or equal to today
> * etc...
> 
> So, you see, apart from the first rule, this goes beyond what can be
> achieved by plucking out the fields from the nested bean and using the
> default set of simple field validators shipped with struts (required,
> date etc.). (Even if you disagree that these validation requirements
> cannot be met in using the default validators please read on. This is
> just an example.)
> 
> I have created a new validator that I want to handle the entire nested
> PersonFormBean: personValidator.
> 
> name="personValidator"
>classname="com.plok.validator.beans.PersonFormBeanValidator"
>method="validatePerson"
>methodParams="java.lang.Object,
>  org.apache.commons.validator.ValidatorAction,
>  org.apache.commons.validator.Field,
>  org.apache.struts.action.ActionErrors,
>  javax.servlet.http.HttpServletRequest"
>msg="errors.person">
> 
> 
> public static boolean validatePerson(Object bean, ValidatorAction va,
> Field field, ActionErrors errors, HttpServletRequest request)
> {
>PersonFormBean personFormBean =
> somehowGetTheBloodyPersonFormBeanOffTheBean(bean);
>// Do the validation directly on the personFormBean.
>return true;
> }
> private static PersonFormBean
> somehowGetTheBloodyPersonFormBeanOffTheBean(Object bean)
> {
>// How do I implement this?
>// It has to be generic, in case I change my mind about the type of
> the bean,
>// e.g. make it a simple bean with getters and setters instead of
> using the DynaBean...
>return null;
> }
> 
> Would you:
> a) grab the nested PersonFormBean from the main, parent bean and then
> work directly with this? If so how? Is there a utility method somewhere?
> b) grab individual fields from the nested bean using BeanUtils methods
> (or other - feel free to advise).
> 
> Your thoughts/urls would be appreciated.
> 
> Many thanks.
> 
> -Miles
> 
> Miles Daffin
> Morgan Stanley
> 20 Cabot Square | Canary Wharf | London E14 4QA | UK
> Tel: +44 (0) 20 767 75119
> [EMAIL PROTECTED] 
> 
> 
> NOTICE: If received in error, please destroy and notify sender.  Sender does 
> not waive confidentiality or privilege, and use is prohibited.
> 
>

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



Re: Dispatch action and java script?

2005-01-11 Thread Dakota Jack
In a way, Nadia, your problem is not a problem.  If you want to "make
sure one of the radio buttons [you] have on the page is clicked", then
all you really want is to make sure the value of that button is
available in the processing of the request.  You can do that without
the radio button even being on, or even existing.  Right?

Jack


On Tue, 11 Jan 2005 11:58:37 -0500, Nadia Kunkov
<[EMAIL PROTECTED]> wrote:
> Hi,
> I implemented DispatchAction and I have a page with three submit buttons, 
> each executes a method in my dispatch action.
> 
> This works fine but I would like to make sure that one of the radio buttons 
> that I have on the page is clicked.
> My validation is turned off for this action since there are no input fields 
> to validate.
> I created a javascript function that will check if a radio button is clicked.
> So now I have
> 
> I don't know if I can do this with dispatch action.  It looks like I can't 
> since I never go into the validate() function, but go right to the action 
> when I click the button.
> 
> Another way of doing it would be to create another form for this action with 
> just one field and turn on the validation where I would check the value of a 
> radio button.
> 
> What is a better way of doing it?  What is a best practice?
> 
> Thanks for your help.
> NK
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
--

"You can lead a horse to water but you cannot make it float on its back."

~Dakota Jack~

"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

---

"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."

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



Re: =

2005-01-11 Thread Jeff Beal
You need to have the link fire off a JavaScript function that will 
submit the form.  I don't think you'll want to use the  tag 
in this case, since you won't need to do anything fancy with a request URI.

Here's a really quick example that will run in Internet Explorer.  I 
haven't done enough JavaScript in other browsers to make any guarantees 
with those, but modifications to this shouldn't be all that difficult:

Submit
For FORMNAME, you need to use the name attribute of the FORM element. 
IIRC, Struts uses the name of the Form Bean here.  The easiest way to be 
sure is to run your app and view the generated source, though.

-- Jeff
Flávio Maldonado wrote:
Hello...
How can I do to make a  works like a  ??
For example...
I have this button: 

 
 

and I'd like to make a Link to do the same thing.
thanks for help!
Flávio Vilasboas Maldonado
Diretor de Desenvolvimento
SedNet Soluções
(35)3471-9381

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


=

2005-01-11 Thread Flávio Maldonado
Hello...

How can I do to make a  works like a  ??
For example...

I have this button: 

 
 

and I'd like to make a Link to do the same thing.

thanks for help!


Flávio Vilasboas Maldonado
Diretor de Desenvolvimento
SedNet Soluções
(35)3471-9381

RE: How to view the actual HTTP generated by a struts action.

2005-01-11 Thread Sullivan, Sean C - MWT

https://tcpmon.dev.java.net/




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



Re: Thank you, Struts!

2005-01-11 Thread Vincent
For me it's still a little early to pop the champagne
but I just passed through a major milestone on our Struts
app here at work. Struts performed perfectly in the demo.
All that is left to do is to have some of graphics and layouts
updated by the design team. I wanted to give a thanks as well
to the struts development team for enabling me to feed my family.
:)
Thanks Guys,
Vincent
Vamsee Kanakala wrote:
Hey folks,
  Well, I have been working with Struts for the past 1 month, and 
though the initial setup was a bit complex (the first time) and 
firguring out the action mappings was tough, I am slowly discovering how 
cool Struts is. Maybe that's why it's so popular. A heartfelt thanks to 
Craig and everybody  who's working on Sturts, you guys make my life 
easier and fun :) The documentation is truly, truly excellent. When I 
get some time, I will surely contribute. You guys rock!

Thanks for everything,
-Vamsee Kanakala.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Plato is my friend, Aristotle is my friend, but my greatest friend is truth.
- Isaac Newton
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Handling the exceptions in struts

2005-01-11 Thread Daffin, Miles (Company IT)
Sufficient respect and thanks to all, but this is the answer I was
lookin' for.

Thanks Kishore. (Where is this written?)

MD

> -Original Message-
> From: Kishore Senji [mailto:[EMAIL PROTECTED] 
> Sent: 11 January 2005 17:24
> To: Struts Users Mailing List
> Subject: Re: Handling the exceptions in struts
> 
> org.apache.struts.action.ExceptionHandler by default puts the 
> exception in the request;
> 
> request.setAttribute(Globals.EXCEPTION_KEY, ex);
> 
> So, if you have a custom ExceptionHandler, just make sure you call
> super.execute() so that setting of the exception is done for 
> you. (or You have to set it in the request explicitly). In 
> the error.jsp you can retrieve that execption from the request.
> 
> 
> On Tue, 11 Jan 2005 16:36:29 -, Daffin, Miles (Company 
> IT) <[EMAIL PROTECTED]> wrote:
> > JC,
> > 
> > Thanks. This I know. But...
> > 
> > If I do this in struts-config:
> > 
> > 
> > >key="exception.general"
> >type="java.lang.Exception"
> >path="/error.jsp"/>
> > 
> > 
> > Then error.jsp will be called when an Exception is thrown 
> by an Action 
> > method. In error.jsp I can print a general message. I would 
> like to be 
> > able to also print out stack trace info in the jsp. Does 
> the mere fact 
> > of designating error.jsp as my error hadling page mean that 
> struts has 
> > put the Exception somewhere, e.g. the request? If so under 
> what key? 
> > Or must I do all this myself:
> > 
> > 
> > >key="exception.general"
> >type="java.lang.Exception"
> >path="/error.do"
> >handler="com.plok.blah.ExeptionHandler" /> 
> 
> > 
> > In ExeptionHandler I log the problem ad then put the formatted 
> > Exeption stacktrace on the request, or something similar?
> > 
> > -Miles
> > 
> > > -Original Message-
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > Sent: 11 January 2005 16:20
> > > To: Struts Users Mailing List
> > > Subject: RE: Handling the exceptions in struts
> > >
> > >
> > >
> > >
> > >
> > > Miles, you can capture a stack trace from any throwable using a 
> > > technique
> > > like:
> > >
> > >   ByteArrayOutputStream baos = new 
> > > ByteArrayOutputStream();
> > >   (new Throwable(s)).printStackTrace(new 
> > > PrintStream(baos));
> > >   return baos.toString();
> > >
> > > The result could be logged.
> > >
> > > Hope this helps.
> > >
> > > JC
> > >
> > >
> > >
> > >
> > >   "Daffin, Miles
> > >
> > >   (Company IT)"To:
> > > "Struts Users Mailing List" 
> > >
> > >   <[EMAIL PROTECTED]cc:
> > >
> > >   tanley.com>  Subject:
> > > RE: Handling the exceptions in struts
> > >
> > >
> > >
> > >   01/11/2005 05:54 AM
> > >
> > >   Please respond to
> > >
> > >   "Struts Users Mailing
> > >
> > >   List"
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > The html:errors tag will display a generic message but how can I 
> > > display the details of what went wrong (e.g. the Exception's 
> > > stacktrace) in the designated error jsp?
> > >
> > > What are the options?
> > >
> > > Can someone point me at some docs that go into this in 
> more detail?
> > >
> > > Thanks,
> > >
> > > -Miles
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > **
> > > The information contained in this communication is confidential, 
> > > private, proprietary, or otherwise privileged and is 
> intended only 
> > > for the use of the addressee.
> > > Unauthorized use, disclosure, distribution or copying is strictly 
> > > prohibited and may be unlawful.  If you have received this 
> > > communication in error, please notify the sender immediately at 
> > > (312)653-6000 in Illinois; (972)766-6900 in Texas; or 
> (800)835-8699 
> > > in New Mexico.
> > > **
> > >
> > >
> > > 
> 
> > > - To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > 
> > 
> > NOTICE: If received in error, please destroy and notify 
> sender.  Sender does not waive confidentiality or privilege, 
> and use is prohibited.
> > 
> > 
> -
> > 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]
> 
> 

 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited. 
 


Re: [almost OT] Struts in Practice

2005-01-11 Thread Vincent
Congrats. So this your demo site? If it is in production, you may
want think about getting a web designer to help you with the layout.
It kind of reminds me of a 1998 webpage.
No offense intended.
t t wrote:
If you are a sports lover, or Struts lover, please take a look at this website:
www.sportslovers.net . It's based on Struts. Have a good day!
Sorry if this email bothers you.
		
-
Do you Yahoo!?
 Meet the all-new My Yahoo! – Try it today! 

--
Plato is my friend, Aristotle is my friend,
but my greatest friend is truth.
- Isaac Newton
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re:

2005-01-11 Thread Ashish Kulkarni
Hi 
Thanx for the reply Brandon, i was able to get it
working after converting the Hashtable to ArrayList
having LabelValueBean like this
Hashtable ht = mapsContextData.getAS400List(oCtx);
Enumeration enu = ht.keys();
 ArrayList data = new ArrayList();
  while(enu.hasMoreElements())
 {
 String key = (String)enu.nextElement();
 String value = (String)ht.get(key);
 logger.debug("key is " + key + " value "
+ value);
 data.add(new LabelValueBean(value, key));
 }
But really hoped to be able to use Hashtable rather
then adding this code

Ashish
--- Brandon Mercer <[EMAIL PROTECTED]> wrote:

> Ashish Kulkarni wrote:
> 
> >Hi
> >How do i display a drop down box from hashtable
> data
> >here is my form definiation
> >
>type="org.apache.struts.validator.DynaValidatorForm">
> > >type="java.util.Hashtable" />
> >
> >
> >in my html i define
> > >method="post" style="margin:0px;" >
> >// logic to display html:select with html:option
> tag
> >
> >  
> >
> Yes, totally possible.  Here are some snippets.  :-)
> This is what you'd have in your JSP
>  size="1">
>  property="value" 
> labelProperty="label"/>
> 
> 
> And this is how I build the list in my classes:
> First my Action:
> 
> ArrayList trusts = AssetData.getTrusts(
> getDataSource(request,"trustmaster"),
> errors);
> 
> if ((assets == null) || (codes == null) ||
> (trusts == null)) {
> errors.add(
> ActionErrors.GLOBAL_ERROR,
> new
> ActionError("error.resultset.null"));
> }  else {
> // Put our results set in a bean in the
> session
> session.setAttribute("assets", assets);
> session.setAttribute("codes", codes);
> session.setAttribute("trusts", trusts);
> }
> 
> 
> Now my Data:
>public static ArrayList getTrusts(
> final DataSource dataSource,
> final ActionErrors errors)
> throws Exception {
> 
> Connection conn = null;
> Statement stmt = null;
> ResultSet rs = null;
> ArrayList trusts = new ArrayList();
> 
> try {
> conn = dataSource.getConnection();
> stmt = conn.createStatement();
> rs = stmt.executeQuery("select * from
> trusts;");
>
> // While there are results from our
> query
> // create the codes bean with the proper
> // values from the database.
> while (rs.next()) {
> trusts.add(
> new LabelValueBean(
> rs.getString("trust_name"),
> rs.getString("code")));
> }
>
> } finally {
> if (rs != null) {
> rs.close();
> }
> if (stmt != null) {
> stmt.close();
> }
> if (conn != null) {
> conn.close();
> }
> 
> }
> return trusts;
> }
> 
> Hopefully this helps.
> Brandon
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 




__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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



Re: Handling the exceptions in struts

2005-01-11 Thread Kishore Senji
org.apache.struts.action.ExceptionHandler by default puts the
exception in the request;

request.setAttribute(Globals.EXCEPTION_KEY, ex);

So, if you have a custom ExceptionHandler, just make sure you call
super.execute() so that setting of the exception is done for you. (or
You have to set it in the request explicitly). In the error.jsp you
can retrieve that execption from the request.


On Tue, 11 Jan 2005 16:36:29 -, Daffin, Miles (Company IT)
<[EMAIL PROTECTED]> wrote:
> JC,
> 
> Thanks. This I know. But...
> 
> If I do this in struts-config:
> 
> 
>key="exception.general"
>type="java.lang.Exception"
>path="/error.jsp"/>
> 
> 
> Then error.jsp will be called when an Exception is thrown by an Action
> method. In error.jsp I can print a general message. I would like to be
> able to also print out stack trace info in the jsp. Does the mere fact
> of designating error.jsp as my error hadling page mean that struts has
> put the Exception somewhere, e.g. the request? If so under what key? Or
> must I do all this myself:
> 
> 
>key="exception.general"
>type="java.lang.Exception"
>path="/error.do"
>handler="com.plok.blah.ExeptionHandler" />
> 
> 
> In ExeptionHandler I log the problem ad then put the formatted Exeption
> stacktrace on the request, or something similar?
> 
> -Miles
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: 11 January 2005 16:20
> > To: Struts Users Mailing List
> > Subject: RE: Handling the exceptions in struts
> >
> >
> >
> >
> >
> > Miles, you can capture a stack trace from any throwable using
> > a technique
> > like:
> >
> >   ByteArrayOutputStream baos = new
> > ByteArrayOutputStream();
> >   (new Throwable(s)).printStackTrace(new
> > PrintStream(baos));
> >   return baos.toString();
> >
> > The result could be logged.
> >
> > Hope this helps.
> >
> > JC
> >
> >
> >
> >
> >   "Daffin, Miles
> >
> >   (Company IT)"To:
> > "Struts Users Mailing List" 
> >
> >   <[EMAIL PROTECTED]cc:
> >
> >   tanley.com>  Subject:
> > RE: Handling the exceptions in struts
> >
> >
> >
> >   01/11/2005 05:54 AM
> >
> >   Please respond to
> >
> >   "Struts Users Mailing
> >
> >   List"
> >
> >
> >
> >
> >
> >
> >
> > The html:errors tag will display a generic message but how
> > can I display the details of what went wrong (e.g. the
> > Exception's stacktrace) in the designated error jsp?
> >
> > What are the options?
> >
> > Can someone point me at some docs that go into this in more detail?
> >
> > Thanks,
> >
> > -Miles
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > **
> > The information contained in this communication is
> > confidential, private, proprietary, or otherwise privileged
> > and is intended only for the use of the addressee.
> > Unauthorized use, disclosure, distribution or copying is
> > strictly prohibited and may be unlawful.  If you have
> > received this communication in error, please notify the
> > sender immediately at (312)653-6000 in Illinois;
> > (972)766-6900 in Texas; or (800)835-8699 in New Mexico.
> > **
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> NOTICE: If received in error, please destroy and notify sender.  Sender does 
> not waive confidentiality or privilege, and use is prohibited.
> 
> -
> 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: Dispatch action and java script?

2005-01-11 Thread Nadia Kunkov
Thanks. Will the button work with dispatch action?
NK

-Original Message-
From: Larry Meadors [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 11, 2005 12:16 PM
To: Struts Users Mailing List
Subject: Re: Dispatch action and java script?


I usually just use a button instead of a html:submit, and have it do
the form.submit().

Simple, and flexible - plus you can prevent the double-click submitters. :-)

Larry


On Tue, 11 Jan 2005 11:58:37 -0500, Nadia Kunkov
<[EMAIL PROTECTED]> wrote:
> Hi,
> I implemented DispatchAction and I have a page with three submit buttons, 
> each executes a method in my dispatch action.
> 
> This works fine but I would like to make sure that one of the radio buttons 
> that I have on the page is clicked.
> My validation is turned off for this action since there are no input fields 
> to validate.
> I created a javascript function that will check if a radio button is clicked.
> So now I have
> 
> I don't know if I can do this with dispatch action.  It looks like I can't 
> since I never go into the validate() function, but go right to the action 
> when I click the button.
> 
> Another way of doing it would be to create another form for this action with 
> just one field and turn on the validation where I would check the value of a 
> radio button.
> 
> What is a better way of doing it?  What is a best practice?
> 
> Thanks for your help.
> NK
> 
> -
> 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: Dispatch action and java script?

2005-01-11 Thread "Treviño De la Garza, Isidoro"
Try the lookupDispatchAction

There's an example in the javadocs

Regards

ITG

-Original Message-
From: Nadia Kunkov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 11, 2005 10:59 AM
To: Struts help (E-mail)
Subject: Dispatch action and java script?


Hi,
I implemented DispatchAction and I have a page with three submit buttons,
each executes a method in my dispatch action.

This works fine but I would like to make sure that one of the radio buttons
that I have on the page is clicked.
My validation is turned off for this action since there are no input fields
to validate.
I created a javascript function that will check if a radio button is
clicked.
So now I have 

I don't know if I can do this with dispatch action.  It looks like I can't
since I never go into the validate() function, but go right to the action
when I click the button.

Another way of doing it would be to create another form for this action with
just one field and turn on the validation where I would check the value of a
radio button.  

What is a better way of doing it?  What is a best practice?

Thanks for your help.
NK




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


Re: Dispatch action and java script?

2005-01-11 Thread Larry Meadors
I usually just use a button instead of a html:submit, and have it do
the form.submit().

Simple, and flexible - plus you can prevent the double-click submitters. :-)

Larry


On Tue, 11 Jan 2005 11:58:37 -0500, Nadia Kunkov
<[EMAIL PROTECTED]> wrote:
> Hi,
> I implemented DispatchAction and I have a page with three submit buttons, 
> each executes a method in my dispatch action.
> 
> This works fine but I would like to make sure that one of the radio buttons 
> that I have on the page is clicked.
> My validation is turned off for this action since there are no input fields 
> to validate.
> I created a javascript function that will check if a radio button is clicked.
> So now I have
> 
> I don't know if I can do this with dispatch action.  It looks like I can't 
> since I never go into the validate() function, but go right to the action 
> when I click the button.
> 
> Another way of doing it would be to create another form for this action with 
> just one field and turn on the validation where I would check the value of a 
> radio button.
> 
> What is a better way of doing it?  What is a best practice?
> 
> Thanks for your help.
> NK
> 
> -
> 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: Handling the exceptions in struts

2005-01-11 Thread Jeff Beal
Shoot.  Didn't read your message closely enough.  This only applies to 
exceptions thrown within a JSP page and handled by the JSP exception 
handling mechanism, and you're talking about the Struts exception 
handling mechanism.

Sorry 'bout the noise.
-- Jeff
Jeff Beal wrote:
 From Section 2.4 of the JSP 1.2 specification:
"If the errorPage attribute of a page directive names a URL that refers 
to another JSP, and that JSP indicates that it is an error page (by 
setting the page directive’s isErrorPage attribute to true) then the 
'exception' implicit scripting language variable of that page is 
initialized to the offending Throwable reference"

-- Jeff
Daffin, Miles (Company IT) wrote:
JC,
Thanks. This I know. But...
If I do this in struts-config:



Then error.jsp will be called when an Exception is thrown by an Action
method. In error.jsp I can print a general message. I would like to be
able to also print out stack trace info in the jsp. Does the mere fact
of designating error.jsp as my error hadling page mean that struts has
put the Exception somewhere, e.g. the request? If so under what key? Or
must I do all this myself:



In ExeptionHandler I log the problem ad then put the formatted Exeption
stacktrace on the request, or something similar?
-Miles

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 
11 January 2005 16:20
To: Struts Users Mailing List
Subject: RE: Handling the exceptions in struts



Miles, you can capture a stack trace from any throwable using a 
technique
like:

 ByteArrayOutputStream baos = new 
ByteArrayOutputStream();
 (new Throwable(s)).printStackTrace(new 
PrintStream(baos));
 return baos.toString();

The result could be logged.
Hope this helps.
JC
 
 
 "Daffin, Miles  
 
 (Company IT)"To:   "Struts 
Users Mailing List"   
 <[EMAIL PROTECTED]cc:
 
 tanley.com>  Subject:  RE: 
Handling the exceptions in struts 
 
 
 01/11/2005 05:54 AM 
 
 Please respond to   
 
 "Struts Users Mailing   
 
 List"   
 
 



The html:errors tag will display a generic message but how can I 
display the details of what went wrong (e.g. the Exception's 
stacktrace) in the designated error jsp?

What are the options?
Can someone point me at some docs that go into this in more detail?
Thanks,
-Miles




**
The information contained in this communication is confidential, 
private, proprietary, or otherwise privileged and is intended only 
for the use of the addressee.  Unauthorized use, disclosure, 
distribution or copying is strictly prohibited and may be unlawful.  
If you have received this communication in error, please notify the 
sender immediately at (312)653-6000 in Illinois; (972)766-6900 in 
Texas; or (800)835-8699 in New Mexico.
**

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


 
NOTICE: If received in error, please destroy and notify sender.  
Sender does not waive confidentiality or privilege, and use is 
prohibited.  

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


Dispatch action and java script?

2005-01-11 Thread Nadia Kunkov
Hi,
I implemented DispatchAction and I have a page with three submit buttons, each 
executes a method in my dispatch action.

This works fine but I would like to make sure that one of the radio buttons 
that I have on the page is clicked.
My validation is turned off for this action since there are no input fields to 
validate.
I created a javascript function that will check if a radio button is clicked.
So now I have 

I don't know if I can do this with dispatch action.  It looks like I can't 
since I never go into the validate() function, but go right to the action when 
I click the button.

Another way of doing it would be to create another form for this action with 
just one field and turn on the validation where I would check the value of a 
radio button.  

What is a better way of doing it?  What is a best practice?

Thanks for your help.
NK




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



Re: Handling the exceptions in struts

2005-01-11 Thread Jeff Beal
From Section 2.4 of the JSP 1.2 specification:
"If the errorPage attribute of a page directive names a URL that refers 
to another JSP, and that JSP indicates that it is an error page (by 
setting the page directive’s isErrorPage attribute to true) then the 
'exception' implicit scripting language variable of that page is 
initialized to the offending Throwable reference"

-- Jeff
Daffin, Miles (Company IT) wrote:
JC,
Thanks. This I know. But...
If I do this in struts-config:



Then error.jsp will be called when an Exception is thrown by an Action
method. In error.jsp I can print a general message. I would like to be
able to also print out stack trace info in the jsp. Does the mere fact
of designating error.jsp as my error hadling page mean that struts has
put the Exception somewhere, e.g. the request? If so under what key? Or
must I do all this myself:



In ExeptionHandler I log the problem ad then put the formatted Exeption
stacktrace on the request, or something similar?
-Miles

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 11 January 2005 16:20
To: Struts Users Mailing List
Subject: RE: Handling the exceptions in struts



Miles, you can capture a stack trace from any throwable using 
a technique
like:

 ByteArrayOutputStream baos = new 
ByteArrayOutputStream();
 (new Throwable(s)).printStackTrace(new 
PrintStream(baos));
 return baos.toString();

The result could be logged.
Hope this helps.
JC
 
 
 "Daffin, Miles  
 
 (Company IT)"To:   
"Struts Users Mailing List"   

 <[EMAIL PROTECTED]cc:
 
 tanley.com>  Subject:  
RE: Handling the exceptions in struts 

 
 
 01/11/2005 05:54 AM 
 
 Please respond to   
 
 "Struts Users Mailing   
 
 List"   
 
 
 


The html:errors tag will display a generic message but how 
can I display the details of what went wrong (e.g. the 
Exception's stacktrace) in the designated error jsp?

What are the options?
Can someone point me at some docs that go into this in more detail?
Thanks,
-Miles




**
The information contained in this communication is 
confidential, private, proprietary, or otherwise privileged 
and is intended only for the use of the addressee.  
Unauthorized use, disclosure, distribution or copying is 
strictly prohibited and may be unlawful.  If you have 
received this communication in error, please notify the 
sender immediately at (312)653-6000 in Illinois; 
(972)766-6900 in Texas; or (800)835-8699 in New Mexico.
**

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


 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited. 
 

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


RE: Handling the exceptions in struts

2005-01-11 Thread Jeff_Caswell




You might investigate these links:

Section 4.5 here:
http://struts.apache.org/userGuide/building_controller.html

and the corresponding javadoc here:

http://struts.apache.org/api/org/apache/struts/action/ExceptionHandler.html

Since I really don't know off the top-of-my-head...

Good luck!

JC





  "Daffin, Miles

  (Company IT)"To:   "Struts Users 
Mailing List"
  <[EMAIL PROTECTED]cc: 
 
  tanley.com>  Subject:  RE: Handling the 
exceptions in struts  


  01/11/2005 10:36 AM   

  Please respond to 

  "Struts Users Mailing 

  List" 







JC,

Thanks. This I know. But...

If I do this in struts-config:





Then error.jsp will be called when an Exception is thrown by an Action
method. In error.jsp I can print a general message. I would like to be
able to also print out stack trace info in the jsp. Does the mere fact
of designating error.jsp as my error hadling page mean that struts has
put the Exception somewhere, e.g. the request? If so under what key? Or
must I do all this myself:





In ExeptionHandler I log the problem ad then put the formatted Exeption
stacktrace on the request, or something similar?

-Miles

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 11 January 2005 16:20
> To: Struts Users Mailing List
> Subject: RE: Handling the exceptions in struts
>
>
>
>
>
> Miles, you can capture a stack trace from any throwable using
> a technique
> like:
>
>   ByteArrayOutputStream baos = new
> ByteArrayOutputStream();
>   (new Throwable(s)).printStackTrace(new
> PrintStream(baos));
>   return baos.toString();
>
> The result could be logged.
>
> Hope this helps.
>
> JC
>
>
>
>
>   "Daffin, Miles
>
>   (Company IT)"To:
> "Struts Users Mailing List" 
>
>   <[EMAIL PROTECTED]cc:
>
>   tanley.com>  Subject:
> RE: Handling the exceptions in struts
>
>
>
>   01/11/2005 05:54 AM
>
>   Please respond to
>
>   "Struts Users Mailing
>
>   List"
>
>
>
>
>
>
>
> The html:errors tag will display a generic message but how
> can I display the details of what went wrong (e.g. the
> Exception's stacktrace) in the designated error jsp?
>
> What are the options?
>
> Can someone point me at some docs that go into this in more detail?
>
> Thanks,
>
> -Miles
>
>
>
>
>
>
>
>
>
> **
> The information contained in this communication is
> confidential, private, proprietary, or otherwise privileged
> and is intended only for the use of the addressee.
> Unauthorized use, disclosure, distribution or copying is
> strictly prohibited and may be unlawful.  If you have
> received this communication in error, please notify the
> sender immediately at (312)653-6000 in Illinois;
> (972)766-6900 in Texas; or (800)835-8699 in New Mexico.
> **
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


NOTICE: If received in error, please destroy and notify sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.


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





**
The information contained in this communication is confidential, private, 
proprietary, or otherwise privileged and is intended only for the use of the 
addressee.  Unauthorized use, disclosure, distribution or copying is strictly 
prohibited and may be unlawful. 

RE: Handling the exceptions in struts

2005-01-11 Thread Daffin, Miles (Company IT)
JC,

Thanks. This I know. But...

If I do this in struts-config:





Then error.jsp will be called when an Exception is thrown by an Action
method. In error.jsp I can print a general message. I would like to be
able to also print out stack trace info in the jsp. Does the mere fact
of designating error.jsp as my error hadling page mean that struts has
put the Exception somewhere, e.g. the request? If so under what key? Or
must I do all this myself:





In ExeptionHandler I log the problem ad then put the formatted Exeption
stacktrace on the request, or something similar?

-Miles

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: 11 January 2005 16:20
> To: Struts Users Mailing List
> Subject: RE: Handling the exceptions in struts
> 
> 
> 
> 
> 
> Miles, you can capture a stack trace from any throwable using 
> a technique
> like:
> 
>   ByteArrayOutputStream baos = new 
> ByteArrayOutputStream();
>   (new Throwable(s)).printStackTrace(new 
> PrintStream(baos));
>   return baos.toString();
> 
> The result could be logged.
> 
> Hope this helps.
> 
> JC
> 
> 
>   
>   
>   "Daffin, Miles  
>   
>   (Company IT)"To:   
> "Struts Users Mailing List"   
>  
>   <[EMAIL PROTECTED]cc:
>   
>   tanley.com>  Subject:  
> RE: Handling the exceptions in struts 
>  
>   
>   
>   01/11/2005 05:54 AM 
>   
>   Please respond to   
>   
>   "Struts Users Mailing   
>   
>   List"   
>   
>   
>   
> 
> 
> 
> 
> The html:errors tag will display a generic message but how 
> can I display the details of what went wrong (e.g. the 
> Exception's stacktrace) in the designated error jsp?
> 
> What are the options?
> 
> Can someone point me at some docs that go into this in more detail?
> 
> Thanks,
> 
> -Miles
> 
> 
> 
> 
> 
> 
> 
> 
> 
> **
> The information contained in this communication is 
> confidential, private, proprietary, or otherwise privileged 
> and is intended only for the use of the addressee.  
> Unauthorized use, disclosure, distribution or copying is 
> strictly prohibited and may be unlawful.  If you have 
> received this communication in error, please notify the 
> sender immediately at (312)653-6000 in Illinois; 
> (972)766-6900 in Texas; or (800)835-8699 in New Mexico.
> **
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited. 
 

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



RE: Handling the exceptions in struts

2005-01-11 Thread Jeff_Caswell




Miles, you can capture a stack trace from any throwable using a technique
like:

  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  (new Throwable(s)).printStackTrace(new
PrintStream(baos));
  return baos.toString();

The result could be logged.

Hope this helps.

JC




  "Daffin, Miles

  (Company IT)"To:   "Struts Users 
Mailing List"
  <[EMAIL PROTECTED]cc: 
 
  tanley.com>  Subject:  RE: Handling the 
exceptions in struts  


  01/11/2005 05:54 AM   

  Please respond to 

  "Struts Users Mailing 

  List" 







The html:errors tag will display a generic message but how can I display
the details of what went wrong (e.g. the Exception's stacktrace) in the
designated error jsp?

What are the options?

Can someone point me at some docs that go into this in more detail?

Thanks,

-Miles









**
The information contained in this communication is confidential, private, 
proprietary, or otherwise privileged and is intended only for the use of the 
addressee.  Unauthorized use, disclosure, distribution or copying is strictly 
prohibited and may be unlawful.  If you have received this communication in 
error, please notify the sender immediately at (312)653-6000 in Illinois; 
(972)766-6900 in Texas; or (800)835-8699 in New Mexico.
**


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



Opinions needed - My plan for directing navigation afters session timeouts and update actions?

2005-01-11 Thread john . chesher




I have two situations I am trying to address with one generic solution:

1) For every update action, I had to maintain two separate "result
confirmation" JSPs, one stating "Update Successful" and one "Updated failed
due to system error.  Try again later."  (must be a system error, as any
data validation errors would have been returned to original data entry
JSP.)  Each of these also has a button with a unique link to take it to the
appropriate action to build what should be the next view for that user (I
want to be able to bounce them back to a page that was most recent or
appropriate for where they were in the application.)

2)  On session timeout, I want to bounce the user to a login page, then
bring them back to the page/action they were attempting to go to, or the
most appropriate location, based on the application knowing only the user
id of the user and no other context.

If you could review my plan below and let me know if it is sound from a
Struts perspective OR whether there are Struts best practices to accomplish
the same thing in a more elegant way, that would be great.  I am pretty
sure there is a bug in how I propose using the various session attibutes
below, but please don't worry with that - I'll sort it out when I
implement.  I am really seeking an opinion on the overall approach.
Thanks!

MY PLAN:

Keep three attributes in the session object up to date at all times:
a)  previousAction  -  the most recent action completed by the user
b)  currentAction  -  the next action the user was attempting when the
error or session timeout occurred
c)  nextAction  -  the next action that should be invoked after a
successful action (ONLY after successful actions)
c)  previousActionResult  -  the message to be displayed on
actionResult.jsp (after ALL update actions, whether successful, failed, or
timed-out)


Psuedo-code for a session timeout scenario:

User is on ChangePasswordDef and presses button to process change with
ChangePasswordAction

AuthenticationFilter (this is a filter that precedes ALL actions.  It
checks authority of the user to execute the action, logs that the user
executed the action, and looks for session timeout)
  set previousAction = currentAction (no longer prev action.  In fact,
null in this scenario.)
  set currentAction = ChangePassword
  If new session (session timed out before this action)
set previousActionResult = "...inactive too long..."
forward to actionResult.jsp

actionResult.jsp
  display previousActionResult
  render OK button to go to GoToLoginAction

GoToLoginAction
  forward to LoginDef (Tiles)

LoginDef
  invoke LoginAction

LoginAction
  process login successfully
  If currentAction != null
forward to actionResultAction

actionResultAction
  If currentAction = "ChangePassword"
forward to ChangePasswordAction

AuthenticationFilter
  pass authorization check and do not detect session timeout
  if current action != previousAction
set previousAction = BuildHomeViewAction
currentAction = ChangePassword

ChangePasswordAction
  (finally where the user wanted to be!)
--
"NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected."


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



Re: Unable to see out put

2005-01-11 Thread Rick Reumann
Vamsee Kanakala wrote the following on 1/11/2005 9:59 AM:
Hi List,
I have a code fragment like this:

  

  
Where statusList is a list of class instances, which has a setters and 
getters for properties id and name. Now, if I give the above code, I 
should be able to print out the names in each instance, right? But I am 
not able to. Please help. And, my Lomboz plugin auto-compiles my jsp and 
says:

"According to tld, Attribute items does not accept any expressions"
It sounds like you are probably are now using a JSP2.0 container like 
Tomcat5 and are refering to the wrong tld. Refer to the one in the jar like:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
and remove and direct pointing to the tlds you have.
But I'm using c.tld. I don't know what I'm doing wrong. Please help.
-VK
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

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


[almost OT] Struts in Practice

2005-01-11 Thread t t
If you are a sports lover, or Struts lover, please take a look at this website:
www.sportslovers.net . It's based on Struts. Have a good day!
Sorry if this email bothers you.



-
Do you Yahoo!?
 Meet the all-new My Yahoo! – Try it today! 

Re: Log4j - HTMLLayout CSS

2005-01-11 Thread Kris Schneider
>From a quick look at the source, it would appear to be pretty much hard-coded.
No separate stylesheet reference. There may be other third-party formatters
available that allow that sort of custimization, but I'm not aware of any off
the top of my head. Of course, it doesn't seem like it would be too difficult
to roll your own based on the existing code

Quoting Ritchie Warsito <[EMAIL PROTECTED]>:

> This isn't really struts related, but I was wondering if maybe someone 
> here knew something about this.
> Is it possible to change/replace/remove the css style that log4j 
> generates for html output, if so, where to do that?
> It is interfering with my own stylesheet, thus giving a screwed up 
> layout of my Struts application.

-- 
Kris Schneider 
D.O.Tech   

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



Unable to see out put

2005-01-11 Thread Vamsee Kanakala
Hi List,
I have a code fragment like this:

  

  


Where statusList is a list of class instances, which has a setters and 
getters for properties id and name. Now, if I give the above code, I 
should be able to print out the names in each instance, right? But I am 
not able to. Please help. And, my Lomboz plugin auto-compiles my jsp and 
says:

"According to tld, Attribute items does not accept any expressions"
But I'm using c.tld. I don't know what I'm doing wrong. Please help.
-VK
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Log4j - HTMLLayout CSS

2005-01-11 Thread Ritchie Warsito
This isn't really struts related, but I was wondering if maybe someone 
here knew something about this.
Is it possible to change/replace/remove the css style that log4j 
generates for html output, if so, where to do that?
It is interfering with my own stylesheet, thus giving a screwed up 
layout of my Struts application.

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


RE: Handling the exceptions in struts

2005-01-11 Thread Daffin, Miles (Company IT)
The html:errors tag will display a generic message but how can I display the 
details of what went wrong (e.g. the Exception's stacktrace) in the designated 
error jsp? 

What are the options?

Can someone point me at some docs that go into this in more detail?

Thanks,

-Miles

> -Original Message-
> From: Amleto Di Salle [mailto:[EMAIL PROTECTED] 
> Sent: 11 January 2005 09:38
> To: 'Struts Users Mailing List'
> Subject: R: Handling the exceptions in struts
> 
> Hi,
> You can use the tag "exception" inside the tag action for 
> local exception, or global-exceptions for global ones.
> 
> For example:
> 
>   scope="request" type="java.lang.NullPointerException"/>
>   
> 
> or
> 
>  scope="request" type="com.foo.InvalidLoginException"/>
>  path="error.in.form"
> scope="request" type="com.foo.TokenInvalidException"/>
> 
> 
> The attribute "path" can be a JSP page or a tiles which 
> contains the html:errors tag.
> The attribute key contains a resource message.
> 
> BR
> /Amleto
> 
> 
> > -Messaggio originale-
> > Da: Manisha Sathe [mailto:[EMAIL PROTECTED]
> > Inviato: martedì 11 gennaio 2005 10.26
> > A: user@struts.apache.org
> > Oggetto: Handling the exceptions in struts
> > 
> > 
> > I am trying to have a common routine for Exceptions.
> >  
> > Inside Action Class I am calling this common method, passing 
> > ActionMapping as parameter, doing some stuff like logging and then 
> > forwarding to error page.
> >  
> > But the problem is what if i get exception in my normal Common Java 
> > files (which does not have ActionMapping) - then how i can 
> forward it 
> > to error page ?
> >  
> > I am bit confused in how to handle exceptions in effective way. Pls 
> > guide me.
> >  
> > regards
> > Manisha
> >  
> >  
> >  
> >  
> > 
> > __
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com
> > 
> > --
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 
> 10/01/2005
> >  
> > 
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005
>  
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited. 
 

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



Validating DynaBean nested beans with a custom validator.

2005-01-11 Thread Daffin, Miles (Company IT)
Dear All,
 
I have a DynaValidatorActionForm like this:
 








When the related form is submitted the action adds the 'newPerson' to
the 'personList' and replaces newPerson, on the DynaBean, with a new
PersonFormBean. This all works fine. Now I want to add declarative
validation for the newPerson, so only valid newPersons reach the action
code that adds them to the list. 
 
The thing is that PersonFormBeans (in this example) have a start and end
date (a period). The validation rules for these fields are:
* start date and end date must be dates (dd/MM/)
* start date must be before end date
* end date must be after or equal to today
* etc...
 
So, you see, apart from the first rule, this goes beyond what can be
achieved by plucking out the fields from the nested bean and using the
default set of simple field validators shipped with struts (required,
date etc.). (Even if you disagree that these validation requirements
cannot be met in using the default validators please read on. This is
just an example.)
 
I have created a new validator that I want to handle the entire nested
PersonFormBean: personValidator.
 



 
public static boolean validatePerson(Object bean, ValidatorAction va,
Field field, ActionErrors errors, HttpServletRequest request)
{
PersonFormBean personFormBean =
somehowGetTheBloodyPersonFormBeanOffTheBean(bean);
// Do the validation directly on the personFormBean.
return true;
}
private static PersonFormBean
somehowGetTheBloodyPersonFormBeanOffTheBean(Object bean)
{
// How do I implement this?
// It has to be generic, in case I change my mind about the type of
the bean,
// e.g. make it a simple bean with getters and setters instead of
using the DynaBean...
return null;
}
 
Would you: 
a) grab the nested PersonFormBean from the main, parent bean and then
work directly with this? If so how? Is there a utility method somewhere?
b) grab individual fields from the nested bean using BeanUtils methods
(or other - feel free to advise).
 
Your thoughts/urls would be appreciated.
 
Many thanks.
 
-Miles
 
Miles Daffin
Morgan Stanley
20 Cabot Square | Canary Wharf | London E14 4QA | UK
Tel: +44 (0) 20 767 75119
[EMAIL PROTECTED]  

 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited. 
 


Re: error with logic:iterate on dynabeans

2005-01-11 Thread Olasoji Ajayi
After going thru some source codes in the struts package, i discovered that 
the problem hat to do with formating, the last two colums of my table are 
DATE formats which translated to java.sql.date type in java. the bean taglib 
was looking for a resource ot determine how to format the data on those 
fields but since i did not create any resource configurations, it was 
looking for what was not there. i had to hard code a format on the 
bean:write tag using the format attribute. i dont think this is a neat idea 
especially for beginers like me who want to whip up a working application 
with as little advanced configurations as possible so we can learn one thing 
at a time, (resource bundles/intenationalizatin, jdbc, etc) and still get 
struts to give us some workable defaults.
- Original Message - 
From: "Olasoji Ajayi" <[EMAIL PROTECTED]>
To: "struts user mailing list" 
Sent: Tuesday, January 04, 2005 9:18 AM
Subject: error with logic:iterate on dynabeans

i get the following error when i run a web application to display the 
contents of a table.


HTTP Status 500 -

type Exception report
message
description The server encountered an internal error () that prevented it 
from fulfilling this request.

exception
javax.servlet.ServletException: Cannot find message resources under key 
org.apache.struts.action.MESSAGE
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800) org.apache.jsp.formFile_jsp._jspService(formFile_jsp.java:238) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994) org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305)root causejavax.servlet.jsp.JspException: Cannot find message resources under keyorg.apache.struts.action.MESSAGE org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1233) org.apache.struts.taglib.TagUtils.message(TagUtils.java:1082) org.apache.struts.taglib.TagUtils.message(TagUtils.java:1057) org.apache.struts.taglib.bean.WriteTag.retrieveFormatString(WriteTag.java:256) org.apache.struts.taglib.bean.WriteTag.formatValue(WriteTag.java:362) org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:234) org.apache.jsp.formFile_jsp._jspService(formFile_jsp.java:195) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994) org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158) org.apache.struts.action.ActionServlet.doP

Re: How to detect Cancel button i pressed ?

2005-01-11 Thread Nicolas De Loof

Manisha Sathe a écrit :
Hi Nicolas,
Thanks for the response,
1)I tried this, but giving me error. Pls would u mind giving some code example ?
 

use  in your JSP (do not set property !)
use isCanceled(request) in action. Is cancel was used to post the form, 
it will return true.

2)About exception - do u mean to say my own method common to all ? This also if u can explain with code example would be of great help. 
 

I set a global ExceptionHandler in struts config to catch all 
exceptions. It logs them for debug and forwards to an error page.

Thanks once again,
regards
Manisha
Nicolas De Loof <[EMAIL PROTECTED]> wrote:
You can check for cancel in actions using
isCanceled(request)
Struts cancel tag uses a magic value that this method will detect 
(formbean validation is also skipped)

About exception, I used to set a global exception handler that logs 
exception stack and forwards to a generic error page.

Nico.
Manisha Sathe a écrit :
 

I had posted it before - might hv missed the response. I want to check whether 
Cancel button is pressed, if yes then want to redirect it to another page
Also how to handle th Exceptions. I am catching many exceptions inside my Action Handlers. 
what shall i do with them ? Currently just printing the error messages on System.out, but what is the good practice to handle exceptions ? Close all Resultsets/ connections and redirect to error page ? write some standard routine ? 

In struts-config i have given mapping to "errors" as global forward, but what 
if exceptions occur inside my common classes ?
regards
Manisha
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

   

This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the person 
to whom it is addressed. If you are not the intended recipient, you are not 
authorized to read, print, retain, copy, disseminate, distribute, or use this 
message or any part thereof. If you receive this message in error, please 
notify the sender immediately and delete all copies of this message.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

		
-
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search. Learn more.
 

This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the person 
to whom it is addressed. If you are not the intended recipient,  you are not 
authorized to read, print, retain, copy, disseminate,  distribute, or use this 
message or any part thereof. If you receive this  message in error, please 
notify the sender immediately and delete all  copies of this message.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Handling the exceptions in struts

2005-01-11 Thread McDonnell, Colm (MLIM)
Have you considered using declarative exception handling? 

http://struts.apache.org/userGuide/building_controller.html#exception_ha
ndler


-Original Message-
From: Manisha Sathe [mailto:[EMAIL PROTECTED] 
Sent: 11 January 2005 09:26
To: user@struts.apache.org
Subject: Handling the exceptions in struts


I am trying to have a common routine for Exceptions.
 
Inside Action Class I am calling this common method, passing
ActionMapping as parameter, doing some stuff like logging and then
forwarding to error page.
 
But the problem is what if i get exception in my normal Common Java
files (which does not have ActionMapping) - then how i can forward it to
error page ?
 
I am bit confused in how to handle exceptions in effective way. Pls
guide me.
 
regards
Manisha
 
 
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

 
If you are not an intended recipient of this e-mail, please notify the sender, 
delete it and do not read, act upon, print, disclose, copy, retain or 
redistribute it. Click here for important additional terms relating to this 
e-mail. http://www.ml.com/email_terms/ 

 

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



R: Handling the exceptions in struts

2005-01-11 Thread Amleto Di Salle
Hi,
You can use the tag "exception" inside the tag action for local
exception, or global-exceptions for global ones.

For example:

 
 


or





The attribute "path" can be a JSP page or a tiles which contains the
html:errors tag.
The attribute key contains a resource message.

BR
/Amleto


> -Messaggio originale-
> Da: Manisha Sathe [mailto:[EMAIL PROTECTED] 
> Inviato: martedì 11 gennaio 2005 10.26
> A: user@struts.apache.org
> Oggetto: Handling the exceptions in struts
> 
> 
> I am trying to have a common routine for Exceptions.
>  
> Inside Action Class I am calling this common method, passing 
> ActionMapping as parameter, doing some stuff like logging and 
> then forwarding to error page.
>  
> But the problem is what if i get exception in my normal 
> Common Java files (which does not have ActionMapping) - then 
> how i can forward it to error page ?
>  
> I am bit confused in how to handle exceptions in effective 
> way. Pls guide me.
>  
> regards
> Manisha
>  
>  
>  
>  
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005
>  
> 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005
 


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



Re: How to view the actual HTTP generated by a struts action.

2005-01-11 Thread Ulrich Elsner
Yet another tool that might be worth checking out is Fiddler 
( ttp://www.fiddlertool.com/fiddler/ ) a free tool (Windows only :-( )
that I found quite
 helpful when analyzing HTTP traffic.

Regards,

Ulrich Elsner



On Mon, 10 Jan 2005 17:47:21 -0500, Bryce Fischer
<[EMAIL PROTECTED]> wrote:
> Jim Barrows wrote:
> >>-Original Message-
> >>From: kjc [mailto:[EMAIL PROTECTED]
> >>
> >>Is there a way to log the HTTP post string that is sent by
> >>the browser when
> >>clicking on
> >>
> >>
> >
> > Why won't right click view source not work?
> 
> I think the OP meant what the HTTP Post looks like, not what the
> generated HTML looks like.
> 
> I use a feature that comes with MyEclipse (its not unique to MyEclipse,
> but its the one I'm familiar with). I think another popular one is
> ProxyWorkbench http://www.tcpiq.com/tcpIQ/ProxyWorkbench/.
> 
> Basically, they act like a proxy. Suppose your Tomcat listens on port
> 8080.  You setup your proxy to listen to another port, like say 8081. It
> redirects to port 8080. You then setup your app to post to port 8081.
> The proxy logs the conversation.
> 
> -
> 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: Edit Form - populate values from database

2005-01-11 Thread Manisha Sathe
Thanks to all, Now i could manage to get the things working properly. 
 
regards
Manisha


-
Do you Yahoo!?
 Yahoo! Mail - now with 250MB free storage. Learn more.

Handling the exceptions in struts

2005-01-11 Thread Manisha Sathe
I am trying to have a common routine for Exceptions.
 
Inside Action Class I am calling this common method, passing ActionMapping as 
parameter, doing some stuff like logging and then forwarding to error page.
 
But the problem is what if i get exception in my normal Common Java files 
(which does not have ActionMapping) - then how i can forward it to error page ?
 
I am bit confused in how to handle exceptions in effective way. Pls guide me.
 
regards
Manisha
 
 
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com