Using anchors in action forwards.

2003-07-22 Thread Vilya Harvey
Hi there,

is it possible to use have an action forward URL that contains an anchor? 
Something along the lines of

	

is what I'm looking for. I've noticed that this works when you specify 
redirect="true", presumably because it's left to the client browser to 
interpret the URL. When you don't redirect, this fails with an error message 
indicating that an unknown resource was requested.

The problem with redirecting to the page is that it then appears to lose the 
module information: actions have to be changed to /module/action.do, rather 
than just /action.do, which is inconsistent with the rest of the pages in 
the module.

Am I missing something obvious here? Any help would be greatly appreciated.

Vil.
--
Vilya Harvey
[EMAIL PROTECTED] / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/
--Disclaimer--

This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this email and you are not a named
addressee, please inform the sender at Digital Steps Ltd by phone on
+44 (0)1483 469 480 or by reply email and then delete the email from
your system. If you are not a named addressee you must not use,
disclose, distribute, copy, print or rely on this email. Although
Digital Steps Ltd routinely screens for viruses, addressees should
check this email and any attachments for viruses. Digital Steps Ltd
makes no representation or warranty as to the absence of viruses in this
email or any attachments.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


question about reset() and multiple action forwards...

2003-07-17 Thread Dan Eklund
I have a scenario where an action-form goes through 2 actions before 
getting to the view...

the problem that reset() solves (for multiboxes) is that because the 
browser does not send any values 
to indicate that the user checked OFF all the multiboxes, you should 
reset( ) to a
blank slate for your String[ ] instance representing AND THEN the struts 
servlet will re-add
any checboxes submissions using the mutator method

this seems to work on the first of the action (where i've set debug 
statements to see that the
struts servlet has indeed re-added the values from the request) 
however, when the request
gets forwarded to the second action it servlet doesn't want to re-add the 
values into the action form...
(after my reset() method gets called again leaving only a blank slate)

i suspect that once the first action is re-constitued with the checkbox 
values it removes the attributes
from the response... (just a guess)...

is there an elegant way (?declarative?) for getting around this??

I guess I could do something like this :

public void reset(ActionMapping mapping,
  HttpServletRequest request){

if(mapping.getForward().equals("first action identifier only")
{
// only reset for the first action
this.chosenMultiBoxValues = new String[0];
}
}

...  has this been an issue with anyone??

Re: Action Forwards

2003-06-05 Thread Bradley M. Handy
In your ActionForward configuration for the "index.jsp" page.  Set the 
"redirect" attribute to "true".

Brad Handy

At 04:14 PM 6/4/2003, you wrote:
Hello, im using struts and tiles to build a postgresql table CRUD.

i have an index.jsp which includes a login.jsp if the user is not in
session or a menu.jsp and a eventlist.jsp if the user is in!
after a user does a login successfully, i call a map.findfordward to
'listevents' which is an Struts action in charge of building a list of
events and save it in the session, then calls map.findfordward to
'sucess' that is mapped to 'index.jsp' again but this time because of
the 'user' session object only menu.jsp and a eventlist.jsp are included
in 'index.jsp' showing the list built in 'listevents'.
the problem is that when that happens, the url still remains
'http://localhost/logon.do' and not 'index.jsp' ... not allowing to pass
GET parameters for posterior actions... what can i.do :) ?
thanks,good work and have fun!

--
José Moreira <[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]


Action Forwards

2003-06-05 Thread José Moreira
Hello, im using struts and tiles to build a postgresql table CRUD.

i have an index.jsp which includes a login.jsp if the user is not in
session or a menu.jsp and a eventlist.jsp if the user is in!

after a user does a login successfully, i call a map.findfordward to
'listevents' which is an Struts action in charge of building a list of
events and save it in the session, then calls map.findfordward to
'sucess' that is mapped to 'index.jsp' again but this time because of
the 'user' session object only menu.jsp and a eventlist.jsp are included
in 'index.jsp' showing the list built in 'listevents'.

the problem is that when that happens, the url still remains
'http://localhost/logon.do' and not 'index.jsp' ... not allowing to pass
GET parameters for posterior actions... what can i.do :) ?

thanks,good work and have fun!

-- 
José Moreira <[EMAIL PROTECTED]>


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



RE: RequestProcessor.processPopulate happens more than once when one Struts action forwards to another

2003-06-02 Thread Andrew Hill
Thats actually the expected behaviour and its because you are doing what is
known as 'action chaining'.
Its generally discouraged for reasons such as that you mention.

This topic has been discussed recently actually, so if you do a search of
the archive on "action chaining" you should be able to follow the
discussions we had about it. Someone had actually implemented a class
designed to facilitate action chaining , but I cant remember where to find
it. Anyhow should be in the archive.


-Original Message-
From: Ahearn, Denis [mailto:[EMAIL PROTECTED]
Sent: Monday, 2 June 2003 21:43
To: '[EMAIL PROTECTED]'
Subject: RequestProcessor.processPopulate happens more than once when
one Struts action forwards to another


Hi,

When one Struts action forwards to another Struts action, and the first
action was invoked by a form post, is it correct behavior that the
RequestProcessor.processPopulate method is called when the second action is
processed?  It seems to me that the form should only be populated from the
request parameters during the initial action, and not by each subsequent
action.

The current behavior causes me problems because I manually set some values
into the form in the first Struts action, and then forward to the second
action to save the form to a database.  The problem is, when the second
action is processed, the initial form values are set back into the form,
overwriting the changes made in the first action.

I was able to work around this problem by extending
RequestProcessor.processPopulate and checking for a custom property on the
action mapping which determines if the form should be populated or not.
This works, however it seems to me that the real problem is that Struts
populates the form for each Struts action that is being forwarded to.

Thanks,
Denis


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



RequestProcessor.processPopulate happens more than once when one Struts action forwards to another

2003-06-02 Thread Ahearn, Denis
Hi,

When one Struts action forwards to another Struts action, and the first
action was invoked by a form post, is it correct behavior that the
RequestProcessor.processPopulate method is called when the second action is
processed?  It seems to me that the form should only be populated from the
request parameters during the initial action, and not by each subsequent
action.

The current behavior causes me problems because I manually set some values
into the form in the first Struts action, and then forward to the second
action to save the form to a database.  The problem is, when the second
action is processed, the initial form values are set back into the form,
overwriting the changes made in the first action.

I was able to work around this problem by extending
RequestProcessor.processPopulate and checking for a custom property on the
action mapping which determines if the form should be populated or not.
This works, however it seems to me that the real problem is that Struts
populates the form for each Struts action that is being forwarded to.

Thanks,
Denis


RE: nasty prob with action forwards, formbeans, http requests and submit() methods

2002-03-03 Thread mike m

See if setting scope="session" for face.Smile action helps.
Mike

-Original Message-
From: Paul Devalier [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 01, 2002 10:32 AM
To: [EMAIL PROTECTED]
Subject: nasty prob with action forwards, formbeans, http requests and
submit() methods


I've got a nice little STRUTS app working by sticking to the path set by the
community examples and keeping my views gray and skeleton-like. I'm digging
STRUTS, my form beans are not volatile through various wizard-style screens,
so now I move on to fleshing things out by prettyfacing the JSPs and
retrieving data from session beans for presentation by the view.

Assumption 1: Now that I need onChange and onClick events in the JSP tags, I
need to rely on calling the submit() method of the form. This means I need
to remove all of my  because of the problem mentioned by others
on this list with name="submit" and "submit method not supported by this
object".

Result: Good: the submit() method works and I can pass an action token
either as a parameter of the request or as a hidden field via form bean
property. Bad: My browser will not call the submit() method unless the URL
of the request is *identical* to the URL of the source. So smile.jsp to
smile.jsp works and I dispatch. faceSmile.do to smile.jsp or smile.jsp#
fails because URLs differ and faceSmile.do or smile.jsp to faceFrown.do or
frown.jsp fail. By *fail* I mean the submit() method *does not* call the
perform() method of the smile action class (as verified through debugging
console println).

Assumption 2: I need to call the action class of every JSP page and always
forward to the action class instead of linking (href) to the JSP. This is
necessary to properly populate collections, retrieve data from the business
tier, etc. without resorting to scriptlets in the JSP. For example, every
JSP forwards to a global forward like forward="face.Smile" my face.Smile
forward paths to faceSmile.do and my faceSmile.do maps to face.jsp which
contains an  whose action="faceSmile" and which uses the
faceFormBean. This also solves my first problem because every link forwards
to its own action class (smile.jsp links forward to faceSmile.do which
matches the source URL).

Result: Good: Dispatching works, uses never see a jsp in the URL, my
collections are populated in the action class and presented via the
smile.jsp view. *Very Bad*: Every time I forward or call faceSmile.do, a new
faceFormBean is instantiated, all properties are null (or default) and the
methods in the action class attempting to get values from the faceFormBean
get null. How do I control form bean recycling? What's going on? Does every
call to a logical forward/action servlet generate a new request? I confirmed
that the session id is constant.

Someone developing 4 or 5 tier apps must with STRUTS in the view and
controller must have run into this problem! Can you help?

CONFIGURATIONS:
Tomcat 4.0/Struts 1.0/JDK1.3.1_02/JAXP1.01
Tomcat 4.0/Struts 1.0.2/JDK1.3.1_02/JAXP1.01
IBM Visual Age for Java 4.0 Enterprise with JTE and JAXP 1.0.1 nicely
configured per help provided by many in this community (took a while
though!)
Our target production environment is WebSphere 4 + Oracle 9i

Respectfully,
Paul Devalier


_
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


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


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




nasty prob with action forwards, formbeans, http requests and submit() methods

2002-03-01 Thread Paul Devalier

I've got a nice little STRUTS app working by sticking to the path set by the 
community examples and keeping my views gray and skeleton-like. I'm digging 
STRUTS, my form beans are not volatile through various wizard-style screens, 
so now I move on to fleshing things out by prettyfacing the JSPs and 
retrieving data from session beans for presentation by the view.

Assumption 1: Now that I need onChange and onClick events in the JSP tags, I 
need to rely on calling the submit() method of the form. This means I need 
to remove all of my  because of the problem mentioned by others 
on this list with name="submit" and "submit method not supported by this 
object".

Result: Good: the submit() method works and I can pass an action token 
either as a parameter of the request or as a hidden field via form bean 
property. Bad: My browser will not call the submit() method unless the URL 
of the request is *identical* to the URL of the source. So smile.jsp to 
smile.jsp works and I dispatch. faceSmile.do to smile.jsp or smile.jsp# 
fails because URLs differ and faceSmile.do or smile.jsp to faceFrown.do or 
frown.jsp fail. By *fail* I mean the submit() method *does not* call the 
perform() method of the smile action class (as verified through debugging 
console println).

Assumption 2: I need to call the action class of every JSP page and always 
forward to the action class instead of linking (href) to the JSP. This is 
necessary to properly populate collections, retrieve data from the business 
tier, etc. without resorting to scriptlets in the JSP. For example, every 
JSP forwards to a global forward like forward="face.Smile" my face.Smile 
forward paths to faceSmile.do and my faceSmile.do maps to face.jsp which 
contains an  whose action="faceSmile" and which uses the 
faceFormBean. This also solves my first problem because every link forwards 
to its own action class (smile.jsp links forward to faceSmile.do which 
matches the source URL).

Result: Good: Dispatching works, uses never see a jsp in the URL, my 
collections are populated in the action class and presented via the 
smile.jsp view. *Very Bad*: Every time I forward or call faceSmile.do, a new 
faceFormBean is instantiated, all properties are null (or default) and the 
methods in the action class attempting to get values from the faceFormBean 
get null. How do I control form bean recycling? What's going on? Does every 
call to a logical forward/action servlet generate a new request? I confirmed 
that the session id is constant.

Someone developing 4 or 5 tier apps must with STRUTS in the view and 
controller must have run into this problem! Can you help?

CONFIGURATIONS:
Tomcat 4.0/Struts 1.0/JDK1.3.1_02/JAXP1.01
Tomcat 4.0/Struts 1.0.2/JDK1.3.1_02/JAXP1.01
IBM Visual Age for Java 4.0 Enterprise with JTE and JAXP 1.0.1 nicely 
configured per help provided by many in this community (took a while 
though!)
Our target production environment is WebSphere 4 + Oracle 9i

Respectfully,
Paul Devalier


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Action Forwards

2002-02-16 Thread James Mitchell

No problem at all.

Here is an example of what I am using.

In my IndexAction, I get a property from the ApplicationResources that
determines whether the index page should be a login or the main menu.  This
lets me decide at deployment time whether the user sees a login or the main
menu.


my index.jsp has a request.
- index.jsp
<%
pageContext.forward( "/index.do");
%>
- struts-config.xml

  



















James Mitchell
Software Engineer
Open-Tools.org
Home Phone (770) 822-3359
Cell Phone: (678) 910-8017


-Original Message-
From: Tim Sawyer [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 16, 2002 6:49 PM
To: Struts List
Subject: Action Forwards


Hi,

There's nothing to stop me forwarding to a do rather than a jsp in the
struts config is there?  Like this:


  


Cheers,

Tim.



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


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




Action Forwards

2002-02-16 Thread Tim Sawyer

Hi,

There's nothing to stop me forwarding to a do rather than a jsp in the
struts config is there?  Like this:


  


Cheers,

Tim.



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: obtaining action forwards in jsps

2001-08-30 Thread Troy Hart

look at 

Troy

On Wednesday 29 August 2001 04:24 am, you wrote:
> Hi,
>
> Is there any way to obtain the action forward urls in jsps using their
> logical 'struts-config' name? I'd like to code links etc point to certain
> action forward urls found in struts config rather than hard coding the url?
> Similarly I'd like to be able to change the action url of forms using
> values found in struts-config using the logical forward name.
>
> Is this possible?
>
> Cheers
> Nathan
>
>
> **
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
>
> www.mimesweeper.com
> **



Re: obtaining action forwards in jsps

2001-08-29 Thread JEWeaver


I can partially respond..

You can create links that will navigate based on global struts forwards by
using the html:link tag;


I don't know of a way to access the local forwards within actions, but my
impression is that these are intended to be related to the processing of an
action anyway.  i.e, if adding a widget action fails, go here, if it
succeeds, go there.  If you use the local forwards like this, I'm not sure
it makes since to build links for them.  You get to them as a result of an
action class perform.

When I have a common page that is reached via links in the app, I create a
global forward for it.  The kink I ran into is that in a few places our web
designers chose form buttons to navigate to some of the common screens
instead of a link.  I was unable to get an  to work within an
 tag (I'm not an html whiz, but I got the impression that only
text worked to represent the link).  What I ended up doing was creating an
action mapping in struts config that has no action class:




Then I can use an  tag to render the button.  On click of the
button I use a javascript function that sets the forms action target to
"viewWidgets" and voila, it works.

I'm still new to this, so I hope I haven't muddied the waters for you...


Jim Weaver
Software Developer - ThoughtWorks


   
  
Nathan Coast   
  
 
lseas.com>   cc:   
  
     Subject: obtaining action forwards in 
jsps  
08/29/2001 05:24   
  
AM 
  
Please respond to  
  
struts-user
  
   
  
   
  




Hi,

Is there any way to obtain the action forward urls in jsps using their
logical 'struts-config' name? I'd like to code links etc point to certain
action forward urls found in struts config rather than hard coding the url?
Similarly I'd like to be able to change the action url of forms using
values
found in struts-config using the logical forward name.

Is this possible?

Cheers
Nathan


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**







obtaining action forwards in jsps

2001-08-29 Thread Nathan Coast

Hi,

Is there any way to obtain the action forward urls in jsps using their
logical 'struts-config' name? I'd like to code links etc point to certain
action forward urls found in struts config rather than hard coding the url?
Similarly I'd like to be able to change the action url of forms using values
found in struts-config using the logical forward name.

Is this possible?

Cheers
Nathan


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**



question about Action Forwards in struts-config

2001-06-05 Thread Jonathan Asbell



I have boiled down action forward to a few exact 
situations.  I would only want to do any of the following 
situations:
1) take me back where I was
2) take me back to where I was trying to 
go
3) take me to a specific page
4) take me to a default page
 
I dont believe there is currently a neat and clean 
way of describing this in the struts-config.  Maybe there doesnt need to be 
for things like "where I was trying to go" and "where I was".  I am just 
looking for some clarity on the issues and what/why the implementation is what 
it is currently is


RE: Action forwards

2001-03-06 Thread Katherine Barry

We are have a side-menu so generally it hasn't been a problem. What we do
care about is the refresh. We would like to be able to use it, but it goes
back to the original page forces us to log back in. If we live with
forwards, can we get the refresh to work?

Thanks.

Katherine

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 06, 2001 10:03 AM
To: [EMAIL PROTECTED]
Subject: Re: Action forwards


Katherine Barry wrote:

> We are using action forwards, but the url in the browser never changes.
> Everything works happily, so the only thing we want is for the browser to
> change and display the new URL(mainly for the refresh button). I know
> everyone is now using 1.0, but we haven't migrated, and are still using
> 0.5(we are to close to release to have changed). How can I get the browser
> to update?
>

What you are seeing is the result of how a RequestDispatcher.forward()
works.
This all happens on the server side, and the client browser has no clue what
happened.  The only way to get the browser's displayed URL to change would
be
to use redirects instead of forwards, which has two disadvantages:

* It is much slower, because of the extra round trip to the browser

* It eliminates the ability to use request attributes, because the redirect
  comes in as a separate request.

