- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
感谢您到目前为止的回复。
异常堆栈跟踪如下。至于所使用的 java 编译器,它是在该版本的工具内的 Websphere Application Server v6.1 中运行的任何编译器。添加 _b 解决了某些行上的错误,但不是所有行上的错误。我不确定这是否是在这里使用的正确逻辑。但在我真正让它再次运行之前我不会知道这一点。 set.Attribute("行数",行数);更改为 set.Attribute("rowcount",rowcount_b); 前后也出现第一个错误所以对于这个变量你的解决方案没有效果。奇怪的。整个问题对我来说很奇怪。
Integer rowcount_b = (Integer) session.getAttribute("rowcount");
if (rowcount_b == null) {
session.setAttribute("rowcount",rowcount_b);
}
// else {
// rowcount = rowcount_b;
// }
在尝试应用您的建议时,我必须用所有这种风格的 if 语句对这三行进行注释。但这与行数无关。
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:571)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:444)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:306)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:148)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:295)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3673)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1593)
我正在使用...
IBM Rational® Application Developer™ for WebSphere® Software
版本:7.5.5.5 iFix1 版本 ID:RADO7555iFix1-I20120913_1613
我收到的错误是:
HttpSession 类型中的 setAttribute(String, Object) 方法不适用于参数 (String, int)
Type mismatch: cannot convert from Integer to int
它们出现在这些行上:
session.setAttribute("rowsremaining",rowsremaining);
rowsremaining = rowsremaining_b;
session.setAttribute("pos",pos);
pos = pos_b;
以下代码(片段):
if (session.getAttribute("searchresults") != null) { // Tests to make sure the session information was created and passed back from the servlet.
// If yes, press on, otherwise, display error msg
ArrayList resultsArray = (ArrayList) session.getAttribute("searchresults");
if (resultsArray.size()>0) {
int totaldata = resultsArray.size();
int totalrows = totaldata / 10;
int remainingdata = resultsArray.size();
int rowsremaining = remainingdata/10;
// The starting position within the list of returned information
int pos = 0;
// The starting row count - decremented for each row displayed
int rowcount = 10;
// Get the previously stored values of rowsremaining and pos,
//if this is the same search, otherwise, they will be as defined above
Integer rowsremaining_b = (Integer) session.getAttribute("rowsremaining");
if (rowsremaining_b == null) {
session.setAttribute("rowsremaining",rowsremaining);
}
else {
rowsremaining = rowsremaining_b;
}
Integer pos_b = (Integer) session.getAttribute("pos");
if (pos_b == null) {
session.setAttribute("pos",pos);
}
else {
pos = pos_b;
}
这之前是有效的,即没有运行时错误,所以我不确定我搞砸了什么 但在单击“Run on Server1”时突然出现这些错误。注意到错误后
我设置了
Windows --> 首选项 --> Java --> 编译器 --> 错误/警告 --> 潜在的编程问题 --> 装箱和拆箱转换
从其默认值“忽略”更改为“错误”,以便我可以看到上面的行是错误的。因为通过
前往 java 文件程序文件 --> IBM --> SDP --> 运行时 --> base_v61 --> 配置文件 --> was61profile1 --> 临时 --> 节点 ...
一直到 war 目录有点痛苦:-)(用编辑器打开后,显示了提到的行号)。
最佳答案
以下 3 行解决了我的问题。
pos_b = new Integer(pos);
rowcount_b = new Integer(rowcount);
rowsremaining_b = new Integer(rowsremaining);
所以在我存储它们之后
session.setAttribute("pos",pos_b);
session.setAttribute("rowsremaining",rowsremaining_b);
session.setAttribute("rowcount",rowcount_b);
我可以找回它们
Integer rowsremaining_b = (Integer) session.getAttribute("rowsremaining");
if (rowsremaining_b == null) {
session.setAttribute("rowsremaining",rowsremaining);
}
else {
rowsremaining = rowsremaining_b;
}
Integer pos_b = (Integer) session.getAttribute("pos");
if (pos_b == null) {
session.setAttribute("pos",pos);
}
else {
pos = pos_b;
}
关于java - 类型不匹配 : cannot convert from Integer to int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22942368/
我正在尝试使用 y 组合器在 Scala 中定义 gcd: object Main { def y[A,B]( f : (A => B) => A => B ) : A => B = f(y(f)
我正在尝试了解返回指向函数的指针的函数,在我尝试编译代码后,它给了我这种错误: cannot convert int (*(int))(int) to int (*(int))(int) in ass
所以我一直在关注 youtube 上的游戏编程教程,然后弹出了这段代码:bufferedImageObject.getRGB(int, int, int, int, int[], int, int);
我正在将时间现在 与存储在数据库某处的时间进行比较。数据库中存储的时间格式为“yyyyMMddHHmmss”。例如,数据库可能会为存储的时间值返回 201106203354。然后我使用一个函数将时间现
例如 Maze0.bmp (0,0) (319,239) 65 120 Maze0.bmp (0,0) (319,239) 65 120 (254,243,90) Maze0.bmp (0,0) (
评论 Steve Yegge的post关于 server-side Javascript开始讨论语言中类型系统的优点和这个 comment描述: ... examples from H-M style
我正在研究 C 的指针,从 Deitel 的书中我不明白 int(*function)(int,int) 和 int*function(int, int) 表示函数时。 最佳答案 C 中读取类型的经验
您好,我使用 weblogic 11g 创建 war 应用程序,我对 joda time 的方法有疑问 new DateTime(int, int, int, int, int, int); 这抛出了
Create a method called average that calculates the average of the numbers passed as parameters. The
var a11: Int = 0 var a12: Int = 0 var a21: Int = 0 var a22: Int = 0 var valueDeterminant = a11 * a12
我正在为一个项目设置 LED 阵列。我得到了一个 LED 阵列,可以根据引脚变化电压进行更改,但我无法添加更多引脚。 当我尝试时,编译失败并显示错误:函数“int getMode(int, int,
除了创建对列表执行简单操作的函数之外,我对 haskell 还是很陌生。我想创建一个列表,其中包含 Int 类型的内容, 和 Int -> Int -> Int 类型的函数. 这是我尝试过的: dat
这个问题已经有答案了: Java add buttons dynamically as an array [duplicate] (4 个回答) 已关闭 7 年前。 StackOverFlow问题今天
我有几个 EditText View ,我想在其中设置左侧的图像,而 setCompoundDrawablesWithIntrinsicBounds 似乎不起作用。图形似乎没有改变。 有人知道为什么会
#include using namespace std; int main() { static_assert(is_constructible, int(*)(int,int)>::val
fun sum(a: Int, b: Int) = a + b val x = 1.to(2) 我在找: sum.tupled(x),或者 sum(*x) 当然,以上都不能用 Kotlin 1.1.3
有一个函数: func (first: Int) -> Int -> Bool -> String { return ? } 返回值怎么写?我对上面 func 的返回类型感到很困惑。 最
type foo = A of int * int | B of (int * int) int * int 和 (int * int) 有什么区别?我看到的唯一区别在于模式匹配: let test_
我正在尝试制作一个 slider 游戏。在这个类中,我使用 Graphics 对象 g2 的 drawImage 方法来显示“拼图”的 block 。但在绘制类方法中,我收到此错误:找不到符号方法dr
我试着理解这个表达: static Func isOdd = i => (i & 1) == 1; 但是这是什么意思呢? 例如我有 i = 3。然后 (3 & 1) == 1 或 i = 4。然后
我是一名优秀的程序员,十分优秀!