File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to send multiple actions to Action class after disabling JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to send multiple actions to Action class after disabling JavaScript" Watch "How to send multiple actions to Action class after disabling JavaScript" New topic
Author

How to send multiple actions to Action class after disabling JavaScript

Raj Chukka
Greenhorn

Joined: Apr 09, 2007
Posts: 22
Hi,

I have 3 actions (Buttons) in my screen. I have a requirement that we still need to send the request to Action class even after Javascript is disabled

Currently i am doing the following

<html:form method="post" action="a.do">



<%-- Now i have 2 more Buttons --%>
<html:reset value="Reset" ..... onclick = "javascript:clear(form) "/>
<html:submit value="Submit" ..... onclick = "javascript:submitAction()"/>
</html:form>

if the JavaScript is disabled, both the buttons will not work. I want to send them in "action" attribute it self. How do i do that? Can someone help me?

Thanks,
Raj
Pawel Nowacki
Ranch Hand

Joined: Nov 14, 2008
Posts: 67

I want to send them in "action" attribute it self.


What do you mean by "them" and "action"?
I think you could do submit without JavaScript?

If you want to check if JavaScript is enabled/disabled in JSP there is one idea:
Put hidden field with value="false". You can name it javaScriptEnabled. Now, write some JavaScript function and try to change the value of this hidden field to "true".
If JavaScript is enabled it will work and change value to true, if not - value remains as false. I think you could put it on your initial jsp or somewhere before this jsp - then you could for example put this value in session.

Mind, this should be tested first if it works like I think it is

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to send multiple actions to Action class after disabling JavaScript
 
Similar Threads
Arraylist in JSP with Html radio
How to do two actions on a same Form in Struts?
show different content after a choice in a combobox
How to perform operations like insert,delete,add,move next etc in jsp page?
textbox - onBlur, fire off a Struts action