File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript called within JSP

 
Mark Moore
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, since is not a servlets question, moved to the JSP forum.
 
Mark Moore
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic