aspose file tools*
The moose likes Struts and the fly likes Is It Possible to Invoke An Action By Selecting an Option from a Drop-Down Menu? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is It Possible to Invoke An Action By Selecting an Option from a Drop-Down Menu?" Watch "Is It Possible to Invoke An Action By Selecting an Option from a Drop-Down Menu?" New topic
Author

Is It Possible to Invoke An Action By Selecting an Option from a Drop-Down Menu?

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
We can invoke actions by clicking on a Submit button or by clicking on a link. Is it possible to invoke an action by selecting an option from a drop-down menu? If the answer is "yes", how do we do it?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

JiaPei,
Yes, but you need to use Javascript too. If there is a different action depending on the value, you need to set that action. Regardless, use javascript to submit the form


(blur should be onBlur), but it's not letting me post that.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kunal Bhattacharya
Greenhorn

Joined: Sep 08, 2006
Posts: 1
I am facing the same error.
When I try starting tomcat. I get the following error -

Sep 8, 2006 2:37:59 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /ch03app threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml

Here is the entry in struts-config.xml

<action-mappings>
<action path="/Lookup"
type="ch03.LookupAction"
name="LookupForm" />
<forward name="success" path="/quote.jsp" />
<forward name="failure" path="/index.jsp" />
</action>
</action-mappings>


Can someone help me on this?
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
OnBlur is fired even when the option is not changed. I believe the better way is to use OnChanged and OnBlur together. Something like below



and make the selection control like

<select name="change1" on blur="submitChange(this.form);" on change="onChangedSelection();">
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is It Possible to Invoke An Action By Selecting an Option from a Drop-Down Menu?
 
Similar Threads
Java Script Drop-down option deletion but little bit different
JMenuBar
Resfresh page and getting values when option is selected
Ajax select boxes and browser back button
drop down list doPost() servlet