This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes How to use replace function in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to use replace function in jsp" Watch "How to use replace function in jsp" New topic
Author

How to use replace function in jsp

Wu Tang
Greenhorn

Joined: Oct 31, 2008
Posts: 4
Hello,

I�m trying to remove a character �$� from my jsp form before its submitted to the database since the database doesn�t accept �$�. I�ve been reading about the replace function but I�m unsure how to implement it. Does anyone know how to implement the replace function in JSP? Here is a snippet of my code:
javascript:%20x()
<tr>
<td valign="top" align="left"><b>Estimated Total Partner Funds::</b>
<br><html:text property="estTotalFunds" styleClass="required" />
</td>
</tr>
javascript:%20x()

The property=estTotalFunds is the variable that contains the values. Essentially, the value comes in $22.00 and I need it to be 22.00 before I submit it to the database.

Any assistance would be greatly appreciated.
Thank you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

If you need to change the data before it is written to the database, that should be handled in the code that writes to the database -- not at the UI level.
[ October 31, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Wu Tang
Greenhorn

Joined: Oct 31, 2008
Posts: 4
The '$' character is being appended to the value in a database script the '$' character is only for display purposes and I need to remove it before I submit the data to the database.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Then remove it in the code just before it's written to the DB.
Wu Tang
Greenhorn

Joined: Oct 31, 2008
Posts: 4
Thank you for your replies. I understand what needs to be done the question is how to go about doing it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Have you checked the methods on the String class?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use replace function in jsp
 
Similar Threads
Disable Form - Java Script
using ajax and struts iterate tags
Client side validation problem
JSF fileupload
using Multiple submit buttons.