You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <hu...@apache.org> on 2002/09/03 14:56:19 UTC

[Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

The Struts framework ensures that we can perform data validation without 
the benefit if JavaScript. But that doesn't mean we can't use JavaScript 
in our Struts applications. Most web developers rely on JavaScript to 
provide core features on the presentation layer, and Struts developers 
are no exception.

For more see <http://husted.com/struts/tips/010.html>


-- Ted Husted, Husted dot Com, Fairport NY US
-- co-author, Java Web Development with Struts
-- Order it today:
-- http://husted.com/struts/book.html



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by Mark Nichols <dh...@hotmail.com>.
That's because the actual link is: http://husted.com/struts/tips/010.htm

(Note the .htm, not .html extension.)

/\/\ark

----- Original Message -----
From: "Rob Leland" <rl...@apache.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, September 03, 2002 8:14 AM
Subject: Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic
JavaScripts


> Ted Husted wrote:
> >
> > For more see <http://husted.com/struts/tips/010.html>
>
> Ted,
>   I got File not found 404 when clicking on this link.
>
> -Rob
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by Melissa L Kelley <st...@stuology.net>.
On Tue, 3 Sep 2002, Rob Leland wrote:

Try this link:

http://husted.com/struts/tips/010.htm



> Ted Husted wrote:
> >
> > For more see <http://husted.com/struts/tips/010.html>
>
> Ted,
>   I got File not found 404 when clicking on this link.
>
> -Rob
>


--> stu: www.stuology.net
It just no longer is plain simple safe fun
when it's the psycho chimp that has the ray gun
------------------------------------------------
Stuology -- A million monkeys can't be wrong


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by Rob Leland <rl...@apache.org>.
Ted Husted wrote:
> 
> For more see <http://husted.com/struts/tips/010.html>

Ted,
  I got File not found 404 when clicking on this link.

-Rob


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by cf...@kensfoods.com.
Duh. (forehead slap)
That'll teach me to not read the whole question
so that I can answer first and save the day.



> Ted Husted said...

>The JavaScript is rendered by the client after the HTML page leaves the
>server and goes over the wire. So, no that can't work.
>
>Whatever properties are needed for a tag should come with a JavaBean
>associated with the tag or from a custom subclass. There are already
>getters and setters for each of these handlers in the BaseHandlerTag. So
>you could override these with a tag of your own to get whatever you need
>from whereever you need.
>
>-Ted.
>
>Ravi Kora wrote:
>
>> My actual intention was to question if we can use dynamic scriplets in
>> Struts tags like the following
>> <html:text name="txt" value="<bean:write> name="itemForm"
>> property="item"/>" onBlur='javascript:doItem(<bean:write>
>> name="itemForm" property="item"/>)'>
>>
>> Will the expression in the Value attribute evaluate at run time like a
>> scriplet expression in JSP?
>>
>>
>> Thanks & Regards,
>> Ravi Kora
>> kora@louisiana.edu
>> 337-739-3434(M)
>>
>
>
>--
>Ted Husted, Husted dot Com, Fairport NY US
>co-Aauthor, Java Web Development with Struts
>Order it today:
>http://husted.com/struts/book.html
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by Ted Husted <hu...@apache.org>.
The JavaScript is rendered by the client after the HTML page leaves the 
server and goes over the wire. So, no that can't work.

Whatever properties are needed for a tag should come with a JavaBean 
associated with the tag or from a custom subclass. There are already 
getters and setters for each of these handlers in the BaseHandlerTag. So 
you could override these with a tag of your own to get whatever you need 
from whereever you need.

-Ted.

Ravi Kora wrote:

> My actual intention was to question if we can use dynamic scriplets in
> Struts tags like the following
> <html:text name="txt" value="<bean:write> name="itemForm"
> property="item"/>" onBlur='javascript:doItem(<bean:write>
> name="itemForm" property="item"/>)'>
> 
> Will the expression in the Value attribute evaluate at run time like a
> scriplet expression in JSP?
> 
> 
> Thanks & Regards,
> Ravi Kora
> kora@louisiana.edu
> 337-739-3434(M) 
> 


