Re: how to selectively call struts validation from a form

2006-11-23 Thread Paul Benedict

Robin,

I only have one issue with this approach. I dont know how to make use of 
the built-in validation rules provided in validation-rules.xml in my 
.java code.


You are not trying to replace the validator. You are still going to use 
it, so code in your normal rules in the XML file. All you're doing is 
providing an alternate key (if necessary), and invoking the validator 
yourself. Notice in the example it didn't do anything like checking for 
nulls; it called form.validate() which delegates to the validator.


Paul

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



Re: how to selectively call struts validation from a form

2006-11-23 Thread robin bajaj


Thanks Paul for your input on this issue and
Thanks Wendy for suggesting the following link.

> Rick has an article on calling validation manually, here:
>   http://learntechnology.net/validate-manually.do
>

I understand this stuff

ActionErrors errors = form.validate( mapping, request );
if ( errors != null && !errors.isEmpty() ) {
saveErrors(request, errors);
setUp(request);
return (mapping.findForward(UIconstants.VALIDATION_FAILURE));
}
--
I only have one issue with this approach. I dont know how to make use of 
the built-in validation rules provided in validation-rules.xml in my 
.java code.

I can check for simple things like not-null, not-empty etc. but checking
something like "email" field will be easier if I could leverage the 
rules provided by Struts validation framework in validator-rules.xml.


Is there a way to do this ?
Essentially I want to use validation rules like "email", "mask" from 
validator-rules.xml while writing my Action or ActionForm java code.




Any pointers ?
regards,
robin.




Wendy Smoak wrote:

On 11/23/06, robinbajaj <[EMAIL PROTECTED]> wrote:


Hi Folks,
My previous post's subject was not clear. So here's a re-phrase of the
problem.

My loyaltyPAge.jsp has two buttons - Exit and continue.

I want the validation to occur only when "Continue" is clicked upon.
But the 

Rick has an article on calling validation manually, here:
  http://learntechnology.net/validate-manually.do



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



Re: how to selectively call struts validation from a form

2006-11-23 Thread Paul Benedict

WongTseng wrote:

You say the validator is based on whatever key I supply.Is that true, as
far as I know the validation is linked with the form by the form's name.
ValidatorForm and ValidatorActionForm are coded to select the keys for 
you. The former picks the form name, the second picks the action URI. 
You're totally free to override the getValidationKey() method of the 
ActionForm and provide your own key.


Paul

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



Re: how to selectively call struts validation from a form

2006-11-23 Thread Wendy Smoak

On 11/23/06, robinbajaj <[EMAIL PROTECTED]> wrote:


Hi Folks,
My previous post's subject was not clear. So here's a re-phrase of the
problem.

My loyaltyPAge.jsp has two buttons - Exit and continue.

I want the validation to occur only when "Continue" is clicked upon.
But the 

Rick has an article on calling validation manually, here:
  http://learntechnology.net/validate-manually.do

--
Wendy

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



Re: how to selectively call struts validation from a form

2006-11-23 Thread WongTseng

hi,Paul:
   You say the validator is based on whatever key I supply.Is that true, as
far as I know the validation is linked with the form by the form's name.
2006/11/24, Paul Benedict <[EMAIL PROTECTED]>:


Robin,

The validator is based on whatever key you supply. You can choose the
key. I like to do "formname(buttonname)" style. So if I have a form
called "personForm" and a button called "save", my form key in my
validaton files is "personForm(buttonname)".

Paul




--
Wong Tseng


Re: why/when to use redirect

2006-11-23 Thread Mississippi John Hurt

How could I forward via redirect option but have struts pass any request
attributes or parameters to the new redirect url?  I think its only possible
to pass the request parameters and not the attributes right?  How can I do
that?  Thanks.

On 11/23/06, Adam Hardy <[EMAIL PROTECTED]> wrote:


You can also manipulate your forward to put the parameters (preferably
just an
ID, not a whole set of properties) onto the querystring, so that they
reappear
in the request parameters and your form bean. It's the Post-Redirect-Get
pattern.

Nuwan Chandrasoma on 21/11/06 10:15, wrote:
> if you use redirect=true , it would create a new request.. so what ever
> u had on the reqest will be lost. i think u have your action in request
> socope, you can change them to session scope and make sure you removed
> the Form and other attribute you put on the session after the action is
> finished.
>
> - Original Message - From: "fea jabi" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, November 21, 2006 6:49 AM
> Subject: why/when to use redirect
>> I am not really clear when to use redirect=true.
>>
>> I am chaining actions. As I was doing this I had to use redirect=true
>> to get the values that were set in one action to another. But the
>> request attributes set in that action were lost when redirect is set
>> to true. why is that? is there any way, I can use redirect=true and
>> also get the request attributes???
>>
>> also, not really sure when to use the
contextRelative=true/false/yes/no??


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




