0

I'm setting up a new web app and came to know that the company name is spelled incorrectly in all the web pages. So, I want to change it in all of them. I am using eclipse neon.

Is there any way to add or replace text from all the web pages in Eclipse ? or Will I have to change them manually one by one?

Tried using ctrl+shift+R but it's for the change of method or variable name in eclipse.

mrSaraf
  • 123
  • 1
  • 13
DeUs
  • 31
  • 2
  • 9
  • In `IntelliJ IDEA` you can replace any text using `CTRL+SHIFT+R`. No Idea about eclipse IDE. – Mushif Ali Nawaz Feb 11 '19 at 04:08
  • Don't know about Eclipse, but there are plenty of ways to do this, like `Replace in path` in IntelliJ, and replace in directory in Notepad++, and linux command to replace all recursively... – Kartik Feb 11 '19 at 04:08
  • Maybe this might help you out: https://stackoverflow.com/questions/6800799/replace-string-in-all-files-in-eclipse – mrSaraf Feb 11 '19 at 04:09
  • 1
    On a side note for the future: resusable parts. You should have all your pages reused the same header and footer source! Then you make the change in only one place. Lookup "DRY code" :) – Zephyr Feb 11 '19 at 04:11
  • please try to show us your finding first. – Vishrant Feb 11 '19 at 04:18
  • @Zephyr Thanks. Probably best thing I have learned today. – DeUs Feb 11 '19 at 04:26
  • I appreciate the quick comeback! – GhostCat Feb 11 '19 at 04:47

3 Answers3

2

The eclipse IDE is mainly a programming tool, and as such it also supports:

  • searching for files using wildcards
  • replacing content using regular expressions within all finds matching your condition

Simply turn to Search"->"File" and enter your search text, a file pattern and then use replace!

And of course: the real answer is to step back and look into what you are doing! Such repeating information (that has to be always the same in many different places) should always come out of 1 source file, not out of 120 different files. That comment about "don't repeat yourself" is the real solution here!

GhostCat
  • 137,827
  • 25
  • 176
  • 248
  • 1
    Found another way .Search ->"Text"->"Workspace". Right click on selected text and replace all. – DeUs Feb 11 '19 at 04:20
0

I think, it is better to create a separate header page and separate footer page and include them in all web page. So next time if you make this type of mistake you should not think about the all page, you can just change in one page and see the change in all page.

Polash
  • 44
  • 3
  • 2
    While I agree with this advice, it is not an answer to the question and should be a comment instead. – Zephyr Feb 11 '19 at 04:12
  • I agree with you. I have not enough reputation to make a comment that’s why I though put it as an answer, sorry for that – Polash Feb 11 '19 at 16:45
0

Eclipse - Search - File..

search file

in this example will be replace "conpany" in all jsp's with 'company'

replace

imperezivan
  • 761
  • 5
  • 13