This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to clear text fields which holds date,float,short, data types in the aciton class

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey,
I want to know how can I set text fields which holds float,short,date data types in the action class.


as an example

below is the jsp code snippet for "Risk Category Code" drop down list....

<tr>
<td class="tableFont">  Risk Category Code</td>
<td class="tableFont">
<s:if test="riskCategoryCodeList == null"><s:select name="riskCategoryCode" list="#{'':''}" listKey="riskCategoryCode" headerValue="" headerKey="" cssStyle="width : 144px; height : 20px"/></s:if>
<s:else><s:select name="riskCategoryCode" list="riskCategoryCodeList" listKey="riskCategoryCode" listValue="riskCategoryName+' - '+riskCategoryCode" headerValue="" headerKey="" cssStyle="width : 144px; height : 20px"/></s:else> *

<s:fielderror>
<s:param value="%{'riskCategoryCodeRetrieved'}"/>
</s:fielderror>

</td>
</tr>



below is the definition for riskCategoryCode and the getter and setter methods in action class
<<<<<<private String riskCategoryCode;>>>>>>>

public String getRiskCategoryCode() {
return riskCategoryCode;
}

public void setRiskCategoryCode(String riskCategoryCode) {
this.riskCategoryCode = riskCategoryCode;
}



we can clear the risk category code text field by using below code

<<<< this.setRiskCategoryCode(null);>>>>>




so I want to know that variables which defined as shot,float,date in the action class

how can i clear text fields like below


private float coverCommissionRate;
private Date effectiveDateFrom;



I tried to clear those text fields by using following methods

this.this.setEffectiveDateFrom(null);




it was give me a nullpointerexception error







 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you're asking, or what you're having a problem with.

Under what circumstances do you want to modify them?
 
Gihan Pandigamage
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks,
I found the solution for my problem.
the solution is check whether the received value is null in the setter method in the action class.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic