• Post Reply Bookmark Topic Watch Topic
  • New Topic

can i pass a variable through javascript function to another struts jsp page?

 
Amit Chandigarihan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two jsp pages P1 and P2 . When P1 is invoked it picks the details from the database and displays on the page. The details are displayed in the form of a table with each row having a radio button.
When any radio button is checked and then particular link is pressed say "Preview and Announce Party" then the particular id connected with that radio button is taken and it has to be passed to struts-config form-bean so that i can capture it in another Action class.

My question is can i pass the value of the variable through a javascript function to struts-config.xml . How?

My code is like this

<script type="text/javascript">
function announce()
{
for(i=0;i<document.forms[0].seminarID.length;i++)
{
if(document.forms[0].seminarID[i].checked)
{
val=document.forms[0].seminarID[i].value;
}
document.forms[0].action="/Announce";
document.forms[0].submit();

}
</script>

and this function is called from the code

<html:link href="/Announce.do" onclick="javascript:announce()">Announce Party</html:link>


I am new to Struts framework .
 
Syednizar Kamal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For this functionality i think no need to pass any value from jsp to xml. Just pass 'SeminarId" as a query string and get that seminarId from request in controller.

Announce.do?SeminarId=seminarId

Note: I am not sure this will really help you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!