This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes can we write javascript functions on struts tags? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "can we write javascript functions on struts tags?" Watch "can we write javascript functions on struts tags?" New topic
Author

can we write javascript functions on struts tags?

raja sekhar geda
Greenhorn

Joined: May 07, 2012
Posts: 2
can we write javascript functions on struts tags?

If yes, How to retrieve the struts tags values in java script functions?
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Hi Raja,

Welcome to JavaRanch!!!

raja sekhar geda wrote:can we write javascript functions on struts tags?

Can you explain more about the problem?


Have Fun with Java
little,little.. little by little makes a lot..
raja sekhar geda
Greenhorn

Joined: May 07, 2012
Posts: 2
<html>
<script type="text/javascript">
function rajasekhar(){
document.getElementById("first").value =document.getElementById("second").value;
alert(document.getElementById("first").value);
}
</script>
<form>
<input type="text" id="second"/>
<input type="text" id="first" />
<input type="submit" value="submit" onclick="rajasekhar();" />
</form>
</html>

Output :-- Here when i save the file with .html extension and when i open the file with browser then two text fields and button apper on the webpage . When i enter the first text box and click on the button then alert box will be displayed . on this alert second text box value will be displayed.




I want to perform the above Operations on pure Struts tags a:

<html>
<script type="text/javascript">
|
|
</script>
<body>
<form action="registration" method="post">
<html:text property="first" />
<html:text property="second"/>
<html:submit onclick="rajasekhar()" />
</form>
</html>


Now tell me the java script code.
 
Don't get me started about those stupid light bulbs.
 
subject: can we write javascript functions on struts tags?
 
Similar Threads
calling functions in .js file
validation particular fields for different actions in a single page
How can I trigger javascript function before submit struts 2
extending the default stuts tags
can we able to create struts html tags dynamically from javascript?