-- 
Ted Husted, Husted dot Com, Fairport NY US
co-Aauthor, Java Web Development with Struts
Order it today:
http://husted.com/struts/book.html


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by cf...@kensfoods.com.
This will work:

<bean:define id="item" name="itemForm" property="item"/>
<html:text property="item" onBlur="<%="doItem(" + item + ")"%>"/>


Casey



> Ravi Kora said...

>My actual intention was to question if we can use dynamic scriplets in
>Struts tags like the following
><html:text name="txt" value="<bean:write> name="itemForm"
>property="item"/>" onBlur='javascript:doItem(<bean:write>
>name="itemForm" property="item"/>)'>
>
>Will the expression in the Value attribute evaluate at run time like a
>scriplet expression in JSP?
>
>
>Thanks & Regards,
>Ravi Kora
>kora@louisiana.edu
>337-739-3434(M)
>
>-----Original Message-----
>From: Ted Husted [mailto:husted@apache.org]
>Sent: Tuesday, September 03, 2002 11:19 AM
>To: Struts Users Mailing List
>Subject: Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic
>JavaScripts
>
>
>The purpose of the Struts HTML link tag is to render the href attribute
>from an ActionForward path OR as context-relative reference to a page in
>
>your application, and to URL-encode either along the way.
>
>What would be the benefit of using a HTML link tag here?
>
>-Ted.
>
>Ravi Kora wrote:
>
>> Ted,
>> In your example, you have the following html tag
>> <a href='javascript:doItem(<bean:write name="itemForm"
>> property="item"/>)'>
>>
>> Is there a way to have this as struts tag and still have the dynamic
>> part in it like this? <html:link href='javascript:doItem(<bean:write
>> name="itemForm" property="item"/>)'>
>>
>> Will the above work?
>>
>> Thanks & Regards,
>> Ravi Kora
>> kora@louisiana.edu
>> 337-739-3434(M)
>>
>> -----Original Message-----
>> From: Ted Husted [mailto:husted@apache.org]
>> Sent: Tuesday, September 03, 2002 8:56 AM
>> To: struts-user@jakarta.apache.org
>> Subject: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic
>> JavaScripts
>>
>>
>> The Struts framework ensures that we can perform data validation
>> without
>>
>> the benefit if JavaScript. But that doesn't mean we can't use
>> JavaScript
>>
>> in our Struts applications. Most web developers rely on JavaScript to
>> provide core features on the presentation layer, and Struts developers
>
>> are no exception.
>>
>> For more see <http://husted.com/struts/tips/010.html>
>>
>>
>> -- Ted Husted, Husted dot Com, Fairport NY US
>> -- co-author, Java Web Development with Struts
>> -- Order it today:
>> -- http://husted.com/struts/book.html
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>>
>> --
>> To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by Ravi Kora <rk...@1bigthink.com>.
My actual intention was to question if we can use dynamic scriplets in
Struts tags like the following
<html:text name="txt" value="<bean:write> name="itemForm"
property="item"/>" onBlur='javascript:doItem(<bean:write>
name="itemForm" property="item"/>)'>

Will the expression in the Value attribute evaluate at run time like a
scriplet expression in JSP?


Thanks & Regards,
Ravi Kora
kora@louisiana.edu
337-739-3434(M) 

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org] 
Sent: Tuesday, September 03, 2002 11:19 AM
To: Struts Users Mailing List
Subject: Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic
JavaScripts


The purpose of the Struts HTML link tag is to render the href attribute 
from an ActionForward path OR as context-relative reference to a page in

your application, and to URL-encode either along the way.

What would be the benefit of using a HTML link tag here?

-Ted.

Ravi Kora wrote:

