You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Tomba Rakesh <to...@yahoo.com> on 2005/08/19 09:27:31 UTC

portlet-selector.vm [INFO: Velocity [warn] Warning!] Message

Hi All
 
I have implement portlet selector and put into my application.
 
Code for "user-portlet-selector.vm" is enclosed below.
 
All related files are used psml,PortletSelector.java, velocity jar files etc...
 
When user click on "select" link to pop up the portlet selector window, warning message is displayed at log file. Portlet selector is working fine only problem is throwing warning message at log file.
 
INFO:  Velocity   [info] ResourceManager : found /WEB-INF/view/selectors/user-portlet-selector.vm with loader org.apache.velocity.tools.view.servlet.WebappLoader
Aug 19, 2005 12:06:42 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity   [warn] Warning! The iterative  is an Iterator in the #foreach() loop at [0,0] in template /WEB-INF/view/selectors/user-portlet-selector.vm. Because it's not resetable, if used in more than once, this may lead to unexpected results.
 
How to handle this warning message?
 
 
This portlet selector displays only those portlets that does not contained in the page. When user click on "select" button we refresh the portlet by submiting the following form
 
    <form name="refreshForm" action="$renderResponse.createActionURL()" method="post" >
           <input type='hidden' name='db.browser.action' value='refresh'/>
    </form>

 
 
Thanks in advance....

Regards
Rakesh
 
 
 
Code for "user-portlet-selector.vm"
-------------------------------------------------------------------------------------------------------------
<script language="JavaScript" type="text/javascript">
    <!--
    function select(value)
    {
        var openerForm = opener.document.forms['portletform'];
        var openerEl = openerForm.elements['portlets'];
        window.close();
    }
 function rowHover(row)
 {
     row.oldClassName = row.className;
     row.className = 'jetdbLight';
     row.onmouseout = function()
     {
         this.className = this.oldClassName;
     }
 }    
 function sendChecks(form)
        {
            var count=$tableSize;
            for(var j = 0; j < form.length; j++)
            {
                 var f = form.elements[j];
                 if (f.type == "checkbox")
                 {
                   if (f.checked == false)
                   {
                     count=count-1;
                   }
                 }
            }
            if(count==0)
            {
   alert("Please Select a Portlet");
          exit();
            }
            else
            {
//original code
                 var result = "";
                 for(var i = 0; i < form.length; i++)
                 {
                           var e = form.elements[i];
                           if (e.type == "checkbox")
                           {
                               if (e.checked == true)
                               {
                                       result = result + "," + e.name;
                               }
                           }
                 }
         var openerForm = opener.document.forms['portletform'];
  var openerEl = openerForm.elements['portlets'];
         openerEl.value = result;
         window.close();
         openerForm.submit();         
            }
  //original code
            }
    //-->
</script>
#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
#if($tableSize == 0) <!-- if condition when there is no portlet -->
<table border="0" width="505">
<tr>
<td colspan="3" class="jetdbHeadNoLink" height="25">
   <center><strong>Add Portlet(s) to the Dashboard page</strong></center>
   </td>
<tr>
 <td class="jetdbEven" height="230" align="center" valign="middle" >
        <strong>No Portlets to Add</strong>
      </td>
      </tr>
  </table>
 
<table cellpadding="2" cellspacing="2">
<tr>
<td>
<form name='userform' onSubmit='sendChecks(this)'/>
 <input type="hidden" name="clickSelectPortlet" value="Y" />
  <input type='hidden' name='searchColumn' value='1'/>
 </form>
</td>
</tr></table>
<table><tr>
<td valign="middle">
        <div align="center">
    <form name="refreshForm" action="$renderResponse.createActionURL()" method="post" >
           <input type='hidden' name='db.browser.action' value='refresh'/>
          </form>
        </div>
      </td></tr></table>
 
#else <!-- else part if there are some portlets to add -->

