Question: m not able to get background image in html file. What is wrong in my code?

[directory](https://i.stack.imgur.com/SbEtk.png)

[controller code](https://i.stack.imgur.com/hPz5Q.png)

[html code](https://i.stack.imgur.com/eqZ7S.png)

[web.xml](https://i.stack.imgur.com/2QMK3.png)

[enter image description here](https://i.stack.imgur.com/eTATA.png)

[output](https://i.stack.imgur.com/RZ4yh.png)

Answer: 
One issue I'm seeing is that your for loop is going to run into trouble. You've got `for(int j = 0; j < mergedArray.size(); j++) { ... }`, and inside the loop you have `mergedArray.get(j+1)`, so you'll hit an `ArrayOutOfBoundsException` pretty fast if you're not careful. Other than that, looks reasonable, I implemented a similar one and it split stuff as it should.
It wont be the fastest algorithm but should work.
You have 2 loops :

1st : You iterate unit you reach number of steps, you have a good implementation here.
2nd : Just after elements from arrays meet you need to stop iteration in this loop. Use continue.