> Ted,
> In your example, you have the following html tag
> <a href='javascript:doItem(<bean:write name="itemForm" 
> property="item"/>)'>
> 
> Is there a way to have this as struts tag and still have the dynamic 
> part in it like this? <html:link href='javascript:doItem(<bean:write 
> name="itemForm" property="item"/>)'>
> 
> Will the above work?
> 
> Thanks & Regards,
> Ravi Kora
> kora@louisiana.edu
> 337-739-3434(M)
> 
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: Tuesday, September 03, 2002 8:56 AM
> To: struts-user@jakarta.apache.org
> Subject: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic
> JavaScripts
> 
> 
> The Struts framework ensures that we can perform data validation 
> without
> 
> the benefit if JavaScript. But that doesn't mean we can't use 
> JavaScript
> 
> in our Struts applications. Most web developers rely on JavaScript to
> provide core features on the presentation layer, and Struts developers

> are no exception.
> 
> For more see <http://husted.com/struts/tips/010.html>
> 
> 
> -- Ted Husted, Husted dot Com, Fairport NY US
> -- co-author, Java Web Development with Struts
> -- Order it today:
> -- http://husted.com/struts/book.html
> 
> 
> 
> --
> To unsubscribe, e-mail: 
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by Ted Husted <hu...@apache.org>.
The purpose of the Struts HTML link tag is to render the href attribute 
from an ActionForward path OR as context-relative reference to a page in 
your application, and to URL-encode either along the way.

What would be the benefit of using a HTML link tag here?

-Ted.

Ravi Kora wrote:

> Ted,
> In your example, you have the following html tag
> <a href='javascript:doItem(<bean:write name="itemForm"
> property="item"/>)'>
> 
> Is there a way to have this as struts tag and still have the dynamic
> part in it like this?
> <html:link href='javascript:doItem(<bean:write name="itemForm"
> property="item"/>)'>
> 
> Will the above work?
> 
> Thanks & Regards,
> Ravi Kora
> kora@louisiana.edu
> 337-739-3434(M) 
> 
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org] 
> Sent: Tuesday, September 03, 2002 8:56 AM
> To: struts-user@jakarta.apache.org
> Subject: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic
> JavaScripts
> 
> 
> The Struts framework ensures that we can perform data validation without
> 
> the benefit if JavaScript. But that doesn't mean we can't use JavaScript
> 
> in our Struts applications. Most web developers rely on JavaScript to 
> provide core features on the presentation layer, and Struts developers 
> are no exception.
> 
> For more see <http://husted.com/struts/tips/010.html>
> 
> 
> -- Ted Husted, Husted dot Com, Fairport NY US
> -- co-author, Java Web Development with Struts
> -- Order it today:
> -- http://husted.com/struts/book.html
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic JavaScripts

Posted by Ravi Kora <rk...@1bigthink.com>.
Ted,
In your example, you have the following html tag
<a href='javascript:doItem(<bean:write name="itemForm"
property="item"/>)'>

Is there a way to have this as struts tag and still have the dynamic
part in it like this?
<html:link href='javascript:doItem(<bean:write name="itemForm"
property="item"/>)'>

Will the above work?

Thanks & Regards,
Ravi Kora
kora@louisiana.edu
337-739-3434(M) 

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org] 
Sent: Tuesday, September 03, 2002 8:56 AM
To: struts-user@jakarta.apache.org
Subject: [Struts Tip] # 10 Use Struts JSP Tags to create dynamic
JavaScripts


The Struts framework ensures that we can perform data validation without

the benefit if JavaScript. But that doesn't mean we can't use JavaScript

in our Struts applications. Most web developers rely on JavaScript to 
provide core features on the presentation layer, and Struts developers 
are no exception.

For more see <http://husted.com/struts/tips/010.html>


-- Ted Husted, Husted dot Com, Fairport NY US
-- co-author, Java Web Development with Struts
-- Order it today:
-- http://husted.com/struts/book.html



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>