I can partially respond..

You can create links that will navigate based on global struts forwards by
using the html:link tag;
<html:link forward="mainWidgetMenu"/>

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 <html:button> to work within an
<html:link> 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:

    <action    path="/viewWidgets"
                      forward="/MainWidgetMenu.jsp">
    </action>

Then I can use an <html:submit> 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                                                       
                                                      
                    <nathan.coast@leve       To:     "Struts-User (E-mail)" 
<[EMAIL PROTECTED]>                                 
                    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
**********************************************************************




Reply via email to