Re: how to selectively call struts validation from a form

2006-11-23 Thread Paul Benedict

Robin,

Yes, there is a way, but Struts cannot automatically supply the solution 
for you. The stumbling block is that you have automatic validation 
turned on. If you only want to validate on a certain button, first turn 
automatic validation off. This will prevent Struts from running the 
validator whenever the request is submitted.


Then inside your Action, you'll have to explicitly determine when it is 
the appropriate time to run the validation. If you're using the new 
Struts EventAction(Dispatcher) classes, you can associate certain button 
s to different methods. Inside the intended action method, you then 
should invoke the validator based on whatever key you determine.


The validator is based on whatever key you supply. You can choose the 
key. I like to do "formname(buttonname)" style. So if I have a form 
called "personForm" and a button called "save", my form key in my 
validaton files is "personForm(buttonname)".


Paul

robinbajaj wrote:
Hi Folks, 
My previous post's subject was not clear. So here's a re-phrase of the

problem.

My loyaltyPAge.jsp has two buttons - Exit and continue.

I want the validation to occur only when "Continue" is clicked upon.
But the having "validate=true" - that's why the Struts validation framework 
tries to validate the input fields regardless of which button is clicked. 


Is there some facility provided by the Struts framework to
SKIP the validation when a specific button (Exit) is clicked
and ONLY OCCUR when another button(*Continue) is clicked . ???

I am using inbuild validation framework (validation-.xml
and validator-rules.xml etc.) in this case, 


Thanks for your help,
regards,
robin.


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



how to selectively call struts validation from a form

2006-11-23 Thread robinbajaj

Hi Folks, 
My previous post's subject was not clear. So here's a re-phrase of the
problem.

My loyaltyPAge.jsp has two buttons - Exit and continue.

I want the validation to occur only when "Continue" is clicked upon.
But the .xml
and validator-rules.xml etc.) in this case, 

Thanks for your help,
regards,
robin.
-- 
View this message in context: 
http://www.nabble.com/how-to-selectively-call-struts-validation-from-a-form-tf2695232.html#a7516473
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: org.apache.commons.validator.ValidatorException: No such validation method:

2006-11-23 Thread Paul Benedict
When you upgrade Struts, you must also replace your validator.xml file. 
The signatures have changed between versions.


Thomas Thomas wrote:

Hi,
been one week I have this error 

When I try to submit a form,
I have this error :
 

23-nov.-2006 23:38:32 org.apache.struts.validator.DynaValidatorForm 
validate

GRAVE: No such validation method:
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest)
org.apache.commons.validator.ValidatorException: No such validation method:
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest)
   at org.apache.commons.validator.ValidatorAction.loadValidationMethod(
ValidatorAction.java:603)
   at org.apache.commons.validator.ValidatorAction.executeValidationMethod(
ValidatorAction.java:533)
   at org.apache.commons.validator.Field.validateForRule(Field.java:766)
   at org.apache.commons.validator.Field.validate(Field.java:846)
   at org.apache.commons.validator.Form.validate(Form.java:290)
   at org.apache.commons.validator.Validator.validate(Validator.java:354)
   at org.apache.struts.validator.DynaValidatorForm.validate(
DynaValidatorForm.java:117)
   at org.apache.struts.chain.commands.servlet.ValidateActionForm.validate(
ValidateActionForm.java:53)
   at org.apache.struts.chain.commands.AbstractValidateActionForm.execute(
AbstractValidateActionForm.java:100)
   at org.apache.struts.chain.commands.ActionCommandBase.execute(
ActionCommandBase.java:48)
   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at org.apache.commons.chain.generic.LookupCommand.execute(
LookupCommand.java:304)
   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at org.apache.struts.chain.ComposableRequestProcessor.process(
ComposableRequestProcessor.java:280)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java
:1858)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:869)
   at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection 


(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
 



This is in my struts-config.xml :
[...]
   
   
[...]
   


   
[]

 
   
[...]

Here are my validation.xml and my validator-rules.xml (located both in
/WEB-INF/validators/) :



http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd";>


   
   

   
   
   
   
   



http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd";>


 
   
 
   
 
   
 




Any help would be very very welcome !
Thank u !



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



Re: why/when to use redirect

2006-11-23 Thread Adam Hardy
You can also manipulate your forward to put the parameters (preferably just an 
ID, not a whole set of properties) onto the querystring, so that they reappear 
in the request parameters and your form bean. It's the Post-Redirect-Get pattern.


Nuwan Chandrasoma on 21/11/06 10:15, wrote:
if you use redirect=true , it would create a new request.. so what ever 
u had on the reqest will be lost. i think u have your action in request 
socope, you can change them to session scope and make sure you removed 
the Form and other attribute you put on the session after the action is 
finished.


- Original Message - From: "fea jabi" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, November 21, 2006 6:49 AM
Subject: why/when to use redirect

I am not really clear when to use redirect=true.

I am chaining actions. As I was doing this I had to use redirect=true 
to get the values that were set in one action to another. But the 
request attributes set in that action were lost when redirect is set 
to true. why is that? is there any way, I can use redirect=true and 
also get the request attributes???


also, not really sure when to use the contextRelative=true/false/yes/no??



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



org.apache.commons.validator.ValidatorException: No such validation method:

2006-11-23 Thread Thomas Thomas

Hi,
been one week I have this error 

When I try to submit a form,
I have this error :

23-nov.-2006 23:38:32 org.apache.struts.validator.DynaValidatorForm validate
GRAVE: No such validation method:
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest)
org.apache.commons.validator.ValidatorException: No such validation method:
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest)
   at org.apache.commons.validator.ValidatorAction.loadValidationMethod(
ValidatorAction.java:603)
   at org.apache.commons.validator.ValidatorAction.executeValidationMethod(
ValidatorAction.java:533)
   at org.apache.commons.validator.Field.validateForRule(Field.java:766)
   at org.apache.commons.validator.Field.validate(Field.java:846)
   at org.apache.commons.validator.Form.validate(Form.java:290)
   at org.apache.commons.validator.Validator.validate(Validator.java:354)
   at org.apache.struts.validator.DynaValidatorForm.validate(
DynaValidatorForm.java:117)
   at org.apache.struts.chain.commands.servlet.ValidateActionForm.validate(
ValidateActionForm.java:53)
   at org.apache.struts.chain.commands.AbstractValidateActionForm.execute(
AbstractValidateActionForm.java:100)
   at org.apache.struts.chain.commands.ActionCommandBase.execute(
ActionCommandBase.java:48)
   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at org.apache.commons.chain.generic.LookupCommand.execute(
LookupCommand.java:304)
   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at org.apache.struts.chain.ComposableRequestProcessor.process(
ComposableRequestProcessor.java:280)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java
:1858)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:869)
   at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)


This is in my struts-config.xml :
[...]
   
   
[...]
   


   
[]

 
   
[...]

Here are my validation.xml and my validator-rules.xml (located both in
/WEB-INF/validators/) :



http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd";>


   
   

   
   
   
   
   



http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd";>


 
   
 
   
 
   
 




Any help would be very very welcome !
Thank u !


how to use validation rules from validatior-rules.xml in Struts Actions

2006-11-23 Thread robin bajaj

Hi Folks,
I have an Email text field that I want to validate against Struts
validation framework's provided "email" Rule in validator-rules.xml.

Can I do this programmatically in Struts Action or ActionForm's java 
code instead of

having to declaratively do it in validation.xml. ??


Any help would be much appreciated,
robin.

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



Parameters not being set on Action in Struts 2

2006-11-23 Thread Tarek Nabil
Hi,

I'm experimenting with Struts 2, and I'm facing a problem with request
parameters being populated on the Action. I checked out the source to
make sure that the behavior I expect is the correct one, and judging by
the source, it is, but it's not happening.


I have an action that has a method

public void setType(Integer type) {
// some code
}

I declared the action in Struts.xml as follows


/jsp/someFolder/someJSP.jsp
dod1!setup


In the setup method, I put the following line

logger.debug(getContext().getParameters());

In the URL, I call the following

http://server/application/namespace/dod1!setup.action?type=1

The result is that the parameters map is logged as {} and in my method
when I attempt to access the type field, I find it to be null!

Could someone please point me to what could be wrong?

Thanks,
Tarek Nabil




 
 
