SV: What is the best way to pass a parameter to a forward? Create a utility class

2004-03-16 Thread Tommy Holm - TELMORE
Some time ago this question has been asked before and someone showed
some utility class code. I used the code and created a class like this:
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;

import org.apache.struts.action.ActionForward;

/**
 * Simple utility class to add parameters to an ActionForward 
 * from within an action. This action is useful when you from 
 * within an action need to pass parameters to the jsp page or another
action 
 * you are forwarding to.
 */
public class ActionForwardParameters {

/**
*  Encupsulates parameters for ActionForward.
*/

private Map params = new HashMap();

/**
 * add all the parameters and values from the hashtable to the
actionforward
 * @param parametersValues a hastable with key value pairs
 * @return ActionForwardParameters object
 */
public ActionForwardParameters add(Hashtable parametersValues) {
for(Iterator i =
parametersValues.keySet().iterator();i.hasNext();){
String key = (String) i.next();
params.put(key,(String) parametersValues.get(key));
}

return this;
}

/**
* Add parameters to provided ActionForward
* @param forward ActionForward to add parameters to
* @return ActionForward with added parameters to URL
*/
public ActionForward forward(ActionForward forward) {
StringBuffer path = new StringBuffer(forward.getPath());
Iterator iter = params.entrySet().iterator();
if (iter.hasNext()) {
//add first parameter, if avaliable
Map.Entry entry = (Map.Entry) iter.next();
path.append(? + entry.getKey() + = + entry.getValue());
//add other parameters 
while (iter.hasNext()) {
entry = (Map.Entry) iter.next();
path.append( + entry.getKey() + = +
entry.getValue());
}
}

return new ActionForward(path.toString());
}

}


Please note that I didn't come up with the idea of this class, I simply
created the class after reading the information that a fellow programmer

Provided.!


