Saturday, 15 March 2014

java - Read html file and replace string in jsp -


How to add some text in the div with id = "sw" and befor "? Adding and writing in response to JSP?

"index_012. Html is content:

   gt;> head> gt; & lt; body & gt; 
& lt; / section & gt; & lt; div class = "clear">
/ div> & lt; / body & gt;

My jsp code is:

  FileReader fr = new FileReader (stringbilder result = "" string baller result = "" ; St String line = zero; // find pla ""; stringbuilder result = ""; stringbuilder result = ""; cry stringbuilder int to add content = 1; while ((line = br.readline ())! = Null & amp; ; Content place == - 1) {int swIndex = line.indexOf ("\" sw \ ""); Contentplace = line.indexOf ("& gt;", swIndex);} if (contentPlace & gt; -1) {// Content is the place where I have to add "index" -------- I need help here ---------- Results = br.append (adding content, Content place); -------- I need help here ----------}  

and then this jsp tag

  & Lt;% = result% & gt;  

I do not need any changes to index_012.html or any other file

Type output in reply

read in other words How to file as stringbuller -> replace some things -> type for feedback ??

You need a buffed water in a file.

Better if you open a temporary file in writing, you can delete the original file and rename the temporary file.

I think you should do something like this


No comments:

Post a Comment