Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts for html:submit not initiated...

 
Ravi Seshu
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i m using struts for my add/update/delete process while i am able to get the values from the db , now i wanted to put values into the db using struts...,

this is the code in jsp...
<td> <html:text property="policyName" size="5"/></td>
<td><html:text property="policyGames" size="2"/></td>
<td><html:text property="policyDays" size="2"/></td>
<td><html:text property="policyCost" size="2"/></td>
<td><html:submit property="policyAdd" >Add Policy </html:submit></td>

when i submit i even kept the reference in PolicyForm.java...

...public void setPolicyAdd() _policyAdd="Add Policy";
...public String getPolicyAdd() retun_policyAdd

and in Action class PolicyAction ...

public void processAction(
ActionMapping mapping, ActionForm form, PortletConfig config,
ActionRequest req, ActionResponse res)
throws Exception
{
System.out.println("Entered into ProcessAction method of Policy Action method....");
PolicyForm policyForm = (PolicyForm) form;

if(!policyForm.getPolicyName().equals("") && "Add Policy".equals(policyForm.getPolicyName()))
{
try
{
Context ctx = new InitialContext();
CcsBaseballPolicyHome home= (CcsBaseballPolicyHome) ctx.lookup("CcsBaseballPolicy");
Integer rowCount=new Integer(home.findAll().size()+1);
CcsBaseballPolicy ccsBaseballPolicy= home.create(new String(policyForm.getPolicyName()) , rowCount ,policyForm.getPolicyGames(),policyForm.getPolicyDays(),policyForm.getPolicyCost());
System.out.println("New Policy Created with : "+ccsBaseballPolicy.getPolicyName() + "..."+ccsBaseballPolicy.getPolicyId());
}
catch(Exception ex)
{
ex.printStackTrace();
}
}


i m checking for the submit button laeble...and doing the rest...

but when i tried for trace in both the actiion and form classes i dont see any for button....submit..can any one...suggest me the process fi i gone wrong...

and if thisisz theprocess..poz..te..me...
 
anupa oru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
did you check what policyform.getPolicyName() is returning.
Thanks
Anupama
 
Ravi Seshu
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, the System.out.println at the benging of the Actionclasses is not displayed in the stack trace i....so..idont think dats the prob...and i wanted the process when i click over the submit button it sets the policyAdd property and sets the values in my form class ...but dat z even not going as i had put logs in but get and set methods of the policyAdd methods...

can any help me...for thisprob....

thz for ur reply anupama...
 
anupa oru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think you have to put code in execute(form,mapping,request,response)whose return type is ActionForward.If you already have something in execute() of Action can you show psedocode for the Action class.I hope this will be useful let me know.
Thanks
Anupama
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys, since this thread seems to be about Struts and not about Testing, I'll move it over to our dedicated Struts forum. Please continue the discussion over there.
Thanks.
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You say no System.out.println are coming on Server Console. Check your execute method is having the correct singature. Ensure it is overridding correctly.
It must prints all SOPs in execute method if it is overridden correctly


Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic