NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

allocate java value to javascript value in portlet

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
Nicolas74



Joined: 07 Jan 2010
Posts: 8

PostPosted: Fri Feb 26, 2010 3:59 pm    Post subject: allocate java value to javascript value in portlet Reply with quote

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.





PostPosted: Sat Feb 27, 2010 3:01 am    Post subject: Re: allocate java value to javascript value in portlet Reply with quote

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

PostPosted: Sat Feb 27, 2010 9:15 pm    Post subject: Reply with quote

Thanks Daoud Wink

It works Smile

Best,

Nicolas
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo