<%@ page import="oracle.jsp.webutil.personalization.Item" errorPage="error.jsp" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/personalization.tld" prefix="op" %>
<html>
<head>
<title>Personalization Demo</title>
<meta http-equiv="Expires" content="0">
<meta http-equiv="pragma" content="no-cache">
</head>
<body>
<h2>removeRatingRecord Tag</h2>
<% String mode = request.getParameter("mode");
   String value = request.getParameter("value");
   String pageName = "removeratingrecord.jsp";

   if( "TYPE_ID".equals(mode) ) {
      String itemType = request.getParameter("itemType");
      long itemId = -1;
      try {
         itemId = Long.parseLong(request.getParameter("itemID"));
      } catch(Exception e) {
      }
%>
<op:removeRatingRecord value="<%=value%>" ID="<%=itemId%>" type="<%=itemType%>"/>
Rating has been removed with type and ID!
<% } else if( "LIST_INDEX".equals(mode) ) {
      String itemTypes[] = request.getParameterValues("itemTypes");
      String itemIds[] = request.getParameterValues("itemIDs");
      int index = 0;

      try {
         index = Integer.parseInt(request.getParameter("index"));
      } catch(Exception e) {
      }

      Item[] items = new Item[itemTypes.length];

      for( int i=0; i<items.length; i++) {
         long id = -1;
         try {
            id = Long.parseLong(itemIds[i]);
         } catch(Exception e) {
         }
         items[i] = new Item(itemTypes[i], id);
      }

%>
<op:removeRatingRecord value="<%=value%>" itemList="<%=items%>" index="<%=index%>"/>
Rating has been removed with list and index!
<% } 

   if( mode != null ) {
%>
<hr>
<% } %>

<form action="tagdemodriver.jsp" method="post">
<input type="hidden" name="target" value="Return"/>
<input type="submit" name="Choose another tag" value="Choose another tag"/>
</form>

<%@include file="listform.inc"%>
</body>
</html>