DISCLAIMER
This email and any files transmitted with it are confidential and contain 
privileged or copyright 
information. If you are not the intended recipient you must not copy, 
distribute or use this email
or the information contained in it for any purpose other than to notify us of 
the receipt thereof.
If you have received this message in error, please notify the sender 
immediately, and delete this
email from your system.

Please note that e-mails are susceptible to change.The sender shall not be 
liable for the improper
or incomplete transmission of the information contained in this 
communication,nor for any delay in
its receipt or damage to your system.The sender does not guarantee that this 
material is free from
viruses or any other defects although due care has been taken to minimise the 
risk.
**

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



redirect-action parameters

2006-11-23 Thread Pascal Lalonde
Based on this sample from the web site documentation:


   
generateReport
  /genReport
  pie
  100
  100
   



How can I add dynamic parameters ?
Here, values are fixed but what if I want to set a dynamic value from the 
action data ?

Based on this

When setting:
abc

I'm having the following error:
WARNING: Caught OgnlException while setting property 'testKey' on type 
'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
ognl.NoSuchPropertyException: 
org.apache.struts2.dispatcher.ServletActionRedirectResult.testKey at 
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:133)

What is happening here ?

Thanks






Re: Indexed Properties

2006-11-23 Thread Adam K

Just thought that I would say that the following will be incredibly helpful
to anyone working on indexed properties in the future:
(It has a complete working example)

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=58&t=009880

thanks to everyone for all of the help.



On 11/23/06, Puneet Lakhina <[EMAIL PROTECTED]> wrote:


On 11/22/06, Adam K <[EMAIL PROTECTED]> wrote:
>
> If you might be able to provide a sample I would be very greatful.
> As it stands I have come up with the following :
> changing the JSP to :
>
> 
>  id="Result">
>   

 indexed="true" /> 
>   
> 
> 


Hmm.. As i said try something like this


  

 
  



In case you dont encounter any error while loading the page. please post
the
HTML generated. That would give a good idea of what is going wrong.


