Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Replace code

Thread view: 
Lindsay - 05 Jun 2006 14:07 GMT
I am creating an email form in jsp.  I have the form coded so that the
fields replace variables in a text document that is emailed to the
reciever.  That code is fine.  A co-worker helped me set it up, and the
replace function works fine.  However when he set it up, he had me code
the form so that the variables in the text document were being replaced
by actual names.  Basically when I tried to test the form, this is what
happened.
This is one of my lines of code.  lname is field name, so I wanted the
code to replace
%_lname% in the text document with the contents of the field lname on
my form.  In actuality the code replaced %_lname% with the words lname.

content=content.replaceAll("%_lname%","lname");

I tried the following code to remedy the situation but that didn't work
either.

content=content.replaceAll["%_lname%",request.getParameter("lname")];

I am a beginner coder, so does anyone have any suggestions?

Thanks,
Lindsay
Oliver Wong - 12 Jun 2006 19:09 GMT
> I tried the following code to remedy the situation but that didn't work
> either.
>
> content=content.replaceAll["%_lname%",request.getParameter("lname")];
>
> I am a beginner coder, so does anyone have any suggestions?

   Try using round brackets, as in

content=content.replaceAll("%_lname%",request.getParameter("lname"));

   Next time, quote the exact error message you received. See
http://riters.com/JINX/index.cgi/Suggestions_20for_20Asking_20Questions_20on_20N
ewsgroups#RepeatErrorsExactly


   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.