This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSP and the fly likes Determine included JSP page name and load JSP into specified section using jQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Determine included JSP page name and load JSP into specified section using jQuery" Watch "Determine included JSP page name and load JSP into specified section using jQuery" New topic
Author

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

Alex Tom
Greenhorn

Joined: Apr 15, 2013
Posts: 4
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]

 
GeeCON Prague 2014
 
subject: Determine included JSP page name and load JSP into specified section using jQuery