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

%@ include and Javascript

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is going to sound like a Javascript question but I honestly believe this has something to do with the <%@ include rather than pure javascript, so bare (no pun intended) with me.

I'm trying something a bit different and just doing some general testing on an idea. But basically I am going to have a login form on every page that doesn't specifically require a login, but will unlock more features once the user logs in. I place all my JSP's under the WEB-INF folder. I have the following code:



My login jsp is simple:



Now what is happening is when I click the Login button, Firebug complains that login() is not a function. I have login defined in an included JS file. However, if I type login() at the Firebug console, the function is fond and fired.

Does this have to do with the way I am including the JSP (at compile time)? Is there something I can change to make this work? Thanks.

[ March 27, 2007: Message edited by: Gregg Bolinger ]
[ March 27, 2007: Message edited by: Gregg Bolinger ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:
Does this have to do with the way I am including the JSP (at compile time)?


No, that cannot be the problem. The response is assembled on the server and sent to the browser as a "normal" HTML document. The included-ness of the fragment is not relevant.
[ March 27, 2007: Message edited by: Bear Bibeault ]
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think either that the problem is related to the way JSP is included.
Once the html has been generated, try to check ("view source") that you don't have any html inconsistencies.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, everything looks fine. I'll keep playing around with it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds odd. Have you tried it in other browsers just as a reference?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the function name from login() to doLogin(). After that is started working. I changed it back to login() and it stopped working again. No clue. Just tried in FF as I am on Linux.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying the same !!
I tried changing the button name to "btnLogin" and it worked...
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the DOM, the button called "login" is an Object with a constructor named login(). That must be the problem.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Satou kurinosuke:
Looking at the DOM, the button called "login" is an Object with a constructor named login(). That must be the problem.


Good call. I am moving this to the Javascript forum for others to laugh at me.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic