首页 \ 问答 \ 增量计数器循环(Increment counter with loop)

增量计数器循环(Increment counter with loop)

这个问题与我以前的问题有关:

Jsp迭代槽对象列表

我想插入从我的for循环中从0开始的计数器,我已经尝试了几个组合:

1。

<c:forEach var="tableEntity" items='${requestScope.tables}'>
   <c:forEach var="rowEntity" items='${tableEntity.rows}' varStatus="count">            
        <c:out value="${count}" />
    </c:forEach>
</c:forEach>

2。

<c:set var="count" value="0" scope="page" />
<c:forEach var="tableEntity" items='${requestScope.tables}'>
   <c:forEach var="rowEntity" items='${tableEntity.rows}'>      
   <%=count++%>  
<c:out value="${count}" />
    </c:forEach>
</c:forEach>

第一种方法的问题是外部循环有3个项目,内部循环有7个项目,因此对于每个外部项目,计数从0开始。第二个我得到编译错误。 这基本上是我想要的:

counter = 0;
outer for loop 
    inner for loop 
       counter++;
       //cout/echo/print counter value should start from 0
    end inner loop
end outer loop

我只是不完全熟悉语法。 谢谢


This question is related to my previous question :

Jsp iterate trough object list

I want to insert counter that starts from 0 in my for loop, I've tried several combinations so far :

1.

<c:forEach var="tableEntity" items='${requestScope.tables}'>
   <c:forEach var="rowEntity" items='${tableEntity.rows}' varStatus="count">            
        <c:out value="${count}" />
    </c:forEach>
</c:forEach>

2.

<c:set var="count" value="0" scope="page" />
<c:forEach var="tableEntity" items='${requestScope.tables}'>
   <c:forEach var="rowEntity" items='${tableEntity.rows}'>      
   <%=count++%>  
<c:out value="${count}" />
    </c:forEach>
</c:forEach>

Problem with first approach is that outer loop has 3 items and inner loop has 7 items, so for each outer item the count starts from 0. The second one I get compile error. Here is basically what I want :

counter = 0;
outer for loop 
    inner for loop 
       counter++;
       //cout/echo/print counter value should start from 0
    end inner loop
end outer loop

I'm just not totally familiar with the syntax. thank you


原文:https://stackoverflow.com/questions/4862605
更新时间:2023-05-07 12:05

最满意答案

为了达到这个目的,你可以对你的SharePoint URL执行一个Web请求,然后捕获一个主机头。

有一个名为MicrosoftSharePointTeamServices的主机标题,它将为您提供SharePoint版本。

见下文:

using System;
using System.Net;

class C {
  static void Main(string[] args) {
    var uri = new Uri(args[0]);
    var wc = new WebClient();
    wc.UseDefaultCredentials = true;
    wc.DownloadString(uri);
    var sharePointVersion = wc.ResponseHeaders["MicrosoftSharePointTeamServices"];
    Console.WriteLine(sharePointVersion);
  }
}

然后将您的SharePointVersion与以下列表进行比较:

12.0.0.6535 MOSS 20071或WSS 3.0 SP2 + 2009年12月累计更新(KB960010 + KB960011)

12.0.0.6524 MOSS 20071或WSS 3.0 SP2 + 12月15日更新(KB977027 + KB977026)

12.0.0.6520 MOSS 20071或WSS 3.0 SP2 + 2009年10月累计更新(KB974989 + KB974988)

12.0.0.6514 MOSS 20071或WSS 3.0 SP2 + 2009年8月累计更新(KB973400 + KB973399)

12.0.0.6510 MOSS 20071或WSS 3.0 SP2 + 2009年6月累计更新(KB971538 + KB971537)

12.0.0.6504 MOSS 20071或WSS 3.0 SP2 + 2009年4月累计更新(KB968850 + KB968851)

12.0.0.6421 MOSS 20071或WSS 3.0 SP2(KB953338 + KB953334)[已更新2009年8月1日:SP2下载现在包含修复激活问题的修补程序(KB971620)更多信息,请访问Microsoft SharePoint团队博客]

12.0.0.6341 MOSS 20071或WSS 3.0 2009年2月累计更新(KB961755 + KB961756)

12.0.0.6335 MOSS 20071或WSS 3.0 2008年12月累计更新(KB960010 + KB960011)

12.0.0.6331 MOSS 20071或WSS 3.0 October 08累积更新(KB957691 + KB957693,KB958567和KB958569)

12.0.0.6327 MOSS 20071或WSS 3.0 08年8月累积更新(KB956056和KB956057)

12.0.0.6318 MOSS 20071或WSS 3.0基础结构更新(KB951695和KB951297)

12.0.0.6303 MOSS 20071或WSS 3.0 SP1后修补程序(KB948945)

12.0.0.6301 MOSS 20071或WSS 3.0 SP1后修补程序(KB941274)

12.0.0.6300 MOSS 20071或WSS 3.0 SP1后修补程序(KB941422)

12.0.0.6219 MOSS 20071或WSS 3.0 SP1

12.0.0.6039 MOSS 20071或WSS 3.0 10月公开更新

12.0.0.6036 MOSS 20071或WSS 3.0 2007年8月24日修复程序包

12.0.0.4518 MOSS 20071或WSS 3.0 RTM

12.0.0.4407 MOSS 20071或WSS 3.0 Beta 2 TR

12.0.0.4017 MOSS 20071或WSS 3.0 Beta 2

12.0.0.3111 Office 12(PDC映像 - pre-beta) - 此版本的Office在“添加/删除程序”对话框中没有支持链接。


To achieve this you can execute a web request to your SharePoint URL and then capture a host header.

There is a host header called MicrosoftSharePointTeamServices that will provide you with the SharePoint version.

See below:

using System;
using System.Net;

class C {
  static void Main(string[] args) {
    var uri = new Uri(args[0]);
    var wc = new WebClient();
    wc.UseDefaultCredentials = true;
    wc.DownloadString(uri);
    var sharePointVersion = wc.ResponseHeaders["MicrosoftSharePointTeamServices"];
    Console.WriteLine(sharePointVersion);
  }
}

Then compare your SharePointVersion with the following list:

12.0.0.6535 MOSS 20071 or WSS 3.0 SP2 + December 09 cumulative Update (KB960010 + KB960011)

12.0.0.6524 MOSS 20071 or WSS 3.0 SP2 + 15th December Update (KB977027 + KB977026)

12.0.0.6520 MOSS 20071 or WSS 3.0 SP2 + October 09 cumulative Update (KB974989 + KB974988)

12.0.0.6514 MOSS 20071 or WSS 3.0 SP2 + August 09 cumulative Update (KB973400 + KB973399)

12.0.0.6510 MOSS 20071 or WSS 3.0 SP2 + June 09 cumulative Update (KB971538 + KB971537)

12.0.0.6504 MOSS 20071 or WSS 3.0 SP2 + April 09 cumulative Update (KB968850 + KB968851)

12.0.0.6421 MOSS 20071 or WSS 3.0 SP2 (KB953338 + KB953334) [Updated 1st Aug 09: SP2 download now includes the hotfix (KB971620) that corrects the activation issue more information on the Microsoft SharePoint team blog]

12.0.0.6341 MOSS 20071 or WSS 3.0 February 09 cumulative Update (KB961755 + KB961756)

12.0.0.6335 MOSS 20071 or WSS 3.0 December 08 cumulative Update (KB960010 + KB960011)

12.0.0.6331 MOSS 20071 or WSS 3.0 October 08 cumulative Update (KB957691 + KB957693,KB958567 and KB958569)

12.0.0.6327 MOSS 20071 or WSS 3.0 August 08 cumulative update (KB956056 & KB956057)

12.0.0.6318 MOSS 20071 or WSS 3.0 Infrastructure Update (KB951695 & KB951297)

12.0.0.6303 MOSS 20071 or WSS 3.0 post-SP1 hotfix (KB948945)

12.0.0.6301 MOSS 20071 or WSS 3.0 post-SP1 hotfix (KB941274)

12.0.0.6300 MOSS 20071 or WSS 3.0 post-SP1 hotfix (KB941422)

12.0.0.6219 MOSS 20071 or WSS 3.0 SP1

12.0.0.6039 MOSS 20071 or WSS 3.0 October public update

12.0.0.6036 MOSS 20071 or WSS 3.0 August 24, 07 hotfix package

12.0.0.4518 MOSS 20071 or WSS 3.0 RTM

12.0.0.4407 MOSS 20071 or WSS 3.0 Beta 2 TR

12.0.0.4017 MOSS 20071 or WSS 3.0 Beta 2

12.0.0.3111 Office 12 (PDC image - pre-beta) - This version of Office does not have a support link in the Add/Remove programs dialog box.

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)