Struts升级到2.5.5(从2.5.3开始)(Struts Upgrade to 2.5.5 ( from 2.5.3))
我试图从struts 2版本
2.5.3
升级到2.5.5
......我遇到了一个奇怪的问题。我们有一个标签如下:
<%@tag description="Rensders an ajax link" pageEncoding="UTF-8"%> <%@attribute name="parameters" description="list of parameters that put to this link" type="java.util.HashMap" required="false"%> .............. <c:forEach items="${parameters}" var="p"> <c:param name="${p.key}" value="${p.value}"/> </c:forEach>
我升级时上面的代码抛出异常!
Caused by: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach> at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:274) at org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:238) at org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:155) at javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:256) at org.apache.jsp.tag.web.html.link_tag._jspx_meth_c_005fforEach_005f0(link_tag.java:439) at org.apache.jsp.tag.web.html.link_tag._jspx_meth_c_005furl_005f0(link_tag.java:405) at org.apache.jsp.tag.web.html.link_tag._jspx_meth_sec_005fauthorize_005f0(link_tag.java:366) at org.apache.jsp.tag.web.html.link_tag.doTag(link_tag.java:230)
如您所见,标签是JSTL标签而不是struts!
我使用Tomcat 8.0。 任何意见。
I tried to upgrade from struts 2 version
2.5.3
to2.5.5
... I face an strange issue.We have a tag as below:
<%@tag description="Rensders an ajax link" pageEncoding="UTF-8"%> <%@attribute name="parameters" description="list of parameters that put to this link" type="java.util.HashMap" required="false"%> .............. <c:forEach items="${parameters}" var="p"> <c:param name="${p.key}" value="${p.value}"/> </c:forEach>
The above code throws exception when I upgrade !
Caused by: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach> at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:274) at org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:238) at org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:155) at javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:256) at org.apache.jsp.tag.web.html.link_tag._jspx_meth_c_005fforEach_005f0(link_tag.java:439) at org.apache.jsp.tag.web.html.link_tag._jspx_meth_c_005furl_005f0(link_tag.java:405) at org.apache.jsp.tag.web.html.link_tag._jspx_meth_sec_005fauthorize_005f0(link_tag.java:366) at org.apache.jsp.tag.web.html.link_tag.doTag(link_tag.java:230)
As you see the tag is a JSTL tag not struts !
I use Tomcat 8.0 . Any comments.
原文:
最满意答案
如果从nib加载单元格,请将代码添加到
initWithCoder:
方法。 如果使用-initWithStyle:reuseIdentifier:
创建它-initWithStyle:reuseIdentifier:
将其添加到那里。 基本上,将它添加到您的单元子类的相应init
方法。If your cell is loaded from a nib, add the code to the
initWithCoder:
method. If you create it using-initWithStyle:reuseIdentifier:
add it there. Basically, add it to the appropriateinit
method of your cell subclass.
相关问答
更多-
单独重新加载单元格时,UITableViewCell内容会闪烁(UITableViewCell content flickers while reloading cells individually)[2019-11-13]
我在使用reloadRowsAtIndexPath时也遇到了闪烁UITableViewCell的问题,所以我做的是 - [UIView setAnimationsEnabled:NO]; [self.tableView beginUpdates]; [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] ... -
您将掩码图层帧设置为单元格的帧,该帧位于单元格超级视图的坐标空间中 - UITableView,因此对于所有单元格,但第一个实际掩码帧将位于单元格边界之外。 尝试将掩码帧设置为单元格的边界: maskLayer.frame = self.bounds; You're setting mask layer frame to cell's frame which is in coordinate space of cell's superview - UITableView, so for all cells ...
-
您还要确保在viewDidLoad中的表视图上设置rowHeight : self.tableView.rowHeight = 40.0f; You want to also make sure you set the rowHeight on the table view in viewDidLoad: self.tableView.rowHeight = 40.0f;
-
当你指定UITextViewDelegate ,你告诉编译器你的class符合UITextViewDelegate的规范。 如果class A具有UITextViewDelegate所有需求,并且class B是一个子类,那么它也将具有所有需求。 没有什么会阻止你将任何instance指定为delegate ,所以你仍然必须小心。 When you specify UITextViewDelegate, you're telling the compiler that your class meets th ...
-
我真的不明白你为什么要删除它们......这似乎是一种非常合理的方法: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath static NSString *CellIdentifier = @"StatusCellView"; StatusCellView *cell = [tableView dequeueReusableCellWithIdentif ...
-
UITableViewCell中的UIWebView仅在第一个单元格中完成加载(UIWebView in UITableViewCell only completes load in first cell)[2023-03-17]
首先,删除drawRect中的代码。 这种方法是完全错误的,你在绘图方法中使用业务逻辑。 (执行一次,然后重复使用单元格) 在这里,我向您展示一个解决这个问题的简单方法。 class CellExample: UITableViewCell, UIWebViewDelegate { var accessoryWebView: UIWebView? { return accessoryView as? UIWebView } //If you're dequeuing ... -
您可以在您的单元格子类中使用awakeFromNib 。 当从故事板中的原型创建新的单元格时,将调用此方法,但不会在单元格被重用时创建。 如果你正在使用原型,那么整个if(cell == nil)就会消失,UITableView会在dequeue方法中为你处理所有这些。 You can use awakeFromNib in your cell subclasses. This will be called when a new cell is created from the prototype in y ...
-
如何从SubClass委托方法调用SuperClass委托方法(How to call SuperClass delegate method from SubClass delegate method)[2023-01-22]
超类 @interface ViewController ()@end @implementation ViewController - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request1 navigationType:(UIWebViewNavigationType)navigationType { NSLog(@"super ... -
如果从nib加载单元格,请将代码添加到initWithCoder:方法。 如果使用-initWithStyle:reuseIdentifier:创建它-initWithStyle:reuseIdentifier:将其添加到那里。 基本上,将它添加到您的单元子类的相应init方法。 If your cell is loaded from a nib, add the code to the initWithCoder: method. If you create it using -initWithStyle ...
-
这需要一些时间,但你可以实现你想要的。 // EDITED 我添加了方法forwardInvocation: 。 当对象无法识别发送给它的消息时,将在对象上调用此方法。 在我们的情况下,当调用一些UIScrollView委托的方法而我们的子类并且它没有实现被调用的方法时,将调用forwardInvocation 。 此方法检查被调用的选择器是否是UIScrollViewDelegate协议的一部分。 如果是,如果我们的类的'true'委托响应这个选择器,我们将被调用的选择器调用到我们的自定义委托。 话虽这么 ...