Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Determine included JSP page name and load JSP into specified section using jQuery  RSS feed

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I'm working on a web projects, but now i encounter this problem.

My main page main.jsp includes several different pages to make it up (please see the attachment).

when i click a item resides in the MENU, I use jQuery to load specified page into CONTENT:
partial code segment of menu.jsp:

Now the question is, i want to show "current location" in NAVIGATION, e.g, "current location: Main Page", "current location: Main >> User Mgmt >> Add User";
the concatenated string "Main Page" or "Main >> User Mgmt >> Add User" is dynamically determined by looking up a Map<page url, concatenated string>,
so I must get the page url loaded into CONTENT('#content'), which is part of the main page main.jsp.

How to get my job done?

THEN, the next question is as follows.
when i loaded a page, e.g., adduser.jsp, into CONTENT, and I submit it using jQuery, it doesn't work(and no any alert message occurs):
code segment from adduser.jsp(the form's id is 'auform'):

as the code illustrates, load the same page into original location CONTENT ('#content') when submit successfully.
but now, it redirect to content.jsp, which is included into main.jsp at startup.
and i notify the "url addr" of the submit button of adduser.jsp is exactly "main.jsp", why?

upon login, in my servlet code, i use the following code to "redirect" to my main page:

the reason I use this method is that if i use request.getRequestDispatcher("main.jsp").forward(request, response);,
the url in the browser's address bar is http://xxxxx/UserServlet?action=login .
in my login.jsp, the form's post action is "action="UserServlet?action=login""...

so are these phenomena related? Thanks in advance, and sorry for my poor English.
[Thumbnail for main.png]
main page frame
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!