struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nauke. <>
Subject Re: and JavaScript
Date Fri, 08 Aug 2008 00:12:50 GMT
Hi Dave,

Thanks for replying.
Yeah I declared variables in my JSP file and tried to parse them through as
arguments to the JavaScript function like mentioned.
No matter how I tried to pass those values in as parameters, my JavaScript
function kept treating it as literal text hehe!


<%=String aString = "Hi There!"%>

onclick="return myFunc('<%=aString%>');"

myFunc would print out "<%=aString%>" rather than "Hi There!".

Also tried:


i.e. without the single quotes.

Also tried:


etc etc.

Funny because I've done this in other JSPs.

Yes that underlying fact with client and server side resources.

Ah well ... Thanks again.

On Fri, Aug 8, 2008 at 9:27 AM, Dave Newton <> wrote:

> --- On Thu, 8/7/08, nauke wrote:
> > There must be a more elegant solution than this!
> Not really: you're trying to access server-side resources from the client
> side. If you're not going to run your JavaScript through the JSP processor
> your options are limited, for obvious reasons.
> One solution was already given to you: deal with server-side resources in
> the JSP, use them as arguments to JavaScript functions contained in an
> external JavaScript file, by using custom tags, scriptlets, etc. to set
> parameter values.
> You can also generate JavaScript on the server-side by means other than a
> JSP (FreeMarker, servlet, etc.), or generate JavaScript during the build
> process, or generate the JavaScript at application startup, or use something
> like DWR to access a Java object that loads resources at runtime, or... ad
> nauseum.
> The underlying issue won't go away; there's client-side resources, and
> there's server-side resources. That's one of the many unfortunate natures of
> web applications, AFAICT.
> Dave
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message