For Programmers: Free Programming Magazines  


Home > Archive > Java Help > April 2005 > JSTL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author JSTL
Julien Mérivaux

2005-04-25, 8:59 am

hi my lordz,

Im learning JSP/JSTL and i want to do something like that :

<c:set var="name1" value="value1" scope="page" />
<c:out value='${pageScope.name1}' />

<form name="formulaire"
action="http://localhost:8080/ThirdApplication/index.jsp" method="get">
<input type="submit" value="Add" onclick=" <c:set var="name1"
value="value1Changed" scope="page" /> ">
</form>

<c:set var="name1" value="value1" scope="page" />
<c:out value='${pageScope.name1}' />

I want to know if it is possible to emmebed a JSTL command into an "onclick"
event to change the value of a variable ?

Thanks by advance and best regards.


Brian Munroe

2005-04-26, 8:58 pm

Julien M=E9rivaux wrote:

>
> I want to know if it is possible to emmebed a JSTL
> command into an "onclick" event to change the value
> of a variable ?
>


So if I understand what you are asking, when you click the button, you
want an Expression Language variable to change?

The short answer is, no. See, think of the JSTL tags as being server
side variables and events, while the onClick event is client side.

If you view the source of your page, you'll find that all the <c: />
ELs have been converted into their corresponding text/html,

Without going into too much detail, you would use JavaScript to
manipulate the client side variables and to drive the html events such
as onClick.

-- brian

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com