Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Navigation System putting two headers in an .html file when fully rendered in the browser.  RSS feed

 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I inherited a navigation system which is like this:

index.jsp
homepage.jsp

When I click on the "view source" in the browser, I get two headers like this:



I know this is not good. I have inherited the nav system from someone else and I have a lot of complicated AJAX and JQuery going on inside my module.

I am not sure how to resolve.

Thanks,
Michele
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look for an "include" statement in one of the pages, probably in index.jsp. It might look like <%@include... or <jsp:include... The file that is being included (I assume homepage.jsp) should be a fragment, that is, it should not contain "head" and "body" tags, the doctype, and all that.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I appreciate the info.

What I need to say is this: I am developing solutions that fit in with a ux/ui template that I did not design, these are in HTML 4.01.

A lot of time to save time I import those html files into my eclipse project just to view the files and then I inspect the elements if I get into trouble with a browser.

I am a little confused because I am working with another developer who said that I need to run the index.jsp file to to get down to my pages. I have never worked this way.

In general, I have never used this code: <jsp:include page="/jsp/blah.jsp"/>

I am wondering is there a best practices for this?

I inherited a design that is a bunch of divs and inside them are these <jsp:include page="/jsp/blah.jsp"/>

I hope I make sense.

Anything that would boil it down for me and help me to conceptualize what is going on would be great.

However, in summary my situation is like this:

1. The other developer made a index.jsp page
2. The other developer made a homepage.jsp page
I have all these other pages that link from the homepage.jsp to other files.

I also should mention that my navigational system is not one that I designed, it is designed by the other developer.

Any insight on how to deal with this would be appreciated.

Thanks,
Michele

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
None of the included files should have a full HTML page within it -- only the parent page. All the included files should create HTML fragments, not pages. Inspect each to see which one contains the faulty markup.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear. I just have one other question. Does this mean all the js and css and jquery needs to be included in the header of the parent .jsp file? And then for example, all there would be is divs for the children pages that get included?

Thanks,
Michele
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, pretty much.

Remember that all this JSP stuff, whether it does from include files or not, is intended to end up generating one HTML page to send as the response.

So the "parent" JSP should set up the HTML page, and the included JSPs would only be contributing parts of the page. That make sense?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!