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

using html:button with scriptlets

 
Steve Levin
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to open a new browser window when a user clicks on an html:button Like the following:



onclick purposely misspelled

The scriptlet contained in the tag is a dynamic url decided at runtime.
The problem I'm having is that the scriptlet within the javascript part of the tag isn't recognized as a scriptlet. Is there a different way to insert the dynamic url contained in the scriptlet into the javascript within the tag?

Any help is appreciated
Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33700
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,
It looks right the way you have it. From JSP's point of view, there isn't any difference between a scriptlet in a Javascript or Struts tag. You can verify this by placing <%=pdfFile%> elsewhere on the page to see what happens.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64204
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't use a scriptlet as just part of the attribute of a custom action. It must be all of the attribute, or none.
 
Steve Levin
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I can't use a scriptlet as just part of the attribute, then how can I pass in the url contained in the scriptlet to the javascript function. Is there another way?
 
Steve Levin
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind, I figured it out, I just created a String containing the javascript function with the url and then passed in the whole String as the arg to onclic
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64204
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bingo.

This is yet another of the many problems with continuing to use scriptlets in JSP pages.
[ October 22, 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