ActionForm LifeCycle (Maybe a bug in Struts)

2004-01-13 Thread Rodney Paul
Hi All,
 
I was wondering if anyone knew what the lifecycle of an ActionForm is?
The reason I ask is in regards to the display of variables with a .
 
I have noticed that the values displayed within a  are values after a 
reset() method has been called,
and not after a validate method is called. Can anyone tell me the reason for this, as 
I seem to think this is a bug
within the Struts framework.
 
 
An example follows as to what I am talking about (based upon the following ActionForm):
 
 
// Example ActionForm
public class MyActionForm extends ActionForm {
private String maximumDocuments = "3";
...// More variables


public MyActionForm() {
super();
System.out.println("Constructor called");
}



public void setMaximumDocuments(String maximumDocuments) {
this.maximumDocuments = maximumDocuments;
}

public String getMaximumDocuments() {
return maximumDocuments;
}
...// More get/set methods


public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest 
httpServletRequest) {
ActionErrors errors = new ActionErrors();

System.out.println("validate called");
System.out.println("before processing maximumDocuments: " + maximumDocuments);
 
if(maximumDocuments == null) {
maximumDocuments = "50";// The supposed default value (if no value 
entered)
}

System.out.println("after processing maximumDocuments: " + maximumDocuments);
...// Say an error has been returned
return errors;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {
System.out.println("reset called");
System.out.println("before processing maximumDocuments: " + 
this.maximumDocuments);
 
this.maximumDocuments   = "50";

System.out.println("after processign maximumDocuments: " + 
this.maximumDocuments);
}
}

 
 
SCENARIOS:


 

LIFECYCLE 1: From a previous page to a form which uses this ActionForm
 
The following output gets displayed:
 
Constructor called
reset called
before processing maximumDocuments: 3
after processing maximumDocuments: 50
 
RESULT: Here the value displayed in the form is 50 for maximumDocuments   (Correct)

 
--
LIFECYCLE 2: If an error occurs within the ActionForm (and the value 1 has been 
entered for maximumDocuments)
 
The following output gets displayed:
 
Constructor called
reset called
before processing maximumDocuments: 3
after processing maximumDocuments: 50
validate called
before processing maximumDocuments: 1
after processing maximumDocuments: 1
 
RESULT: Here the value displayed in the form is 50 for maximumDocuments(Incorrect 
as it should be 1)
--
 
 
 
Can anyone please tell me why this is happening, and how to correct this problem.
 
Cheers
Rodneyt Paul
 


Problem redisplaying data user has entered within a form

2003-09-12 Thread Rodney Paul



Hi 
All,
 
I am currently 
experiencing a problem in regards to redisplaying form data a user has entered 
within a form.
I am experiencing 
this problem both from ActionForm and LookupDispatchAction classes in a 
major project.
 
As a consequence I 
decided to 
write a very small login application to see if I could solve this 
problem.

The 
login application will display a user login application screen. If a user 
tries to login, and does so successfully a
welcome page is displayed. However if 
not successful a informative message should appear, as well as what the user has 
entered into the fields.
Unfortunately the 
data the the user has enetered never gets repopulated in the form text fields 
when login has been unsuccessful.
 
Has anyone got a 
solution to this problem. Any help would be appreciated.
 
 
Cheers
Rodney
 
 
ps. NOTE: The first 
screen the user sees comes directly from a JSP page (not from a redirect of a 
Action class to a JSP page).
pss. The code is 
shown below and is attached to this email.
 
 
 
Struts-Config.xml
--
    
        
    
    
        
type="net.natdata.application.test.login.LoginAction"    
name="test.LoginActionForm"    
input="/Login.jsp"    
scope="request"    
validate="true"    
parameter="method">    
    
    
    
        

 
 
 
Application 
Resources (Property file)
-
button.login=Loginfield.userIdentifier=User 
IDfield.password=Password
heading.login=Login
error.generalMessage=An error has occured and all processing has been 
suspended until further notice.error.invalidPassword=The password you have 
entered is incorrect.error.invalidUser=The user entered doesnt 
exist.
error.userIdentifier.required=A user id must be entered to log 
in.error.password.required=A password must be entered to log 
in.
 
 
 
Login.jsp
-
<%@ page 
language="java" %><%@ taglib uri="/tags/struts-bean"  
prefix="bean" %><%@ taglib uri="/tags/struts-html"  prefix="html" 
%><%@ taglib uri="/tags/struts-logic" prefix="logic" 
%>
 
    
    
    
    
       
name="test.LoginAction"   
type="net.natdata.application.test.login.LoginActionForm">    
    
    
:    
    
    
    
:    
    
    
    
    
    
    
    
    
    
    
    

 
 
LoginSuccessful.jsp
-
<%@ page 
language="java" %><%@ taglib uri="/tags/struts-bean"  
prefix="bean" %><%@ taglib uri="/tags/struts-html"  prefix="html" 
%><%@ taglib uri="/tags/struts-logic" prefix="logic" 
%>
 
    
Login    
Login    
You have successfully logged into the 
system
 
 
 
LOGIN ActionForm 
Class
-
public class 
LoginActionForm extends ActionForm {    // Variables used 
within the form.    private String 
userIdentifier;    private String 
password;    private String method;    
        public void 
setUserIdentifier(String userIdentifier) 
{    this.userIdentifier = 
userIdentifier;    }    
    public String getUserIdentifier() 
{    return 
userIdentifier;    }    
    public void setPassword(String password) 
{    this.password = 
password;    }        
public String getPassword() {    
return password;    }    
    public void setMethod(String method) 
{    this.method = 
method;    }        
public String getMethod() {    return 
method;    }        
    public ActionErrors validate(ActionMapping actionMapping, 
HttpServletRequest httpServletRequest) 
{    ActionErrors errors = new 
ActionErrors();    boolean failure = 
false;    
    if(method.equals("Login")) 
{    
if((userIdentifier == null) || (userIdentifier.trim().equals(""))) 
{    
errors.add(userIdentifier, new 
ActionError("error.userIdentifier.required"));    
}    else 
{    
if((password == null) || (password.trim().equals(""))) 
{    
errors.add(userIdentifier, new 
ActionError("error.password.required"));    
}    
}    
}    
    return 
errors;    }        
public void reset(ActionMapping mapping, HttpServletRequest request) 
{    this.userIdentifier = 
null;    this.password = 
null;    this.method = 
null;    }}
 
 
LOGIN Action 
Class
-
public class 
LoginAction extends LookupDispatchAction {    protected 
java.util.Map getKeyMethodMap() {    
Map map = new HashMap();    
map.put("button.login", "login");    
return map;    }        
public ActionForward login(ActionMapping mapping, ActionForm 
form,   
HttpServletRequest request, HttpServletResponse 
response) 

RE: Redisplaying of entered form fields

2003-09-09 Thread Rodney Paul
Hi Jan,

Thank you for responding to my email, most appreciative.
So from what I gathered from your response this is what I should do:

---
CHANGES TO CODE BASE
---
/* PART 1 Configuration File: */













/* PART 2 Class Changes: */
public class OrganisationNameSearchAction extends LookupDispatchAction {
protected java.util.Map getKeyMethodMap() {
Map map = new HashMap();
map.put("validateError", "validateError"); // CHANGE
map.put("button.next", "next");
return map;
}

// ADD METHOD
public ActionForward validateError(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) throws 
IOException, ServletException {
String target = "failure";
ActionErrors actionErrors = new ActionErrors();

try {
OrganisationNameSearchActionForm organisationNameSearchForm = 
(OrganisationNameSearchActionForm)form;
String organisationName = organisationNameSearchForm.getOrganisationName();
String ACN = organisationNameSearchForm.getACN();

if((organisationName == null) || (organisationName.trim().equals(""))) {
errors.add("organisationName", new 
ActionError("error.organisationName.required"));
}
if((ACN != null) && (!ACN.trim().equals(""))) {
try {
Integer.parseInt(ACN);
}
catch(NumberFormatException e) {
errors.add("ACN", new ActionError("error.ACN.format"));
}
}
}
catch(Exception e) {
target = "error";
}
finally {
// Save errors if needed and forward to the appropriate page to display
if(!actionErrors.isEmpty()) {
saveErrors(request, actionErrors);
}
return (ActionForward)mapping.findForward(target);
}
}


}
---


Now in your reply you stated "...in this method you then can initialize what you need".
Do I take it that is where I must store the variables the user has entered.
If so do I store the user input directly into the session object,
or do I store the user input indirecty into the session object via the ActionForm.

ie.
session.setAttribute("organisationName", organisationName);
session.setAttribute("ACN", ACN);

OR

session.setAttribute("ActionForm", actionForm);   // has ACN and organisationName


Also within my JSP code do I just leave the code as is (as I am using the html struts 
taglibs)
or do I change the JSP to redisplay the user input. Below is some JSP code I use.



...
:
:
...




Cheers
Rodney





-Original Message-
From: Jan Van Stalle [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 10 September 2003 8:57 AM
To: [EMAIL PROTECTED]
Subject: Re: Redisplaying of entered form fields


Rodney,

I had similar problems with a DispatchAction. The problem is, when the
validation fails, it does not come into your action class; the good news is
that you can define an 'input' attribute in your actionmapping
(struts-config.xml) which will be used when your validation fails; I had put
a reference to a .jsp page, but you can also specify an action.

In my DispatchAction class, I have a method name validateError(...); you
then define the input attribute as

input="myAction.do?method=validateError"

myAction is an action mapping which maps to the same class.

in this method you then can initialize what you need.

Jan



"Rodney Paul" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
>
> I have a problem redisplaying form fields a user enters within a html
form.
>
> I use the validate method to validate form entry fields through
ActionForms.
> and validate business logic in LookupDispatchAction classes.
>
> Has anyone experienced this problem, and is there any solution to this
> matter.
>
> Cheers
> Rodney
>
>
>
> CODE:
> Below the code you see is part of an application I am building.
> The problem here lies in the fact that in all cases,
> field data does not get redisplayed within the form the user has entered
data in.
>
> eg. if you enter a invalid data wi

Redisplaying of entered form fields

2003-09-08 Thread Rodney Paul
Hi All,

I have a problem redisplaying form fields a user enters within a html form.

I use the validate method to validate form entry fields through ActionForms.
and validate business logic in LookupDispatchAction classes.

Has anyone experienced this problem, and is there any solution to this
matter.

Cheers
Rodney



CODE:
Below the code you see is part of an application I am building.
The problem here lies in the fact that in all cases,
field data does not get redisplayed within the form the user has entered data in.

eg. if you enter a invalid data within a numeric data field (this instance ACN)
then the ActionForm issues a error message gets issued (works)
but the ACN previously entered does not get redisplayed in the form.

eg. if you enter a valid ACN or Organisation Name within the fields to do searches,
and no data is applicable to the search criteria entered a error message gets 
issued (works)
but no ACN/Organisation Name gets redisplayed in the form where the data was 
entered.



Part 1: Sample Configuration (struts-config.xml)

























PART 2: Application form code (validation and reset methods)

public class OrganisationNameSearchActionForm extends ActionForm {

// Get and Set methods


public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest 
httpServletRequest) {
ActionErrors errors = new ActionErrors();

if(method.equals("Next")) {
if((organisationName == null) || (organisationName.trim().equals(""))) {
errors.add("organisationName", new 
ActionError("error.organisationName.required"));
}

if((ACN != null) && (!ACN.trim().equals(""))) {
try {
Integer.parseInt(ACN);
}
catch(NumberFormatException e) {
errors.add("ACN", new ActionError("error.ACN.format"));
}
}
}

return errors;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {
this.method = null;
this.organisationName = null;
this.ACN = null;
}
}

Part 3: Action Code (Sample)

public class OrganisationNameSearchAction extends LookupDispatchAction {
protected java.util.Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.next", "next");
return map;
}

public ActionForward next(ActionMapping mapping, ActionForm form,
  HttpServletRequest request, HttpServletResponse response)
  throws IOException, ServletException {
boolean error = false;
boolean failure = false;
String target = "next";
ActionErrors actionErrors = new ActionErrors();

try {
HttpSession session = request.getSession(false);
if(session != null) {
OrganisationNameSearchMessageDTO organisationNameSearchResult = 
performOrganisationNameSearch(form, session);
if(organisationNameSearchResult == null) {
error = true;
}
else if(organisationNameSearchResult.getRequestRejectionGroup() != 
null) {

if(organisationNameSearchResult.getRequestRejectionGroup().getRejectionDetailsSegment()
 != null) {
failure = true;
}
}

if(!error && !failure) {
processResults(organisationNameSearchResult, session);
target = "next";
}
else if(failure) {
String errorMsg = 
organisationNameSearchResult.getRejectionMessage();
actionErrors.add(ActionErrors.GLOBAL_ERROR, new 
ActionError("errorMessage", errorMsg));
target = "failure";
}
else {
target = "error";
}
}
else {
actionErrors.add(ActionErrors.GLOBAL_ERROR, new 
ActionError("error.noSession"));
target = "error";
}
}
catch(Exception e) {
target = "error";
}
finally {
// Save errors if needed and forward to the appropriate page to display
if(!actionErrors.isEmpty()) {
saveErrors(request, actionErrors);
}
return (ActionForward)mapping.findForward(target);
}
}


}

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



RE: Redisplaying of entered form fields

2003-09-08 Thread Rodney Paul
d to the view.
(If it is already false then thats not the problem and you should post some
more of your code and configs so we can try and see whats going wrong.)


-Original Message-
From: Rodney Paul [mailto:[EMAIL PROTECTED]
Sent: Friday, 5 September 2003 09:31
To: Struts Users Mailing List (E-mail)
Subject: Redisplaying of entered form fields


Hi All,

I have a problem redisplaying form fields a user enters within a html form.

I use the validate method to validate form entry fields through ActionForms.
and validate business logic in LookupDispatchAction classes.

Has anyone experienced this problem, and is there any solution to this
matter.

Cheers
Rodney


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



Redisplaying of entered form fields

2003-09-04 Thread Rodney Paul
Hi All,
 
I have a problem redisplaying form fields a user enters within a html form.
 
I use the validate method to validate form entry fields through ActionForms.
and validate business logic in LookupDispatchAction classes.
 
Has anyone experienced this problem, and is there any solution to this matter.
 
Cheers
Rodney


RE: Problem with redisplay of form values when issuing error messages

2003-07-30 Thread Rodney Paul
Hi Navjot,

In my application this does not happen.
I have tried many things to make it work, but simply it does not work.

I dont know why this is the case, as I am using the standard Struts framework.
I am using however a special Action class known as LookupDispatchAction.

Cheers
Rodney

-Original Message-
From: Navjot Singh [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 30 July 2003 4:42 PM
To: Struts Users Mailing List
Subject: RE: Problem with redisplay of form values when issuing error
messages


it WILL redisplay the form with filled values.
say, you submit a filled form, some data was wrong, 
the same form will be displayed WITH filled-in values.

navjot

|-Original Message-
|From: Rodney Paul [mailto:[EMAIL PROTECTED]
|Sent: Wednesday, July 30, 2003 2:09 PM
|To: Struts Users Mailing List (E-mail)
|Subject: Problem with redisplay of form values when issuing error
|messages
|
|
|Hi All,
| 
|I am currently using the Struts MVC2 framework to develop a wizard 
|application.
|Upon reading the literature in regards to how Struts works, I 
|noticed that my application
|will does not re-display form values entered by the user if errors 
|are issued.
| 
|Is it possible to re-display form values from an ActionForm if the 
|validate method returns
|ActionErrors. If so, how do you achieve this? Do you need to store 
|anything in a session object?
| 
|Is it possible to re-display form values from an Action class if 
|we return ActionErrors.
| 
| 
|Cheers
|Rodney
|

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



Problem with redisplay of form values when issuing error messages

2003-07-30 Thread Rodney Paul
Hi All,
 
I am currently using the Struts MVC2 framework to develop a wizard application.
Upon reading the literature in regards to how Struts works, I noticed that my 
application
will does not re-display form values entered by the user if errors are issued.
 
Is it possible to re-display form values from an ActionForm if the validate method 
returns
ActionErrors. If so, how do you achieve this? Do you need to store anything in a 
session object?
 
Is it possible to re-display form values from an Action class if we return 
ActionErrors.
 
 
Cheers
Rodney


Struts Error Handling Problem

2003-07-29 Thread Rodney Paul
Hi All,

I am currently using the Struts framework to develop a wizard application.
When using the Struts framework I notice that form data does not get re-displayed after
issuing ActionErrors. Is there any reason for this?

I use the following code structure for developing the wizard:

OrganisationNameSearch.jsp
OrganisationNameSearchActionForm.java
OrganistaionNameSearchAction.java

and here are the important configuration settings I use to execute code:

---OrganisationNameSearch.jsp---



---Struts Configuration---













Can someone please give me an indication as to why this is happening?

Cheers
Rodney

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



RE: best way to build a wizard

2003-07-10 Thread Rodney Paul
Well with the LookupDispatchAction class you can name a parameter to be used 
to determine what method to execute. In this instance The "Next" and "Previous" 
buttons would point to a same parameter to be used.

eg.













Now the code in the LookupDispatchAction class would look something like this:

public class MyAction extends LookupDispatchAction {
protected java.util.Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.previous", "previous");
map.put("button.next", "next");
return map;
}

public ActionForward previous(ActionMapping mapping, ActionForm form,
  HttpServletRequest request, HttpServletResponse 
response)
  throws IOException, ServletException {
String target = "previous";
...
return (ActionForward)mapping.findForward(target);
}

public ActionForward next(ActionMapping mapping, ActionForm form,
  HttpServletRequest request, HttpServletResponse response)
  throws IOException, ServletException {
String target = "next";
...
return (ActionForward)mapping.findForward(target);
}


So both submit buttons would go to the next page, and within that action you would
transfer control to the previous or next pages.


Cheers
Rodney


-Original Message-
From: Michael Muller [mailto:[EMAIL PROTECTED]
Sent: Friday, 11 July 2003 9:41 AM
To: Struts Users Mailing List
Subject: Re: best way to build a wizard



I'm not sure that really solves my problem.  What do I put as the 
"input" for this action?  I can't use the same action; whatever 
attribute I used to indicate that I want to move to the next page would 
still be in the system, so validation failures would bring me to the 
next page rather than the same page.

I'm pondering an approach with two actions, a "next page" action which 
has a "same page" action as its input.

   -- Mike

Rodney Paul wrote:

> Check out the lookupDispatchAction classes.
> These classes were designed specifically for Actions which require more
> than one execute method (in this instance a method for back and next).
> That is what I have used, and is perfect for use when developing wizard applications.
> 
> Cheers
> Rodney
> 
> -Original Message-
> From: Michael Muller [mailto:[EMAIL PROTECTED]
> Sent: Friday, 11 July 2003 8:41 AM
> To: Struts Users Mailing List
> Subject: Re: best way to build a wizard
> 
> 
> 
> It turns out that I can't pass the action into the html:form tag using 
> tiles; that would involve nesting JSP tags.  Grr.
> 
> I guess my only recourse is to have the open html:form tag in the 
> inserted body and the close html:form tag in the template.  Ick.
> 
> So now I'm trying to figure out a way to have one one action mapping. 
> Any ideas?  Or alternative approaches?
> 
>-- Mike
> 
> Michael Muller wrote:
> 
>>My app has a bunch of wizard-style forms.  I have one "NextPageAction" 
>>Action class, and an separate mapping for each page.  The mappings all 
>>bind to the same form bean (a DynaValidatorForm) and invoke the 
>>"NextPageAction".
>>
>>I was hoping to have only one action mapping, with a whole bunch of 
>>forwards for "page1", "page2", etc.  The problem that prevents me from 
>>having one action mapping is validation:  I need the "input" attribute 
>>to redirect me to the correct wizard screen.
>>
>>So I went back to having lots of mappings.  No big deal.  Until...
>>
>>I factored the "next" and "back" buttons into the template.  With those 
>>buttons, wend the closing "html:form" tag.  Makes sense to move the 
>>opening "html:form" tag into the template, too, right?  Oops, my action 
>>is in there.
>>
>>What do I do?
>>
>>I could leave the closing tag in the template and the opening tag in the 
>>inserted body.  Gross.
>>
>>I could try and pass the action into the template through my tiles-defs. 
>> That's kinda kludgy, too.
>>
>>I'm back to thinking I should have one action mapping.  But I don't know 
>>how to accomplish this.
>>
>>Suggestions?
>>
>>Thanks,
>>
>>Mike
>>
>>
>>
>>-
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> ---

Re-Population of form parameters after nn error has occured

2003-07-10 Thread Rodney Paul
Hi All,

Im currently experiencing a problem with the Struts framework, in that form values
are not being re-populated after a validation error has occured within a ActionForm 
class.
I also get this problem when saving validation errors within a LookupDispatchAction 
class.

Could someone please give me some indication to why this is happening, and if there is 
a solution to this problem. Below is my configuration settings I am using with the 
Struts framework.


---OrganisationNameSearch.jsp---



---Struts Configuration---













NOTE: I have validation code within both the ActionForm and Action classes I am using.

Cheers
Rodney

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



RE: best way to build a wizard

2003-07-10 Thread Rodney Paul
Check out the lookupDispatchAction classes.
These classes were designed specifically for Actions which require more
than one execute method (in this instance a method for back and next).
That is what I have used, and is perfect for use when developing wizard applications.

Cheers
Rodney

-Original Message-
From: Michael Muller [mailto:[EMAIL PROTECTED]
Sent: Friday, 11 July 2003 8:41 AM
To: Struts Users Mailing List
Subject: Re: best way to build a wizard



It turns out that I can't pass the action into the html:form tag using 
tiles; that would involve nesting JSP tags.  Grr.

I guess my only recourse is to have the open html:form tag in the 
inserted body and the close html:form tag in the template.  Ick.

So now I'm trying to figure out a way to have one one action mapping. 
Any ideas?  Or alternative approaches?

   -- Mike

Michael Muller wrote:
> 
> My app has a bunch of wizard-style forms.  I have one "NextPageAction" 
> Action class, and an separate mapping for each page.  The mappings all 
> bind to the same form bean (a DynaValidatorForm) and invoke the 
> "NextPageAction".
> 
> I was hoping to have only one action mapping, with a whole bunch of 
> forwards for "page1", "page2", etc.  The problem that prevents me from 
> having one action mapping is validation:  I need the "input" attribute 
> to redirect me to the correct wizard screen.
> 
> So I went back to having lots of mappings.  No big deal.  Until...
> 
> I factored the "next" and "back" buttons into the template.  With those 
> buttons, wend the closing "html:form" tag.  Makes sense to move the 
> opening "html:form" tag into the template, too, right?  Oops, my action 
> is in there.
> 
> What do I do?
> 
> I could leave the closing tag in the template and the opening tag in the 
> inserted body.  Gross.
> 
> I could try and pass the action into the template through my tiles-defs. 
>  That's kinda kludgy, too.
> 
> I'm back to thinking I should have one action mapping.  But I don't know 
> how to accomplish this.
> 
> Suggestions?
> 
> Thanks,
> 
> Mike
> 
> 
> 
> -
> 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: How to pass a value object to another action

2003-07-07 Thread Rodney Paul
The value from action class A retrieves the value from its own action form class.
This value can then be supplied to the next class via a session object.

-Original Message-
From: Geoffrey Ellis [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 8 July 2003 11:34 AM
To: Struts Users Mailing List
Subject: How to pass a value object to another action


actionForm A contains a collection of value objects which are presented to
the user.  The user will select a particular value object which the next
actionForm B will need for presentation.
How should this be done?  I would think action A would grab the value object
from its actionForm and some how pass it to the next action or set that
value in actionForm B and then forward the request to Action B.  I don't see
how to do either of these or is this done another way?


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


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



RE: How to pass a value object to another action

2003-07-07 Thread Rodney Paul
ActionForms sole purpose i believe is to capture information the user has entered
within a web page. Hence we have in Struts the MVC 2 model, whereby the presntation 
layer is represented by JSP/velocity pages, ActionForm classes used to capture 
information the user has entered within the preentation pages, and Action classes to 
process business logic.

Now in regards to preparing information for you to render within multiple presentation 
pages, information should be stored in session objects. Hence in your case, if you 
need to present information to the Action B class from Action A, store this in a 
session object. Also have a storage place in the ActionForm class so that Action B can 
retrieve the information in an appropriate manner.

Cheers
Rodney

-Original Message-
From: Geoffrey Ellis [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 8 July 2003 11:34 AM
To: Struts Users Mailing List
Subject: How to pass a value object to another action


actionForm A contains a collection of value objects which are presented to
the user.  The user will select a particular value object which the next
actionForm B will need for presentation.
How should this be done?  I would think action A would grab the value object
from its actionForm and some how pass it to the next action or set that
value in actionForm B and then forward the request to Action B.  I don't see
how to do either of these or is this done another way?


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


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



Struts Error Handling Problem

2003-07-07 Thread Rodney Paul
I am currently experiencing a problem with the Struts error handling framework. 
I am trying to use the error handling framework from ActionForm and 
LookupDispatchAction classes. 

The problem I have is in regards to display of error messages. I have found 
that error messages are being displayed correctly using the  tag 
from a ActionForm validate method, but are not being displayed using the 
LookupDispatchAction methods. Please see below: 

ActionForm 
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest 
httpServletRequest) { 
ActionErrors errors = new ActionErrors(); 
errors.add("field", new ActionError("messageKey")); 
return errors; 
} 

LookupDispatchAction 
public ActionForward next(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) { 
... 
ActionErrors errors = new ActionErrors(); 
errors.add("field", new ActionError("messageKey")); 
if(!errors.isEmpty()) { 
saveErrors(request, errors); 
} 
return (ActionForward)mapping.findForward(target); 
} 


Could someone please tell me why this is so. I would be most interested if 
anyone could provide a solution for this. 

NOTE: 
I am using the Struts version 1.1 release with tomcat version 4.1.24 


Yours Sincerely 
Rodney Paul 

ps. You can contact me via email at [EMAIL PROTECTED]

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



RE: Using JAAS ( Slightly off topic)

2003-07-07 Thread Rodney Paul
Hi there,
could you please help me i am trying to send a post out to the mailign list.
How do you do this.

Cheers
Rodney


-Original Message-
From: souravm [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 8 July 2003 10:37 AM
To: Struts Users Mailing List
Subject: Using JAAS ( Slightly off topic)



Hi All,

I'm building a web application using MVC (and hence using Struts).

Now for security (Authentication and Authorization) of the application
I'm planning to use JAAS.

In the process of understanding JAAS I found that the default
implementation of the authorization component expects the authorization
policy has to be specified in a file.

Now in this context my query is how safe is to use this file based
authorization policy mapping. From my view point anyone can change this
policy file to compromise with the security. Instead isn't it a better
approach to put the authorization policy related rules in a database ?

Please give you view points.

Regards,
Sourav

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