This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts for html:submit not initiated... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts for html:submit not initiated..." Watch "Struts for html:submit not initiated..." New topic
Author

Struts for html:submit not initiated...

Ravi Seshu
Ranch Hand

Joined: Mar 19, 2005
Posts: 38
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

Joined: Jan 15, 2005
Posts: 118
hi,
did you check what policyform.getPolicyName() is returning.
Thanks
Anupama
Ravi Seshu
Ranch Hand

Joined: Mar 19, 2005
Posts: 38
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

Joined: Jan 15, 2005
Posts: 118
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
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


Sarath Mohan
 
Don't get me started about those stupid light bulbs.
 
subject: Struts for html:submit not initiated...
 
Similar Threads
Struts making me nuts :)
Confused on validate() method
can we replace submit button with link in order to submit form ?
Problem in hiding the row of data
blank page returned from validate