struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McGrady <m...@michaelmcgrady.com>
Subject Re: Re: Re: Re: Why does <html:submit> work differently than <html:link action="">?
Date Wed, 28 Jul 2004 17:42:50 GMT
At 10:16 AM 7/28/2004, you wrote:
>i'm a Struts newbie.  and while playing around with this situation i
>wasn't seeing my values getting populated in my actionform.  i figured
>it had to do with the way i set up my Struts tags, <html:link>, and
>their parameters.
>so in the Struts world, is there a way to submit a form using a
>hyperlink without using javascript?
>
>i know this comes down to poor design and basic web application
>functionality.  so i apologize that this has been drawn out.
>thank you all for being patient and helpful.


No problem, Andy.  This is easily solved without links and without 
javascript.  And, this comes up so often that I have provided a standard 
solution in the Struts wiki.  The solution is at 
http://wiki.apache.org/struts/StrutsCatalogMultipleImageButtonsWithNoJavaScript. 
Notice the title?  ///;-)

The solution I actually use is a lot more sophisticated than the one shown 
on the wiki pages.  Mine also generates and caches the buttons as gifs, 
pnms, pngs,  or jpegs or  in 14 languages with various fonts, sizes, 
colors, textures, etc.  But your problem, if you have the button, is really 
easy to solve.  You can, for example, have three Operation classes in the 
fields of your Button class representing the three choices.  Then, in your 
Action class you have:

if([ActionForm].getButton().getFirstChoice().pressed()) {
   // do whatever
} else if ([ActionForm].getButton().getSecondChoice().pressed()) {
   // do whatever
} else if([ActionForm].getButton().getSecondChoice().pressed()) {
   // do whatever
} else {
   // throw exceptions galore
}

If you have any questions about this, please ask away.

Michael




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message