Re: struts and javascript

2006-04-14 Thread 王曾wang_zeng


this is wrong. because as far as I know, a struts tag's atrribute sholud not
be filled with mixed stuff by jsp codes and plain text.

if you write this way:
" >

I guess  the error won't occur.


Re: struts and javascript

2006-04-13 Thread Frank W. Zammetti
On Thu, April 13, 2006 12:26 pm, Michael Jouravlev said:
> Or generate the target location in JSP like this:
>
> 
>   var mytarget = 
> 

That's a good option too.

> Then look up for target in your main Javascript function. I guess it
> would be easier to "attach" target to some well-know object like
> window, for example:   window.mytarget =  action="/PrepareSchedule.do"/>

FYI, I have experienced some problems with custom attributes on objects in
some browsers.  I suggest always using setAttribute()/getAttribute when
working with custom attributes.  Seems to be more cross-browser-friendly
at this point.

Frank

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: struts and javascript

2006-04-13 Thread Michael Jouravlev
Or generate the target location in JSP like this:


  var mytarget = 


Then look up for target in your main Javascript function. I guess it
would be easier to "attach" target to some well-know object like
window, for example:   window.mytarget = 

I am not a Javascript pro, but you get the idea.

On 4/13/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> The JS file is retrieved by the browser after the page loads and is not 
> processed on the server, so the  tag will not be interpreted.
>
> Either leave the script in the JSP as you mentioned, or include it in the JSP 
> via server-side JSP include, or configure you web/app server to run .js files 
> through the JSP processor.
>
> Frank
>
> -Original Message-
> From: "fea jabi" <[EMAIL PROTECTED]>
> To: user@struts.apache.org
> Sent: 4/13/06 9:14 AM
> Subject: struts and javascript
>
> In a JS file I created a function as below.
>
> function showPopup(htmlRewrite) {
> var w = 480, h = 340;
>
> if (document.all || document.layers) {
> w = screen.availWidth;
> h = screen.availHeight;
> }
>
> var popW = 200, popH = 100;
> var leftPos = (w-popW)/2, topPos = (h-popH)/2;
>
> window.open( 'htmlRewrite', "", "resizable, toolbar=yes, statusbar=yes,
> menubar=yes, status=yes, location=yes, scrollbars=yes", 'width=' + popW +
> ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
> }
>
> But getting error at the select statement below. how to call the above
> function??
>
>  onchange='showPopup("");'>
> 
> 
>
> *
>
> Was working fine when I had the js function in the jsp itself. i.e it was
> working fine with below code
>
> function showPopup() {
> var w = 480, h = 340;
>
> if (document.all || document.layers) {
> w = screen.availWidth;
> h = screen.availHeight;
> }
>
> var popW = 200, popH = 100;
> var leftPos = (w-popW)/2, topPos = (h-popH)/2;
>
> window.open('', "", "resizable,
> toolbar=yes, statusbar=yes, menubar=yes, status=yes, location=yes,
> scrollbars=yes", 'width=' + popW + ',height=' + popH + ',top=' + topPos +
> ',left=' + leftPos);
> }
> 
>
>
>
> 
> 
> 
>
>
> But now trying to have a common function in the js file and pass an argument
> for the url it has to go to.
>
> what's is the right way of doing this?
>
> Thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: struts and javascript

2006-04-13 Thread Frank W. Zammetti
The JS file is retrieved by the browser after the page loads and is not 
processed on the server, so the  tag will not be interpreted.

Either leave the script in the JSP as you mentioned, or include it in the JSP 
via server-side JSP include, or configure you web/app server to run .js files 
through the JSP processor.

Frank

-Original Message-
From: "fea jabi" <[EMAIL PROTECTED]>
To: user@struts.apache.org
Sent: 4/13/06 9:14 AM
Subject: struts and javascript

In a JS file I created a function as below.

function showPopup(htmlRewrite) {
var w = 480, h = 340;

if (document.all || document.layers) {
w = screen.availWidth;
h = screen.availHeight;
}

var popW = 200, popH = 100;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;

window.open( 'htmlRewrite', "", "resizable, toolbar=yes, statusbar=yes, 
menubar=yes, status=yes, location=yes, scrollbars=yes", 'width=' + popW + 
',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
}

But getting error at the select statement below. how to call the above 
function??





*

Was working fine when I had the js function in the jsp itself. i.e it was 
working fine with below code

function showPopup() {
var w = 480, h = 340;

if (document.all || document.layers) {
w = screen.availWidth;
h = screen.availHeight;
}

var popW = 200, popH = 100;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;

window.open('', "", "resizable, 
toolbar=yes, statusbar=yes, menubar=yes, status=yes, location=yes, 
scrollbars=yes", 'width=' + popW + ',height=' + popH + ',top=' + topPos + 
',left=' + leftPos);
}









But now trying to have a common function in the js file and pass an argument 
for the url it has to go to.

what's is the right way of doing this?

Thanks.

_
Is your PC infected? Get a FREE online computer virus scan from McAfee 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[OT] Re: struts and javascript

2005-12-14 Thread Dave Newton

fea jabi wrote:

In my JSP, have to use the defined variable in javascript. How can I 
use it?

var totalObj = document.getElementById("total");


Wow, that's so far off I'm not even sure where to start. Marked OT 
because this has more to do with a fundamental misunderstanding of how 
webapps work than anything struts-ish.


JavaScript is run client-side, Struts tags (or any other, for that 
matter) are run server-side. This sounds familiar; did we have a go at 
this once before?


You _could_ do something like (syntax probably wrong; working with other 
technology today):


var total = ;
total += whatever;

and then reference 'total' with a javascript chunk or via any number of 
element replacement techniques on the page.


Does that help?

Dave



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]