-Oprindelig meddelelse-
Fra: Jay Glanville [mailto:[EMAIL PROTECTED] 
Sendt: 16. marts 2004 13:13
Til: 'Struts Users Mailing List'
Emne: RE: What is the best way to pass a parameter to a forward?


It's funny that you say that it will not work, because it does for me,
and without throwing any exceptions.

That being said, your point about modifying an action mappings forwards
is a good one.  It is unfortunate that the ActionForward class doesn't
have a copy constructor 

--
Jay Glanville


 -Original Message-
 From: news [mailto:[EMAIL PROTECTED] On Behalf Of Martin Cooper
 Sent: Monday, March 15, 2004 8:30 PM
 To: [EMAIL PROTECTED]
 Subject: Re: What is the best way to pass a parameter to a forward?
 
 
 What you are doing will not work - at least, not the way you
 are doing it.
 You are trying to modify the ActionForward instance that is 
 owned by Struts,
 and calling setPath() on that instance will result in an
 IllegalStateException.
 
 You need to create your own ActionForward instance, instead
 of trying to
 modify Struts' one. You can do that with something like this:
 
 ActionForward goto = mapping.findForward( success );
 String path = ...; // Put together your new path
 ActionForward myGoto = new ActionForward(path,
 goto.getRedirect());
 return myGoto;
 
 --
 Martin Cooper
 
 
 Glanville, Jay [EMAIL PROTECTED] wrote
 in message
 news:[EMAIL PROTECTED]
 I'm trying to solve a problem, but I'm not sure my solution 
 is the best
 way.  Basically, I want to set a parameter on a forward within the
 action's execute.
 
 I'm in my action's execute method.  I've just successfully performed 
 some work, and I now want to forward/redirect to the next page.  So, 
 I've got some code that looks like this:
 
public ActionForward execute(ActionMapping.) {
   // do some work
   ActionForward goto = mapping.findForward( success );
   return goto;
}
 
 With an action mapping that looks like this:
 
action
   path=/EntrySave
   type=com.package.EntrySaveAction
   name=EntryForm
   validate=true
   input=/Entry.do
   forward name=success redirect=true path=/Container.do/
   forward name=failure redirect=false path=/Entry.do /
/action
 
 Basically, if I left the EntrySaveAction.execute do what's doing right

 now, then upon successful completion, it would redirect to 
 /Container.do.  However, what I want it to do is redirect to 
 /Container.do?id=45, where 45 is the id of the container that I want

 to go to.  The value of 45 is dynamic, and is know at the time of 
 the EntrySaveAction.execute command.
 
 The way I'm currently doing it is something like this:
 
public ActionForward execute(ActionMapping.) {
   // do some work
   ActionForward goto = 

SV: What is the best way to pass a parameter to a forward? Create a utility class .Client code

2004-03-16 Thread Tommy Holm - TELMORE
Forgot to show the code how to use it!
In your action you should not return 
return mapping.findForward(bla) 
but 
Hashtable a = new Hashtable();//add what ever key/value pairs you need
return new
ActionForwardParameters().add(a).forward(mapping.findForward(success))
;

-Oprindelig meddelelse-
Fra: Tommy Holm - TELMORE 
Sendt: 16. marts 2004 13:48
Til: Struts Users Mailing List
Emne: SV: What is the best way to pass a parameter to a forward? Create
a utility class


Some time ago this question has been asked before and someone showed
some utility class code. I used the code and created a class like this:
import java.util.HashMap; import java.util.Hashtable; import
java.util.Iterator; import java.util.Map;

import org.apache.struts.action.ActionForward;

/**
 * Simple utility class to add parameters to an ActionForward 
 * from within an action. This action is useful when you from 
 * within an action need to pass parameters to the jsp page or another
action 
 * you are forwarding to.
 */
public class ActionForwardParameters {

/**
*  Encupsulates parameters for ActionForward.
*/

private Map params = new HashMap();

/**
 * add all the parameters and values from the hashtable to the
actionforward
 * @param parametersValues a hastable with key value pairs
 * @return ActionForwardParameters object
 */
public ActionForwardParameters add(Hashtable parametersValues) {
for(Iterator i =
parametersValues.keySet().iterator();i.hasNext();){
String key = (String) i.next();
params.put(key,(String) parametersValues.get(key));
}

return this;
}

/**
* Add parameters to provided ActionForward
* @param forward ActionForward to add parameters to
* @return ActionForward with added parameters to URL
*/
public ActionForward forward(ActionForward forward) {
StringBuffer path = new StringBuffer(forward.getPath());
Iterator iter = params.entrySet().iterator();
if (iter.hasNext()) {
//add first parameter, if avaliable
Map.Entry entry = (Map.Entry) iter.next();
path.append(? + entry.getKey() + = + entry.getValue());
//add other parameters 
while (iter.hasNext()) {
entry = (Map.Entry) iter.next();
path.append( + entry.getKey() + = +
entry.getValue());
}
}

return new ActionForward(path.toString());
}

}


Please note that I didn't come up with the idea of this class, I simply
created the class after reading the information that a fellow programmer

Provided.!


-Oprindelig meddelelse-
Fra: Jay Glanville [mailto:[EMAIL PROTECTED] 
Sendt: 16. marts 2004 13:13
Til: 'Struts Users Mailing List'
Emne: RE: What is the best way to pass a parameter to a forward?


It's funny that you say that it will not work, because it does for me,
and without throwing any exceptions.

That being said, your point about modifying an action mappings forwards
is a good one.  It is unfortunate that the ActionForward class doesn't
have a copy constructor 

--
Jay Glanville


 -Original Message-
 From: news [mailto:[EMAIL PROTECTED] On Behalf Of Martin Cooper
 Sent: Monday, March 15, 2004 8:30 PM
 To: [EMAIL PROTECTED]
 Subject: Re: What is the best way to pass a parameter to a forward?
 
 
 What you are doing will not work - at least, not the way you are doing

 it. You are trying to modify the ActionForward instance that is
 owned by Struts,
 and calling setPath() on that instance will result in an
 IllegalStateException.
 
 You need to create your own ActionForward instance, instead of trying 
 to modify Struts' one. You can do that with something like this:
 
 ActionForward goto = mapping.findForward( success );
 String path = ...; // Put together your new path
 ActionForward myGoto = new ActionForward(path, 
 goto.getRedirect());
 return myGoto;
 
 --
 Martin Cooper
 
 
 Glanville, Jay [EMAIL PROTECTED] wrote in 
 message 
 news:[EMAIL PROTECTED]
 I'm trying to solve a problem, but I'm not sure my solution
 is the best
 way.  Basically, I want to set a parameter on a forward within the
 action's execute.
 
 I'm in my action's execute method.  I've just successfully performed
 some work, and I now want to forward/redirect to the next page.  So, 
 I've got some code that looks like this:
 
public ActionForward execute(ActionMapping.) {
   // do some work
   ActionForward goto = mapping.findForward( success );
   return goto;
}
 
 With an action mapping that looks like this:
 
action
   path=/EntrySave
   type=com.package.EntrySaveAction
   name=EntryForm
   validate=true
   input=/Entry.do
   forward name=success redirect=true path=/Container.do/
   forward name=failure redirect=false path=/Entry.do /
/action
 
 Basically, if I left the EntrySaveAction.execute do what's doing right

SV: Iterating List

2004-03-10 Thread Tommy Holm - TELMORE
The latter method would be the correct !
You could for clarity write the type of the id=myString which is the
object you access in every iteration and it would be required for other
custom objects
logic:iterate id=myString name=myform
property=ListofStringobjects  type=java.lang.String
   bean:write name=myString/
/logic:iterate

/Tommy
-Oprindelig meddelelse-
Fra: Daniel Henrique Alves Lima [mailto:[EMAIL PROTECTED] 
Sendt: 10. marts 2004 06:21
Til: Struts Users Mailing List
Emne: Re: Iterating List


How about this ?

logic:iterate id=myString name=myform
property=ListofStringobjects 
   bean:write name=myString/
/logic:iterate


Ramadoss Chinnakuzhandai wrote:

finally I got the following working..

logic:iterate id=list name=myform property=ListofStringobjects 

bean:define id=xyz name=list type=java.lang.String/ 
/logic:iterate

-Ramadoss
  




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



SV: Struts Workflow - Questions ?

2004-03-03 Thread Tommy Holm - TELMORE
Hi 
I am not sure if I understand your question right, but the way I
understand it is.
You have some action that either can forward to itself (looping) 3 times
( 4 time it should be a workflow violation) or in case everything is ok
forward to another action ?
Well you have a couple of options. You could have a action mapping like
this
 action path=/somePossibleLoopingAction
type=dk.somePackage.someAction name=someForm scope=session
set-property property=primaryWorkflow value=MyWorkflow
/
set-property property=prevState value=loginfailure /
set-property property=prevState value=someOtherState /
set-property property=newState value=loginfailure /
set-property property=nextState value=loginfailure /
set-property property=nextState value=loginsuccess /
forward name=success path=/nextAction /
forward name=failureLogin
path=/somePossibleLoopingAction /
forward name=violateAction path=/someActionThatViolates /
/action

In your somePossibleLoopingAction you could have a session variable that
holds the count of unsuccessful logins, after the third it could foward
to /someActionThatViolates, this action should of course have some
states that would be violated and then the workflow engine would trigger
a workflow violation where your session forms would be cleaned and you
could eventually make sure that the user is banned or whatever you want.
This should happen in your workflow violation action class. Just make
sure you have a global forward like this !

forward name=workflowViolation_MyWorkflow
path=/handleWorkflowLoginViolation.do /

And then of course the action mapping represented by the
/handleWorkflowLoginViolation.do.
action path=/handleWorkflowLoginViolation
type=dk.somePackage.SomeAction
set-property property=primaryWorkflow value=MyWorkflow
/
set-property property=endWorkflow value=true /-
makes sure that this workflow is ended 
forward name=noNextStateViolation
path=/somePathOfYourChoice /
/action

In case you are in the looping phase, take a look at the workflow
mapping. As you can see we have a prevState and a newState and even a
nextState that are the same. 
This means this action accepts that the previous action is itself, and
that the next action can be itself, that's the way I implemented it.

Hope this helps, if you have more questions feel free to ask!

Cheers
Tommy





-Oprindelig meddelelse-
Fra: Joanne L Corless [mailto:[EMAIL PROTECTED] 
Sendt: 2. marts 2004 18:16
Til: [EMAIL PROTECTED]
Emne: Struts Workflow - Questions ?


Hi,

I'm trying to resolve a problem I have by making use of Struts Workflow
- Using this as I need something that will prevent jump-out within the
process

The login process of my app has a number of conditions which dictate
which page I send the user to next.

I understand the basic's of the Struts Workflow but am a little confused
when we get to the looping/forwarding aspects

Basically the section of the flow is as follows:

SecurityFilterAuthentication - Is User Authenticated ?
 If  Y  - StartWorkflow - Retrieve User Settings - Is
3fromN login required ?
   If Y - Do 3FromN Else -Record Successful Login -
...Continue Workflow

The 3FromN section has to allow the user 3 attempts and then do a Lock
Out Action or if successful continue to the Record Successful Login
Action

How do I make those decisions within the workflow ? Do I have to have an
action for every decision node or can I set what the next action should
be in the active one using  return (new ActionForward(nextAction));

Regards

Joanne Corless



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



SV: How to create an include which calls an action: jsp:include page=some action Really need help : The Answer!

2004-02-26 Thread Tommy Holm - TELMORE
What I did is the following. I have a master jsp and in this jsp I
inserted the following page.
tile:insert controllerUrl=/viewNavigation.do
page=/jsp/myJspPage.jsp/
Now there are two important things to consider. First in your action
mapping definition in this case viewNavigation.do you must add the
redirect=true to the foward attribute. If you do this, your navigation
action does not need to return null, if you don't add this attribute,
then your action must return null. The problem with the latter, is that
you can't call this action (viewNavigation.do) in any other way than
using the tile tag, because it will jus be a blank page.
Here is my action mapping!

action path=/viewNavigation scope=session name=someForm
type=something.web.controller..ViewMultiNavigationAction
  forward name=success path=/jsp/myJspPage.jsp
redirect=true /
/action 

On my jsp page it looks like this

Jsp start ***
Bla bla 
Bla bla 
tile:insert controllerUrl=/viewNavigation.do
page=/jsp/myJspPage.jsp/
Bla bla 
Bla bla 
Jsp end 

My action does not return null because of the redirect=true forward
name=success path=/jsp/myJspPage.jsp redirect=true /

Hope this helps
Cheers 
Tommy

-Oprindelig meddelelse-
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sendt: 25. februar 2004 21:31
Til: Tommy Holm - TELMORE
Emne: SV: How to create an include which calls an action


I'm getting the following error. Can you send me an usage example. I
wonder if controller action returns jsp to include why should we give
page attribute again?

tiles:insert page=/cap/capGeneralInfoAction.ecims flush=true
/tiles:insert

Thanks,
Giri.
Old message from Tommy 
**
No currently none of the proposed solutions worked. I am currently
looking into the Tiles:insert tag Attributes are page = the jsp page to
insert And most importantly there is an controller attribute which
should be an action that perhaps prepares the jsp page. Just testing it
now  - HOLD ON - it works ... Check the tiles:insert tag

Alternatively I figured another way to do it, it's very ugly though, you
can jsp:include an action that just returns null.It does however set up
the bean. Then right after this include on your master jsp, you call
another jsp include that just includes a regular jsp, on this jsp you
can reference The bean that the first include prepared and work as
usual. I admitt the latter solution is very ugly, the tiles way seems to
be the  way to go! Cheers
/Tommy

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



jsp:include page=some action Really need help

2004-02-25 Thread Tommy Holm - TELMORE
Hi everyone.
I have already asked this once but didn't get any answer, I have tried
everything that I could think of but no luck, so if any of you have an
idea what to do, I would really be happy for any help.

I have a problem, I have a jsp page which should include the result of
an action call. The action should prepare the bean associated with the
action and render which then in the end should be included in the master
jsp.(The include is a menu, which the action should prepare). The
problem is that after the include, the rest of the JSP page is not
rendered. It does somehow make sense but is there anyway around this or
a common strategy to achieve this. Any help is greatly appreciated.
Cheers Kind regards Tommy 

Cheers
/Tommy

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



SV: jsp:include page=some action Really need help

2004-02-25 Thread Tommy Holm - TELMORE
Thx for your reply but if you don't foward to a jsp page, the jsp page
never gets rendered and  nothing is inserted in the main jsp page!
Cheers



-Oprindelig meddelelse-
Fra: Niall Pemberton [mailto:[EMAIL PROTECTED] 
Sendt: 25. februar 2004 14:18
Til: Struts Users Mailing List
Emne: Re: jsp:include page=some action Really need help


Haven't done what you're trying - but isn't the problem that at the end
of the action execute() the RequestProcessor will forward to whereever
you tell it, which is probably why everything stops after that.

What happens if you return 'null' from your execute() method instead of
an ActionForward - or are you already doing that?

Niall

- Original Message - 
From: Tommy Holm - TELMORE [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 25, 2004 1:07 PM
Subject: jsp:include page=some action Really need help


Hi everyone.
I have already asked this once but didn't get any answer, I have tried
everything that I could think of but no luck, so if any of you have an
idea what to do, I would really be happy for any help.

I have a problem, I have a jsp page which should include the result of
an action call. The action should prepare the bean associated with the
action and render which then in the end should be included in the master
jsp.(The include is a menu, which the action should prepare). The
problem is that after the include, the rest of the JSP page is not
rendered. It does somehow make sense but is there anyway around this or
a common strategy to achieve this. Any help is greatly appreciated.
Cheers Kind regards Tommy

Cheers
/Tommy

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



SV: How to create an include which calls an action

2004-02-25 Thread Tommy Holm - TELMORE
No currently none of the proposed solutions worked. I am currently
looking into the 
Tiles:insert tag 
Attributes are page = the jsp page to insert
And most importantly there is an controller attribute which should be an
action that perhaps prepares the jsp page.
Just testing it now  - HOLD ON - it works ...
Check the tiles:insert tag

Alternatively I figured another way to do it, it's very ugly though, you
can jsp:include an action that just returns null.It does however set up
the bean.
Then right after this include on your master jsp, you call another jsp
include that just includes a regular jsp, on this jsp you can reference 
The bean that the first include prepared and work as usual. 
I admitt the latter solution is very ugly, the tiles way seems to be the
way to go!
Cheers




-Oprindelig meddelelse-
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sendt: 25. februar 2004 15:39
Til: Struts Users Mailing List
Emne: Re: How to create an include which calls an action







Did anyone figure out how to do this?

Giri SENji.

-Tommy Holm - TELMORE [EMAIL PROTECTED] wrote: -

To: [EMAIL PROTECTED]
From: Tommy Holm - TELMORE [EMAIL PROTECTED]
Date: 02/23/2004 10:38AM
Subject: How to create an include which calls an action

Hi everyone.
I have a problem, I have a jsp page which should include the result of
an action call. The action should prepare the bean associated with the
action and create the jsp which then in the end should be included in
the master jsp.(The include is a menu, which the action should prepare).
The problem is that after the include, the rest of the JSP page is not
rendered. It does somehow make sense but is there anyway around this or
a common strategy to achieve this. Any help is greatly appreciated.
Cheers Kind regards Tommy


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



How to create an include which calls an action

2004-02-23 Thread Tommy Holm - TELMORE
Hi everyone.
I have a problem, I have a jsp page which should include the result of
an action call. The action should prepare the bean associated with the
action and create the jsp which then in the end should be included in
the master jsp.(The include is a menu, which the action should prepare).
The problem is that after the include, the rest of the JSP page is not
rendered. It does somehow make sense but is there anyway around this or
a common strategy to achieve this.
Any help is greatly appreciated.
Cheers
Kind regards
Tommy 


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



SV: Struts Actions Forms Actions - ?????????

2004-01-26 Thread Tommy Holm - TELMORE
Are you using a html:form ... Tag for submitting the user request ? and
are you sure that you are mapping the action to the correct action in
the html:form action=?
Did you implement the token check and forgot about it, so that you
actually are getting double form submit exceptions ?

I have once had the problem that we implement a token test on form
submits to catch client double submits, well that's great when you
update data but when you just view data it's not needed!
Cheers
Tommy

-Oprindelig meddelelse-
Fra: Vinicius Carvalho [mailto:[EMAIL PROTECTED] 
Sendt: 26. januar 2004 17:07
Til: [EMAIL PROTECTED]
Emne: Struts Actions Forms Actions - ?


Well, sometimes I wonder if struts is really the best framework
to use in 
our application scope, it brought so many problems then solutions...
But now I think its too late.
Here's my problem (another one in the huge, never-ending list)

I need to call the same Action from a link and a Form, this is simple
cuz 
the page rendered is the same, the diff. is that the first time it's
called 
from a link it renders the form, and a list of default attributes, when
the 
user submits the form (actually just change a select object) the list is

changed (the select acts like a filter). Well, problem is its not
working.

when the user clicks on the link, it fowards to the default error page, 
trying to debug, I've noticed that the controller never gets to the
desired 
action (probably cuz the form class, can not get the getter and setter
for 
its properties, cuz in the first call, the form does not exists yet). So

what can I do to solve this? If at least the controller where getting to

the desired action, but it redirects the user before that.

Thanks

Vinicius


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



SV: SV: Struts Actions Forms Actions - ?????????

2004-01-26 Thread Tommy Holm - TELMORE
Ok lets look at it. 
You have a flow like this 
 1.) Selectmodel.jsp - 2.) listModels.do - 3.) listmodels.jsp -
4.)listModels.do - 5.)listmodels.jsp  ***
Correct ?
From which point doesn't it work anymore, after number 3 ?
Are you using an action for forwarding to Selectmodel.jsp ?
If you could show me your struts-config.xml, I probably would be able to
help you much faster, because 
Your flow is extremely simple and should work straight out of the box.

Anyway you must be able to find some log information somewhere.
Cheers

-Oprindelig meddelelse-
Fra: Vinicius Carvalho [mailto:[EMAIL PROTECTED] 
Sendt: 26. januar 2004 17:21
Til: Struts Users Mailing List
Emne: Re: SV: Struts Actions Forms Actions - ?


Sorry, I don't think you understood my question.
The problem is not within th html:form
but html:link which action is the same that the html:form on the
other 
page will use.
Got it?



| Selectmodel.jsp | -- calls an action (listModels.do) via link --
forwards to |listmodels.jsp| -- calls an action (listModels.do) via
submit 
-- forwards to listmodels.jsp


Got it?






At 14:21 26/1/2004, you wrote:
Are you using a html:form ... Tag for submitting the user request ? 
and are you sure that you are mapping the action to the correct action 
in the html:form action=? Did you implement the token check and

forgot about it, so that you actually are getting double form submit 
exceptions ?

I have once had the problem that we implement a token test on form 
submits to catch client double submits, well that's great when you 
update data but when you just view data it's not needed! Cheers
Tommy

-Oprindelig meddelelse-
Fra: Vinicius Carvalho [mailto:[EMAIL PROTECTED]
Sendt: 26. januar 2004 17:07
Til: [EMAIL PROTECTED]
Emne: Struts Actions Forms Actions - ?


 Well, sometimes I wonder if struts is really the best 
framework to use in our application scope, it brought so many problems 
then solutions...
 But now I think its too late.
 Here's my problem (another one in the huge, never-ending list)

I need to call the same Action from a link and a Form, this is simple 
cuz the page rendered is the same, the diff. is that the first time 
it's called
from a link it renders the form, and a list of default attributes, when
the
user submits the form (actually just change a select object) the list
is

changed (the select acts like a filter). Well, problem is its not 
working.

when the user clicks on the link, it fowards to the default error page,

trying to debug, I've noticed that the controller never gets to the 
desired action (probably cuz the form class, can not get the getter and

setter for
its properties, cuz in the first call, the form does not exists yet).
So

what can I do to solve this? If at least the controller where getting 
to

the desired action, but it redirects the user before that.

Thanks

Vinicius


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


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


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


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



Logic:iterateTag

2003-12-05 Thread Tommy Holm - TELMORE
Hi.
I have created a html td tr tag which can used neted inside the
struts iterate tag. The idea is that the tag will generate the
surrounding TR and TD tags, so that the data exposed from the iterate
tag can be properly displayed in several columns for each row. Now the
problem is that my tag requires to know the size of the collection which
the iterate tag is iterating over. What I have done in the doStartTag is
this: 
IterateTag parent = (IterateTag)findAncestorWithClass(this,
IterateTag.class);
if (parent == null) {
throw new JspTagException(This tag must run inside  +
org.apache.struts.taglib.logic.IterateTag);


}
else{
Collection temp = (Collection)parent.getCollection();
if(temp != null){
logger.debug(YEAH parent collection was not null and size is 
+
temp.size());
logger.debug(Lets check the ofset );
String offset = parent.getOffset();
if(offset != null){
logger.debug(Ofset is not null  +
value is  + offset);
logger.debug(So the actual size should be  + 
(temp.size()- Integer.parseInt(offset)));

}
}
else
logger.debug(Collection from parent tag was null);

No matter what the collection from the struts iterate tag is alway null,
which means it's a non initialized collection. What am I doing wrong ?
How do I gain acces to the size of the collection that the iterate tag
is iteration over ?
Any help is greatly appreciated.
Thanks
Cheers
Tommy Holm, System Developer
TELMORE A/S


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



State change before form validation

2003-11-25 Thread Tommy Holm - TELMORE
I am currently using the struts workflow extension and I have stumbled
upon some strange behaviour. When you on a jsp page with form and submit
that form, the workflow state changes before 
the validation result is taken into consideration. Please correct me if
I am wrong. This puzzles me because the idea of struts form beans are
that if validation fails, you are being returned to the same page you
originated from. That gives a problem because you then need to have a
previous state for your action that is the same as the newState,
otherwise you get a violation. Maybe I remember wrong but I seem to
remember seing an answer (from Matthias who is one of the developers of
the workflow extension) on the struts mailinglist that it's not a good
idea to have a previous state that is the same as the newState, didn't
understand why, so could anybody perhaps give a few comments on the
state being set before form validation 
Cheers and regards

Tommy Holm, System Udvikler
TELMORE A/S
Carl Gustavsgade 3, 2630 Taastrup
Telefon 70218700, Mobil 22582344
www.telmore.dk 


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



logic:iterate JspException

2001-09-06 Thread TOMMY



Dear All 
I've got a question and seeking for answers. does 
anyone know what's wrong in the following code.



tommySelectForm- 
 public Collection getUse_list(){ 
  ArrayList aa=new 
ArrayList(); 
aa.add("AAA"); 
aa.add("BBB"); 
aa.add("CCC");  
return aa;  }



tommy_Select.jsp- 


logic:iterate id="ddd" name="tommySelectForm" 
property="use_list"TH 
A HREF="http://www.kimo.com.tw" bean:write name="ddd" 
//A/br 
/TH/logic:iterate


struts-config.xml- 
 action 
path="/tommy_select" 
type="tw.com.bct.online.tommy.TommySelectAction" 
name="tommySelectForm" 
scope="request" 
 
forward 
name="success" 
path="/tommy_Select.jsp"/ /action



Exception----- 
Root cause of ServletException javax.servlet.jsp.JspException: Cannot 
find bean ddd in scope null


Thanks
Tommy