As I general rule, I train my users to totally ignore the location bar when
running a web application (as opposed to surfing a web site).  If they still
get confused, you have several options:

* Run inside a framed presentation so that the location bar
  *never* changes.

* Use JavaScript to create a new window that has no location
  bar, and run your app inside that.

* Get some new users (don't we wish sometimes :-).


> Katherine

Craig




Re: Action forwards

2001-03-06 Thread Ted Husted

Katherine Barry wrote:
> We are using action forwards, but the url in the browser never changes.
> Everything works happily, so the only thing we want is for the browser to
> change and display the new URL(mainly for the refresh button).

I believe Refresh repeats the last request, rather than the URL that
appears in the browser's address window. 

If you want refresh to redisplay the current page (without repeating the
last request, which may include input from a form), then you should use
the redirect technique that Craig mentioned. (In which case generating a
new request becomes a benefit rather than a drawback.)

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/



Re: Action forwards

2001-03-06 Thread Craig R. McClanahan

Katherine Barry wrote:

> We are using action forwards, but the url in the browser never changes.
> Everything works happily, so the only thing we want is for the browser to
> change and display the new URL(mainly for the refresh button). I know
> everyone is now using 1.0, but we haven't migrated, and are still using
> 0.5(we are to close to release to have changed). How can I get the browser
> to update?
>

What you are seeing is the result of how a RequestDispatcher.forward() works.
This all happens on the server side, and the client browser has no clue what
happened.  The only way to get the browser's displayed URL to change would be
to use redirects instead of forwards, which has two disadvantages:

* It is much slower, because of the extra round trip to the browser

* It eliminates the ability to use request attributes, because the redirect
  comes in as a separate request.

As I general rule, I train my users to totally ignore the location bar when
running a web application (as opposed to surfing a web site).  If they still
get confused, you have several options:

* Run inside a framed presentation so that the location bar
  *never* changes.

* Use JavaScript to create a new window that has no location
  bar, and run your app inside that.

* Get some new users (don't we wish sometimes :-).


> Katherine

Craig





Action forwards

2001-03-06 Thread Katherine Barry

We are using action forwards, but the url in the browser never changes.
Everything works happily, so the only thing we want is for the browser to
change and display the new URL(mainly for the refresh button). I know
everyone is now using 1.0, but we haven't migrated, and are still using
0.5(we are to close to release to have changed). How can I get the browser
to update?

Katherine