Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we write javascript functions on struts tags?

 
raja sekhar geda
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raja,

Welcome to JavaRanch!!!

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

Can you explain more about the problem?
 
raja sekhar geda
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic