• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

%@ include and Javascript

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, everything looks fine. I'll keep playing around with it.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds odd. Have you tried it in other browsers just as a reference?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was trying the same !!
I tried changing the button name to "btnLogin" and it worked...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic