0

I have this code for my table :

##
<tr ng-repeat="elt in tabDemandes">
  <td>{{elt.id}}</td>
  <td>{{elt.name}}</td>

  <portlet:renderURL var="maj">
    <portlet:param name="action" value="maj"/>
    <portlet:param name="idD" value="elt.id"/>
 </portlet:renderURL> 
</tr>
##

I want recover a value of my param "idD" in my controller but it take elt.id as a value of a param and he give me error

can someone help me ?

mariame
  • 41
  • 5

2 Answers2

0

To have access to the idD in your controller just set a $scope that can hold it. Angularjs is built with 2-way data-binding in mind so really what this lets you do is make changes in the view that will go to the controller as well as changes in the controller being pushed out to the view.

In your case just make sure you are storing the idD as an ng-modle that links back to a scope you declared in the controller. Once you have that linked correctly you can get the idD in your controller no problem.

Joe Lloyd
  • 19,471
  • 7
  • 53
  • 81
  • ok I know what you are means, but i can't add $ because i have a table and i loop on the elements of my table. You inderstand me? thank you so much for your answer – mariame Aug 13 '15 at 08:47
0

Obviously, the difference is that the JSTL taglib (<portlet:renderUR>L) runs on the server, while AngularJS and the ng-repeat runs on the client. At the moment AngularJS is looping over your content, the URL has already been rendered.

For more information about the differences of server- and clientside, look at this answer: What is the difference between client-side and server-side programming?

What we did was quite simple, we attached the URLs to our model (in your case tabDemandes). This is an example we used for creating an action URL with the ID as a parameter:

PortletURL detailURL = response.createActionURL();
detailURL.setParameter(ActionRequest.ACTION_NAME, "detailTask");
detailURL.setParameter("id", Long.toString(task.getId());
task.setDetailURL(detailURL.toString());

In this case we were using a list of tasks, and we used this action URL to open a detailed page of the task, so we had to pass the ID to the action URL. In stead of using the JSTL taglib we used the Java API.

In your case you'll probably need to use response.createRenderURL().

Community
  • 1
  • 1
g00glen00b
  • 41,995
  • 13
  • 95
  • 133
  • @mariame no problem, if you have any other questions feel free to ask them. – g00glen00b Aug 12 '15 at 12:54
  • ok :) So i have a problem with websphere portal and i see that you have an experience as me, because I am just beginer. My problem that i can't recover values sending in my url in my page jsp at a controler, I recover just a null values even if there are sending. – mariame Aug 12 '15 at 16:03
  • and if you can help me with a documentation about websphere portal 8.0 or 8.5 if it's possible because realy i need some one help me in my project, and i don't find in net a easy documentation and i don't have enough time. thank you so much – mariame Aug 12 '15 at 16:08
  • i have the same problem that this http://stackoverflow.com/questions/8096725/get-parameters-from-url-under-portal-enviroment-on-wps7 – mariame Aug 12 '15 at 16:21
  • If you need to send normal query parameters to your portlet, you should rather go for a resource request (look for `@ResourceMapping` in the Spring docs). – g00glen00b Aug 12 '15 at 18:04