NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Nicolas74
Joined: 07 Jan 2010 Posts: 8
|
Posted: Fri Feb 26, 2010 3:59 pm Post subject: allocate java value to javascript value in portlet |
|
|
Hello,
In a portlet, is it possible to allocate a javascript value to a java value ?
Something like it :
| Code: |
<script language = "Javascript">
var value = "hello";
<% String myString= %> = value;
</script>
|
Thanks
Best, |
|
| Back to top |
|
 |
Daoud AbdelMonem Faleh Posted via mailing list.
|
Posted: Sat Feb 27, 2010 3:01 am Post subject: Re: allocate java value to javascript value in portlet |
|
|
If I understand well you want to assign the value of a java variable
from javascript?
No the value have to be submitted in a form then handled on the server.
With portlet spec this is done this way:
In the jsp page you use the tag <portlet:actionURL> :
<form method="post" action="<portlet:actionURL/>">
<input type="text" name="var"
value="<%=renderRequest.getAttribute("var")%>">
<input type="submit">
</form>
In the prcessAction method of the portlet class you do:
String var = actionRequest.getParameter(var);
HTH,
Daoud AbdelMonem Faleh.
Nicolas74 a |
|
| Back to top |
|
 |
Nicolas74
Joined: 07 Jan 2010 Posts: 8
|
Posted: Sat Feb 27, 2010 9:15 pm Post subject: |
|
|
Thanks Daoud
It works
Best,
Nicolas |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|