struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nils-Helge Garli Hegvik" <nil...@gmail.com>
Subject Re: Clearing form value
Date Sun, 20 Apr 2008 16:39:58 GMT
Considering you're processing the form and displaying the form using
the same action within the same request, I would say this is expected
behavior. I would consider doing a redirect after the post instead.

Nils-H

On Sat, Apr 19, 2008 at 12:06 PM, aum strut <aum.struts@gmail.com> wrote:
> i am not using Spring at all.here is the code for my configuration and
>  action class
>
>  my *Quotation.jsp page* by which i am adding data
>
>
>  <%@ taglib prefix="s" uri="/struts-tags" %>
>
>  <html>
>
>  <head>
>
>  <title>Quotation Form</title>
>
>  <s:head theme="ajax"/>
>
>  </head>
>
>  <body>
>
>  <center><font face="verdana" size="2" color="red"><s:actionmessage></
>  s:actionmessage></font></center>
>
>  <h1 align="center"> &nbsp;&nbsp;&nbsp;Quotation Form</h1>
>
>  <s:form action="SaveBill">
>
>  <table align="center">
>
>   <s:datetimepicker label="Date:" name="date"/></td><td>
>
>  <s:textfield label="Voucher Number:" name="voucherNumber"/>
>
>  <s:textfield label="Customer Name:" name="customerName"/>
>
>  <s:textarea label="Address" name="address" cols="20" rows="4"/>
>
>  <s:textfield label="Contact No:" name="contactNo"/>
>
>  <s:textfield label="Item Name:" name="itemName"/>
>
>  <s:textfield label="Purity:" name="purity"/>
>
>  <s:textfield label="Gross Weight(Gms):" name="grossWeight"/>
>
>  <s:textfield label="Net Weight(Gms):" name="netWeight"/>
>
>  <s:textfield label="Diamond Weight:" name="diamondWeight"/>
>
>  <s:textfield label="Gold Rate(Rs):" name="goldRate"/>
>
>  <s:textfield label="Amount:" name="amount"/>
>
>  <s:submit label="Save" align="center" />
>
>  </table>
>
>  </s:form>
>
>  </body>
>
>  </html>
>  *my action class*
>
>
>  package raisonne.billgeneration;
>
>  import com.opensymphony.xwork2.ActionSupport;
>  import raisonne.billgeneration.GetBillConnection;
>
>  public class SaveBillingData extends ActionSupport{
>
>   /**
>   *
>   */
>   private static final long serialVersionUID = -5856152810070496725L;
>   private int rowInserted=0;
>   private String date=null;
>   private String voucherNumber=null;
>   private String customerName=null;
>   private String address=null;
>   private String contactNo=null;
>   private String itemName=null;
>   private String purity=null;
>   private double grossWeight=0.0;
>   private double netWeight=0.0;
>   private double diamondWeight=0.0;
>   private double goldRate=0.0;
>   private double amount=0.0;
>
>  /*
>
>  Getter and Setter Method
>
>  */
>
>   public String execute() throws Exception{
>   GetBillConnection billCollection =new GetBillConnection();
>   rowInserted=billCollection.AddBillingData(getDate(),getVoucherNumber(),
>     getCustomerName(),getAddress(),getContactNo(),
>     getItemName(),getPurity(),getGrossWeight(),
>     getNetWeight(),getDiamondWeight(),getGoldRate(),getAmount());
>   if(rowInserted>0){
>    addActionMessage("Quotation data has been submitted successfully");
>    return SUCCESS;
>   }
>   else{
>    addActionMessage("Error while saving Quotation data, Pleaes retry");
>    return INPUT;
>   }
>   }
>
>
>  }
>
>
>  lastly *Struts.xml file*
>
>
>  <package name="raisonne.billgeneration" extends="struts-default" namespace=
>  "/">
>
>  <action name="SaveBill" class="raisonne.billgeneration.SaveBillingData">
>
>  <result name="success">/BillGeneration/Quotation.jsp</result>
>
>  <result name="input">/Login/Login.jsp</result>
>
>  </action>
>
>  </package>
>  -aum
>
>
>
>
>  On 4/19/08, Nils-Helge Garli Hegvik <nilsga@gmail.com> wrote:
>  >
>  > It would be a lot easier helping if you show us some configuration
>  > files and code....
>  >
>  > Nils-H
>  >
>  > On Sat, Apr 19, 2008 at 6:59 AM, aum strut <aum.struts@gmail.com> wrote:
>  > > yes you are right
>  > >
>  > >  not providing complete information in one mail is really not good
>  > >
>  > >  i wil take this in to account in future...
>  > >
>  > >  well i am not using spring in my application i have a simple form which
>  > is
>  > >  sending the input values to my action where i am adding these in to the
>  > data
>  > >  base using simple jdbc call everything is working fine i am even
>  > getting
>  > >  back the success response in my add form.
>  > >
>  > >  i am not able to understand what u mean by "not have your action
>  > defined as
>  > >  being "prototype"
>  > >  scope"
>  > >
>  > >  aum
>  > >
>  > >
>  > >
>  > >
>  > >  On 4/19/08, Dave Newton <newton.dave@yahoo.com> wrote:
>  > >  >
>  > >  > Are you using Spring?
>  > >  >
>  > >  > Would it be possible for you to provide more useful information in
>  > your
>  > >  > initial emails rather than generating a stream of a half-dozen or
>  > more?
>  > >  > It's
>  > >  > rather frustrating; we've gone through this before.
>  > >  >
>  > >  > One common error is to not have your action defined as being
>  > "prototype"
>  > >  > scope. Since actions are instantiated on each request (normally) it's
>  > not
>  > >  > typical to see this behavior without some effort on your part or
>  > >  > mis-configuration.
>  > >  >
>  > >  > Dave
>  > >  >
>  > >  > --- aum strut <aum.struts@gmail.com> wrote:
>  > >  >
>  > >  > > currently i am using struts-2.0.11.1
>  > >  > >
>  > >  > > On 4/19/08, Dave Newton <newton.dave@yahoo.com> wrote:
>  > >  > > >
>  > >  > > > Which version of Struts?
>  > >  > > >
>  > >  > > > --- aum strut <aum.struts@gmail.com> wrote:
>  > >  > > >
>  > >  > > > > Hi all,
>  > >  > > > >
>  > >  > > > > a little point which i want to know.
>  > >  > > > > i have a form by which we can add billing detais in the
>  > database
>  > >  > > > >
>  > >  > > > > form is working fine, it is adding the value to the database
as
>  > >  > > > expected,
>  > >  > > > > the problem whcih i am facing is even after successfully
>  > submitting
>  > >  > the
>  > >  > > > > values, it is not clearing the form values which has
been added
>  > >  > > > >
>  > >  > > > > i can clear the fields values  using java script,but
i want to
>  > know
>  > >  > is
>  > >  > > > it
>  > >  > > > > possible using Struts2,is theer any was that when ever
data is
>  > >  > > submitted
>  > >  > > > > successfully in the database form fields values should
get
>  > cleared.
>  > >  > > > >
>  > >  > > > >
>  > >  > > > > any help in this regard will be much appriciated.
>  > >  > > > >
>  > >  > > > >
>  > >  > > > > thanks in advance
>  > >  > > > > --aum
>  > >  > > > >
>  > >  > > >
>  > >  > > >
>  > >  > > >
>  > ---------------------------------------------------------------------
>  > >  > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  > >  > > > For additional commands, e-mail: user-help@struts.apache.org
>  > >  > > >
>  > >  > > >
>  > >  > >
>  > >  >
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  > >  > For additional commands, e-mail: user-help@struts.apache.org
>  > >  >
>  > >  >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  > For additional commands, e-mail: user-help@struts.apache.org
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message