• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Forwarding a JSP page in struts without population FormBean

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have to forward the control on the click of a html:button but i do not want to populate the ActionFormBean defined in the action-mapping.
One solution which i tried is to call a Java script on the click of button which will set the "action" value of form to "/ some other action-mapping "...
to be more precise i used the following code for the solution

html:form action="/Employee" focus="empName" method="POST"
input type="hidden" name="hiddenField"/
input type="hidden" name="counterValue"/
TABLE border="0" width="100%"
TR
TH align="right" Name: /TH
TD align="left" html:text property="empName"/ /TD
/TR
TR
TH align="right" Date Of Joining: /TH
TD align="left" html:text property="empJoinDate"/ (dd/MM/yyyy) (e.g. 21/03/1954) /TD
/TR
TR
TD align="right" html:button value="Submitt Button" property="SubmittButton" onKlick="onClickSubmit()"/ /TD

TD align="left" html:button value="Add" property="" onKlick="OnKlickAdd()"/
/TD /TR

on click of "add" button in calls the Java script

function OnKlickAdd()
{
document.forms[0].hiddenField.value = "add";
document.forms[0].action.value = "/AddAction";
document.forms[0].submit();
}

but the problem is that... on click of add button it doesnt go into /AddAction mapping but instead go into the /Employee mapping which is defined with html: form action="/Employee ....

i will give u guys the code which i placed in the Struts-config.xml
action
path="/AddAction"
type="org.apache.struts.actions.ForwardAction"
parameter="/EmployeeAddModify.jsp"
/action

action
path="/Employee"
type="com.employee.action.EmployeeAction"
name="employeeActionForm"
scope="request"
validate="false"
input="/EmployeeSearch.jsp"
forward
name="ADD"
path="/EmployeeAddModify.jsp"/
forward
name="success"
path="/EmployeeSearch.jsp"/
/action

I want that on click of "add" the /AddAction mapping should be used... but it is not happening...

Please help....
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be it should be

TD align="right" html:button value="Submitt Button" property="SubmittButton" onClick="onClickSubmit()"/ /TD
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
function OnKlickAdd()
{
document.forms[0].hiddenField.value = "add";
document.forms[0].action.value = "/AddAction";
document.forms[0].submit();
}


change to

function OnKlickAdd()
{
document.forms[0].hiddenField.value = "add";
document.forms[0].action.value = "/AddAction.do";
document.forms[0].submit();
}


this will help you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic