Best practics
Ideally, the JSP should no longer have <% // scriptlet %> blocks.
JSPs have evolved so much that they simply hid Java code behind Standard Actions and custom tags using the expression language, JSTL, and now OGNL expressions to obtain results (for the processed request only) from pre-populated JavaBeans available in any application area (for example, a session , request, page, etc.) or complex data stores (e.g. ValueStack in Struts 2).
So, the correct solution will look something like this (cannot use EL, because we need the "user" link)
<jsp:useBean id="user" class="foo.User" />
This line of code, when added to Title.jsp will create a new User bean and add it to the page area, and the same line of code in Header.jsp will extract the User bean from the page and assign it a link called User , which can then be used throughout the rest of the file.
But, since the rest of the Java code is not written using tags, this will not make much sense. That way, you can also just pass the bean between the two JSPs as a request attribute using one of your <% // scriptlet%> blocks.
<% // in Title.jsp request.setAttribute ("user", new User()); %> <% // in Header.jsp User user = request.getAttribute ("user"); user.setName ("John Doe"); %>
Answer
If the code base is too large to save, and using any of the best practices is simply impractical; you can set up Eclipse to ignore JSP syntax checking errors, or it is better to disable them only for JSP fragments or specific files and folders.
With the web project selected in the workspace, go to Project > Properties > Validation > JSP Syntax . Then Enable project specific settings and turn off Validate JSP fragments as shown below.

A JSP snippet is a .jspf file that contains a JSP / HTML segment without opening or closing header tags (unless, of course, it is a header or footer fragment). Therefore, although you will have to rename your files in .jspf for Eclipse in order to recognize them as fragments (and not check); Main advantages:
- files can be located in any structure folder
- extension explicitly indicates inclusion
- new fragments are automatically identified
If the number of included files is huge or cannot be renamed for some reason, your next best option is to move them to a separate folder (for example, includes ), and then exclude the folder itself from JSP syntax checking.
Again, go to the menu "Project"> "Properties"> "Validation" and turn on the special settings of the project, click the "Search Type" [...] button to access the JSP Syntax Validator settings.

In this case, first create an Exclude Group and then Add Rule to exclude the folder (for example, WebContent / includes in the image) from the JSP syntax check.

Eclipse will now stop reporting errors for any JSP file included in this folder. You could use the same approach for individual files , but how practical it will be again depends on the number of fragments that you have.
References:
How to avoid Java code in JSP files?