Hi, 

I'm having a particularly frustrating time trying to get my struts app to
recognise which button has been pressed.
I've stripped it down a bit to only one submit button with one property
and getter & setters for it.
The problem I have is that the property specified in the html:submit tag
doesn't seem to have its setter method called.

I know the ReportForm is having other setters called, as I can see them in
the log, but the setButtonCreate setter never gets called.

I know about DispatchAction etc, but would prefer not to use them right
now, as this should work (so I've read elsewhere).

Any ideas?

Thanks,

Bruce

Code snippets follow.

jsp snippet
<html:submit property="buttonCreate" 
titleKey="help.CreateReport"><bean:message
key="text.CreateReport"/></html:submit>

struts-config snippet
                <action path="/loginProcess"
type="com.comtelco.central.reporting.web.action.LoginAction"
name="loginForm" input="/templates/login.jsp" scope="request"
validate="true">
                        <exception
type="com.comtelco.central.reporting.exception.AuthorisationException"
key="err.authorisation" scope="request" path="/action/login" />
                        <exception
type="com.comtelco.central.reporting.exception.InvalidLoginException"
key="err.invalidlogin" path="/action/login" scope="request" />
                        <forward name="Success" redirect="true"
path="/action/mainmenu" />
                        <forward name="Failure" redirect="true"
path="/action/login" />
                </action>



ReportForm snippet
       // Buttons
        public void setButtonCreate( java.lang.String buttonCreate ) {
                LOG.debug( "setBCreate" );
                this.buttonCreate = buttonCreate;
        }
        public String getButtonCreate( ) {
                LOG.debug( "getBCreate" );
                return buttonCreate;
        }
        public boolean isButtonCreate() {
                // buttonCreate
                return (buttonCreate != null);
        }


Report Action snippet
                if (((ReportForm) form).isButtonCreate() ) {
                        LOG.debug( "createReport" );
                        serviceRequest( form );
                        forward=mapping.findForward(
IConstants.SUCCESS_KEY );
                } else {
                        // No buttons pressed
                        // Fill in all the data needed for the view
                        // in the ActionForm.
                        initialiseForm( (ReportForm) form );
                        forward=mapping.findForward(
IConstants.SUCCESS_KEY );
                }






--
Bruce James
mailto: [EMAIL PROTECTED]
07973 114881


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

Reply via email to