Result seemed more natural as it is a single element of the results.
> All I want to be able to do is pull 3 things out of an object, display
> them
> in a scope of request, and allow the user to update the list and submit
> the
> form and have the changes be picked up - who would have thought that
would
> be so incredibly complex ?
> *Note*  The part that leads me to believe it's a misunderstanding of the
> tags involved is that I can get a single textfield to work perfectly,
with
> all the requirements (other than it being an object with multiple
> properties).
>
>
> On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
> >
> > hi Adam,
> >
> > I understand description,numProducts are properties in User defined
> > Object/java bean in results(getResults(),setResults(..)) Collection in
> > your
> > actionForm.
> >
> > For this kind of requirments there will not be any change in
actionform
> > even
> > though ,complixety increases in nesting..
> >
> > Solution is to use Nested Tags.
> >
> > Nested tags are used for nesting a object inside the other.
> >
> > In your requirment "results" is a nested property in your actionform.
> > "results" collection  has a collection of objects.
> >
> > I have used Nested tags for most complex requirments and succeeded.
> >
> > Nested Tags is the real power of Struts...
> >
> >
> > Regards
> > Raghu
> >
> >
> >
> >
> >
> > -Original Message-
> > From: Adam K [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, November 18, 2006 2:55 AM
> > To: Struts Users Mailing List
> > Subject: Re: Indexed Properties
> >
> >
> > Thanks for the suggestion I'll keep trying things and see what I can
get
> > from it.
> >
> >
> > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > >
> > > Lots of people have done it.  Search the archives [1]. Search for
> > > "indexed" and "lazyList".   I've done it with both ActionForm and
> > > DynaActionForm.
> > >
> > > Hubert
> > >
> > > [1] http://struts.apache.org/mail.html
> > >
> > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > I think I have found the problem - or at least a potential
> > cause.  Would
> > > it
> > > > be correct in stating that this will not work using ActionForm
(what
> I
> > > was
> > > > using)  and that I must instead use DynaActionForm ?
> > > >
> > > > Thanks for the time thus far.
> > > >
> > > >
> > > > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Adam,
> > > > >
> > > > > Try adding a getResultsPage() that doesn't take params and
always
> > > > > returns a valid collection.  (Throw in the setResultsPage() that
> > > > > accepts a collection as well.)
> > > > >
> > > > > Hubert
> > > > >
> > > > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > > > This has been driving me nuts for the past little bit.
> > > > > > I have a page that is populated using indexed properties.  The
> > > > > prepopulation
> > > > > > works  fine, and I get the results as I would expect them, but
> > > trying to
> > > > > > submit the form I get an index out of bounds exception.  I
know
> > that
> > > it
> > > > > is
> > > > > > being caused because the page doesn't have the arrayList to
use
> in
> > > the
> > > > > > indexed properties.   I guess my question boils down to using
> > > indexed
> > > > > > properties properly.  I will start by putting in an
explanation
> of
> > > what
> > > > > I
> > > > > > have and what I am trying to do:
> > > > > >
> > > > > > The following is what I am working with :
> > > > > > JSP:
> > > > > >
> > > > > > 
> > > > > >  > > > > > id="ResultsPage">
> > > > > > 
> > > > > >  > > > > property="description"
> > > > > > />
> > > > > >  > > > > property="numProducts"
> > > > > > indexed="true" /> 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > >
> > > > > > What I am trying to achieve is that a user clicks on a link,
> they
> > > are
> > > > > sent
> > > > > > to page, and all of the values are prepopulated.  The page is
> then
> > > > > displayed
> > > > > > and the user has the option to modify any of the variables
that
> > they
> > > > > want 

[Fwd: Having problems with Struts validation framework]

2006-11-23 Thread robin bajaj

Hello folks,
I found a little issue with the action that's being called.
Please dis-regard my previous mail reporting this issue.
Its resolved now.

However, I have another related issue.
My loyaltyPAge.jsp has two buttons - Exit and continue.

I want the validation to occur only when "Continue" is clicked upon.
But because there's one form in the LoyaltyPage.jsp having these two 
buttons, they both get evaluated using one actionMapping (which has the 
validate=true).


Is there some facility provided by the Struts framework to
SKIP the validation when a specific button (Exit) is clicked
and ONLY OCCUR when another button(*Continue) is clicked . ???

A corollary question to this would be,
Is it possible for one JSP to have two buttons in one form,
and each button calling a different Action.

Currently as I know, the action gets called based on the
  setting.


Any help would be much appreciated,
regards,
robin.










--- Begin Message ---

Hi Folks,

--- problem ---
My validation is working but the control doesnt go back to the input 
page. I want the input page to render again showing the errors.


--- Details --
I am using Struts 1.1.x for my webApp.
My validation is working fine. (validator-rules.xml and 
validation-renewal.xml setup correctly and declared in 
struts-config-renewal.xml file).


I want to validate an "Email" text field on "LoyaltyPage.jsp", it has to 
be non-empty, valid email address.


Here's the snippet from validation-renewal.xml
-
 





--

Here's the snippet from struts-config-renewal.xml
--

   
   
   path="/ErrorPageRenewal.jsp">



--

I do notice that validation is occuring but the control doesnt go back 
to the loyaltypage.jsp even though I have mentioned it as the input 
attribute in the action mapping. I just get a blank page in the browser.


"input="/LoyaltyPage.jsp"

I have tried changing the input attribute to the action that actually 
forwards to loyaltyPage.jsp

"input="/getLoyalty.do"

but in both the cases, I get the blank page in the browser. I want the 
loyaltypage.jsp to render again with the error messages showing up.


The following logs show clearly that the validation is occuring, form is 
failing the validation, but the input page is still not rendering in the 
browser.


What's the missing piece in the whole picture, please help ???


2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor - Processing a 'POST' for path 
'/processLoyalty'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  Looking for ActionForm bean instance in 
scope 'request' under attribute key 'loyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  Creating new ActionForm instance of type 
'com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  --> 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Storing ActionForm bean instance 
in scope 'request' under attribute key 'loyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Populating bean properties from 
this request
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
BeanUtils.populate([EMAIL PROTECTED], 
{actionValue=[Ljava.lang.String;@1633bbd, 
contactMethod=[Ljava.lang.String;@1e719e8, 
sendCommunication=[Ljava.lang.String;@155f12b, 
email=[Ljava.lang.String;@14c7c48})
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty([EMAIL PROTECTED], 
actionValue, [continue])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string 'continue' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty([EMAIL PROTECTED], 
contactMethod, [])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string '' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty([EMAIL PROTECTED], 
sendCommunication, [false])
2006-11-2

Having problems with Struts validation framework

2006-11-23 Thread robin bajaj

Hi Folks,

--- problem ---
My validation is working but the control doesnt go back to the input 
page. I want the input page to render again showing the errors.


--- Details --
I am using Struts 1.1.x for my webApp.
My validation is working fine. (validator-rules.xml and 
validation-renewal.xml setup correctly and declared in 
struts-config-renewal.xml file).


I want to validate an "Email" text field on "LoyaltyPage.jsp", it has to 
be non-empty, valid email address.


Here's the snippet from validation-renewal.xml
-
 





--

Here's the snippet from struts-config-renewal.xml
--

   
   
   path="/ErrorPageRenewal.jsp">



--

I do notice that validation is occuring but the control doesnt go back 
to the loyaltypage.jsp even though I have mentioned it as the input 
attribute in the action mapping. I just get a blank page in the browser.


"input="/LoyaltyPage.jsp"

I have tried changing the input attribute to the action that actually 
forwards to loyaltyPage.jsp

"input="/getLoyalty.do"

but in both the cases, I get the blank page in the browser. I want the 
loyaltypage.jsp to render again with the error messages showing up.


The following logs show clearly that the validation is occuring, form is 
failing the validation, but the input page is still not rendering in the 
browser.


What's the missing piece in the whole picture, please help ???


2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor - Processing a 'POST' for path 
'/processLoyalty'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  Looking for ActionForm bean instance in 
scope 'request' under attribute key 'loyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  Creating new ActionForm instance of type 
'com.xyz.salescentral.flow.formbean.renewal.LoyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] util.RequestUtils -  --> 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Storing ActionForm bean instance 
in scope 'request' under attribute key 'loyaltyForm'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Populating bean properties from 
this request
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
BeanUtils.populate([EMAIL PROTECTED], 
{actionValue=[Ljava.lang.String;@1633bbd, 
contactMethod=[Ljava.lang.String;@1e719e8, 
sendCommunication=[Ljava.lang.String;@155f12b, 
email=[Ljava.lang.String;@14c7c48})
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty([EMAIL PROTECTED], 
actionValue, [continue])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string 'continue' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty([EMAIL PROTECTED], 
contactMethod, [])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string '' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty([EMAIL PROTECTED], 
sendCommunication, [false])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string 'false' to class 
'boolean'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.BeanUtils - 
setProperty([EMAIL PROTECTED], 
email, [])
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils - Convert string '' to class 
'java.lang.String'
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] beanutils.ConvertUtils -   Using converter 
[EMAIL PROTECTED]
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestProcessor -  Validating input form properties
2006-11-23 11:35:39,546 219875 DEBUG [ExecuteThread: '7' for queue: 
'default'] action.RequestPro

Re: Regarding Compatability for Struts-2.0.1

2006-11-23 Thread Wendy Smoak

On 11/23/06, Mitchell James <[EMAIL PROTECTED]> wrote:


Struts 2 will not be backward compatible in the sense of allowing you
to run things "as is".  I would recommend taking a look at the
migration guide.


I was going to suggest taking a look a the "Struts 1 Plugin" but it is
still awaiting documentation.

http://struts.apache.org/2.x/struts2-plugins/struts2-struts1-plugin/apidocs/index.html

This is intended to allow you to run s1 and s2 side by side, so you
can convert an application in stages.

http://struts.apache.org/2.x/docs/plugin-guide.html

--
Wendy

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



enctype="multipart/form-data" gives null values for other ActionForm properties

2006-11-23 Thread Morten Andersen
When I'm uploading a form I set the enctype to multipart/form-data in 
the jsp file.


In the action receiving the form I want to use the other properties from 
the form, but these are not set.


Example:

ActionForm has the properties:
- name (String) edited in a actionFormImpl.getName(), where actionFormImpl is the actual ActionForm, 
but that method returns null.


Why is autopopulate not working when enctype is set as multipart/form-data?

Regards

Morten Andersen

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



Re: enctype="multipart/form-data" gives null values for ActionForm properties

2006-11-23 Thread Morten Andersen

Sorry I rephrase the question and post as new topic.



Mitchell James skrev:
With most browsers, you cannot autopopulate a file upload field on a 
form.  The reason for this is security.  If such a thing was allowed, 
malicious web sites could have hidden frames that uploaded sensitive 
files.


For the browsers that do allow it, they will prompt and warn the user 
when submit is called.



--
James Mitchell
678.910.8017




On Nov 23, 2006, at 5:29 AM, Morten Andersen wrote:

I want to upload a file as a part of a form. This requires that the 
enctype of the form is set to: multipart/form-data.


When that is set like that the autopopulate thing doesn't work.

How can I make sure that the properties are autopopulated even though 
I use enctype="multipart/form-data".



Thanks

Morten Andersen
www.blobcom.com
Denmark

-
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: Regarding Compatability for Struts-2.0.1

2006-11-23 Thread Mitchell James
Struts 2 will not be backward compatible in the sense of allowing you  
to run things "as is".  I would recommend taking a look at the  
migration guide.


 http://struts.apache.org/WW/migration-guide.html


--
James Mitchell
678.910.8017




On Nov 23, 2006, at 5:55 AM, Jeevan Kumar Kade wrote:


Hi All,

  I worked on Struts 1.1 for around 1 year.
  With that experience and knowledge, when i was looking into  
Sturts-2.0.1 document and example i really just woundering and have  
few queries on them which i am listing below.


  Please, clarify these queries.

  Queries

  1.  Architecture changes are more and complex to understand  
between the different layers
  2.  Code for Action class has been changed(Action has been  
replaced by ActionSupport and also signature of execute() method)

  3.  Form is missing
  4.  In JSP the taglibs are replaced by struts-tags
  5.  The big one is struts-config.xml replaced by struts.xml and  
the structure of the xml has been changed adding  instead  
of  and some other tags like  etc



  If this is the case, then how struts 2.0.1 will support the  
comptability?


  As per my knowledge, things have to get change a lot and the  
learning curve will be challenging for developers.


  I need your suggestions/advices on this

  Thanks in Advance

  Jeevan


-
Check out the all-new Yahoo! Mail beta - Fire up a more powerful  
email and get things done faster.



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



Re: enctype="multipart/form-data" gives null values for ActionForm properties

2006-11-23 Thread Mitchell James
With most browsers, you cannot autopopulate a file upload field on a  
form.  The reason for this is security.  If such a thing was allowed,  
malicious web sites could have hidden frames that uploaded sensitive  
files.


For the browsers that do allow it, they will prompt and warn the user  
when submit is called.



--
James Mitchell
678.910.8017




On Nov 23, 2006, at 5:29 AM, Morten Andersen wrote:

I want to upload a file as a part of a form. This requires that the  
enctype of the form is set to: multipart/form-data.


When that is set like that the autopopulate thing doesn't work.

How can I make sure that the properties are autopopulated even  
though I use enctype="multipart/form-data".



Thanks

Morten Andersen
www.blobcom.com
Denmark

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



struts2-portlet-2.0.1

2006-11-23 Thread Alex Andrushchak

Hello!

I've tried to launch struts2 portlet application under jetspeed2 but 
unfortunatelly no luck.

There are one tutorial on struts2 wiki but it is not fresh enough.
I've looked inside war and found some starnges there:
1. there are no struts.xml but xwork.xml instead.
2. in xwork.xml there are reference to struts-portlet-default.xml but i 
can't find this file anywhere.


Are there any good docs, tutorials about portlet development with struts?
How to fix this sample portlet to run it under jetspeed2?

Best regards,
Alex Andrushchak


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



Regarding Compatability for Struts-2.0.1

2006-11-23 Thread Jeevan Kumar Kade
Hi All,
   
  I worked on Struts 1.1 for around 1 year.  
  With that experience and knowledge, when i was looking into Sturts-2.0.1 
document and example i really just woundering and have few queries on them 
which i am listing below.
   
  Please, clarify these queries.
   
  Queries
   
  1.  Architecture changes are more and complex to understand between the 
different layers
  2.  Code for Action class has been changed(Action has been replaced by 
ActionSupport and also signature of execute() method)
  3.  Form is missing
  4.  In JSP the taglibs are replaced by struts-tags
  5.  The big one is struts-config.xml replaced by struts.xml and the structure 
of the xml has been changed adding  instead of  and some other 
tags like  etc
   
   
  If this is the case, then how struts 2.0.1 will support the comptability?
   
  As per my knowledge, things have to get change a lot and the learning curve 
will be challenging for developers.
   
  I need your suggestions/advices on this
   
  Thanks in Advance
   
  Jeevan

 
-
Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get 
things done faster.

Re: Indexed Properties

2006-11-23 Thread Puneet Lakhina

On 11/22/06, Adam K <[EMAIL PROTECTED]> wrote:


If you might be able to provide a sample I would be very greatful.
As it stands I have come up with the following :
changing the JSP to :



  


   
indexed="true" /> 
  





Hmm.. As i said try something like this

   
 


 
   


In case you dont encounter any error while loading the page. please post the
HTML generated. That would give a good idea of what is going wrong.


Result seemed more natural as it is a single element of the results.

All I want to be able to do is pull 3 things out of an object, display
them
in a scope of request, and allow the user to update the list and submit
the
form and have the changes be picked up - who would have thought that would
be so incredibly complex ?
*Note*  The part that leads me to believe it's a misunderstanding of the
tags involved is that I can get a single textfield to work perfectly, with
all the requirements (other than it being an object with multiple
properties).


On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
>
> hi Adam,
>
> I understand description,numProducts are properties in User defined
> Object/java bean in results(getResults(),setResults(..)) Collection in
> your
> actionForm.
>
> For this kind of requirments there will not be any change in actionform
> even
> though ,complixety increases in nesting..
>
> Solution is to use Nested Tags.
>
> Nested tags are used for nesting a object inside the other.
>
> In your requirment "results" is a nested property in your actionform.
> "results" collection  has a collection of objects.
>
> I have used Nested tags for most complex requirments and succeeded.
>
> Nested Tags is the real power of Struts...
>
>
> Regards
> Raghu
>
>
>
>
>
> -Original Message-
> From: Adam K [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 18, 2006 2:55 AM
> To: Struts Users Mailing List
> Subject: Re: Indexed Properties
>
>
> Thanks for the suggestion I'll keep trying things and see what I can get
> from it.
>
>
> On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> >
> > Lots of people have done it.  Search the archives [1]. Search for
> > "indexed" and "lazyList".   I've done it with both ActionForm and
> > DynaActionForm.
> >
> > Hubert
> >
> > [1] http://struts.apache.org/mail.html
> >
> > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > I think I have found the problem - or at least a potential
> cause.  Would
> > it
> > > be correct in stating that this will not work using ActionForm (what
I
> > was
> > > using)  and that I must instead use DynaActionForm ?
> > >
> > > Thanks for the time thus far.
> > >
> > >
> > > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Adam,
> > > >
> > > > Try adding a getResultsPage() that doesn't take params and always
> > > > returns a valid collection.  (Throw in the setResultsPage() that
> > > > accepts a collection as well.)
> > > >
> > > > Hubert
> > > >
> > > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > > This has been driving me nuts for the past little bit.
> > > > > I have a page that is populated using indexed properties.  The
> > > > prepopulation
> > > > > works  fine, and I get the results as I would expect them, but
> > trying to
> > > > > submit the form I get an index out of bounds exception.  I know
> that
> > it
> > > > is
> > > > > being caused because the page doesn't have the arrayList to use
in
> > the
> > > > > indexed properties.   I guess my question boils down to using
> > indexed
> > > > > properties properly.  I will start by putting in an explanation
of
> > what
> > > > I
> > > > > have and what I am trying to do:
> > > > >
> > > > > The following is what I am working with :
> > > > > JSP:
> > > > >
> > > > > 
> > > > >  > > > > id="ResultsPage">
> > > > > 
> > > > >  > > > property="description"
> > > > > />
> > > > >  > > > property="numProducts"
> > > > > indexed="true" /> 
> > > > > 
> > > > > 
> > > > > 
> > > > >
> > > > > What I am trying to achieve is that a user clicks on a link,
they
> > are
> > > > sent
> > > > > to page, and all of the values are prepopulated.  The page is
then
> > > > displayed
> > > > > and the user has the option to modify any of the variables that
> they
> > > > want to
> > > > > before resubmitting the page.  (When they resubmit the form has
a
> > url
> > > > > parameter attached to it).  What is happening (or at least what
I
> > > > believe is
> > > > > happening is the following:  link is clicked, reset is called
> action
> > > > sets
> > > > > the variables, page is displayed, user can modify the page and
> > resubmit,
> > > > > reset is called on the form, the action is called (this is where
> it
> > dies
> > > > as
> > > > > there is no longer an ArrayList) to modify.  My question is am I
> > going
> > > > about
> > > > > this in a manner that seems sensible or am I way off base ?  I
> have
> > the
> > >

enctype="multipart/form-data" gives null values for ActionForm properties

2006-11-23 Thread Morten Andersen
I want to upload a file as a part of a form. This requires that the 
enctype of the form is set to: multipart/form-data.


When that is set like that the autopopulate thing doesn't work.

How can I make sure that the properties are autopopulated even though I 
use enctype="multipart/form-data".



Thanks

Morten Andersen
www.blobcom.com
Denmark

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