<form name='userform' onSubmit='sendChecks(this)'/>
<table cellpadding="2" cellspacing="1" border="0" width='100%'>
<tr>
<td>
<table cellpadding="0" cellspacing="1" border="0" width="500" >
  
  <tr>
   <td colspan="3" class="jetdbHeadNoLink" height="25">
   <strong>Add Portlet(s) to the Dashboard page</strong>
   </td>
  </tr>
  <tr height="25">
    #foreach ($column in $title)    
      <td align='left' class="jetdbHeadNoLink" nowrap>
       <strong>$column</strong>
      </td>
    #end
      <th class="jetdbHeadNoLink" width="10" width="45"><strong>Select</strong></th>        
  </tr>
  #foreach ( $portlet in $table )
  <tr>
    #if ($velocityCount % 2 == 0)
       #set($rowstyle = "jetdbEven")
    #else
       #set($rowstyle = "jetdbOdd")
    #end   
      <td class="$rowstyle" width="40%" onmouseover="rowHover(this)">
        <div align="left">$!portlet.DisplayName</div>
      </td>
      <td class="$rowstyle" width="55%" onmouseover="rowHover(this)">
        <div align="left">$!portlet.Description</div>
      </td>      
   <td class="$rowstyle" width="50">
       <input type="checkbox" name="box_$portlet.Name"/>
   </td>   
   </tr>
#end
 
</table>
<table cellpadding="2" cellspacing="2">
<tr>
<td>
 <input type="hidden" name="clickSelectPortlet" value="Y" />
 <input type="submit" name="select.portlets" value="Save" class="jetdbButton"  />
 <input type='hidden' name='searchColumn' value='1'/>    
</td>
</tr></table>
 
</form>
</tr>
</td>
</table>
<!-- controls -->
<table width="200" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
      <td valign="middle">
        <div align="center">
    <form name="refreshForm" action="$renderResponse.createActionURL()" method="post" >
           <input type='hidden' name='db.browser.action' value='refresh'/>
          </form>
        </div>
      </td>
         
  </tr>
</table>
#end <!-- End of if for condition when no portlets -->

		
---------------------------------
Do you Yahoo!?
 Read only the mail you want - Yahoo! Mail SpamGuard.

Re: portlet-selector.vm [INFO: Velocity [warn] Warning!] Message

Posted by Tomba Rakesh <to...@yahoo.com>.
Hi David
 
Thanks a lot... for your quick response.
 
I did same as you suggest and it works. But I would like to have a clarification if I comment this debug log, will it harm at latter stage.
 
Regards
Rakesh

David Sean Taylor <da...@bluesunrise.com> wrote:
Tomba Rakesh wrote:
> INFO: Velocity [info] ResourceManager : found /WEB-INF/view/selectors/user-portlet-selector.vm with loader org.apache.velocity.tools.view.servlet.WebappLoader
> Aug 19, 2005 12:06:42 PM org.apache.catalina.core.ApplicationContext log
> INFO: Velocity [warn] Warning! The iterative is an Iterator in the #foreach() loop at [0,0] in template /WEB-INF/view/selectors/user-portlet-selector.vm. Because it's not resetable, if used in more than once, this may lead to unexpected results.
> 
> How to handle this warning message?
> 
Easy answer: turn off warning level in velocity logging.

It appears they also log a warning whenever an iterator is used in 
#foreach loop. Have a look at the code:

http://mail-archives.apache.org/mod_mbox/jakarta-velocity-dev/200204.mbox/%3C20020421184121.80229.qmail@icarus.apache.org%3E

-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773-4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


		
---------------------------------
 Start your day with Yahoo! - make it your home page 

Re: portlet-selector.vm [INFO: Velocity [warn] Warning!] Message

Posted by David Sean Taylor <da...@bluesunrise.com>.
Tomba Rakesh wrote:
> INFO:  Velocity   [info] ResourceManager : found /WEB-INF/view/selectors/user-portlet-selector.vm with loader org.apache.velocity.tools.view.servlet.WebappLoader
> Aug 19, 2005 12:06:42 PM org.apache.catalina.core.ApplicationContext log
> INFO:  Velocity   [warn] Warning! The iterative  is an Iterator in the #foreach() loop at [0,0] in template /WEB-INF/view/selectors/user-portlet-selector.vm. Because it's not resetable, if used in more than once, this may lead to unexpected results.
>  
> How to handle this warning message?
>  
Easy answer: turn off warning level in velocity logging.

It appears they also log a warning whenever an iterator is used in 
#foreach loop. Have a look at the code:

http://mail-archives.apache.org/mod_mbox/jakarta-velocity-dev/200204.mbox/%3C20020421184121.80229.qmail@icarus.apache.org%3E

-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773-4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org