This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use variable in javascript

 
lijun wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get a variable from request,
String account = (String)portletRequest.getAttribute("acount");
how can i use it in
onclicke=windows.open('myURL&acct=account';return false;

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same way that you would any other JSP variable. Use the scriptlet expression mechanism if using JSP 1.2, and the EL if using JSP 2.0.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well help if you spelled it right and make sure you are using an ? to start a query string and & to concat multiple name/value pairs.

Eric
 
lijun wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onclicke=windows.open('myURL&acct=$account';return false;
I want to use it like this, but it doesn't work!
Thanks for your help!!
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mentioned that you need to use ?, but you are using &.

Eric
 
lijun wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<String test = "1234";<
onClicke="window.open('/sites/apc/index.html?test=$test',
'nameforpop','comma, seperated, values');return false;"
href="/sites/apc/index.html"
target="_blank" open a new pop up window

I get the URL in the new window:
http://localhost:9081/sites/apc/index.html?test=test
but I want the URL:
http://localhost:9081/sites/apc/index.html?test=1234

please help me, thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With scriptlets:


[ May 16, 2006: Message edited by: Ben Souther ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!