wood burning stoves 2.0*
The moose likes JSP and the fly likes javascript called within JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "javascript called within JSP" Watch "javascript called within JSP" New topic
Author

javascript called within JSP

Mark Moore
Greenhorn

Joined: Feb 21, 2006
Posts: 15
I want to test if user is logged in or logged out and put the logic on the header of my static html page (tomcat, apache)

I would put .js code like this in my html
document.getElementById("test").innerHTML= '<a href="/login.jsp>Login</a>
And if user is logged in then put link to LOGOUT dynamicaly.

I am using JSP page to check for logic login/logout:
<c:if test="${!empty user}">
<p><a href="/logout">Logout</a>

How do I call the javascript from this JSP page to display on my html page this logic.

the html pages must stay static and I can't use jsp on them

[ March 14, 2006: Message edited by: Mark Moore ]

[ March 14, 2006: Message edited by: Mark Moore ]
[ March 14, 2006: Message edited by: Mark Moore ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

I've read your question 4 times and I still can't make heads or tails out of it. You talk about a JSP page, and then about an HTML page that can't be JSP. Which is it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

And, since is not a servlets question, moved to the JSP forum.
Mark Moore
Greenhorn

Joined: Feb 21, 2006
Posts: 15
Ok, thx for checking,
basically:
jsp page calls javascript that displays on html page dynamicaly link to login or logout.

My question is how to do interact jsp with javascript to display onto html
I understand the jsp logic and the javascript logic on their own
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Sorry, still not getting it. Your latest message is even briefer and more cryptic than the first. I was looking for elaboration.

As a general statement, there is no collaboration between JSP, which operates on the server in order to send an HTML page to the client, and Javascript that executes in the context of the client.
[ March 14, 2006: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript called within JSP
 
Similar Threads
Directing login errors to form-login-page -- spurious login error message
Killing a session in a servlet!!
login/logout link
logout..
Windows XP Popup blocking