无法找到行动或结果(Could not find action or result)
我正进入(状态:
com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn无法找到操作或结果没有针对命名空间[/]映射的Action和与上下文路径[/]关联的操作名称[]。 - [未知位置]
我使用RAD + WebSphere的组合进行开发,使用以下代码:
struts.xml中:
<struts> <constant name="struts.devMode" value="true" /> <constant name="struts.custom.i18n.resources" value="ApplicationResources" /> <package name="default" extends="struts-default" namespace="/">
web.xml中:
<filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>Login.jsp</welcome-file> </welcome-file-list>
我已阅读所有博客并尝试了网站上提到的所有内容。 这是一个错误,因为我无法找到的一些不同的原因。
I am getting:
com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn Could not find action or result There is no Action mapped for namespace [/] and action name [] associated with context path [/]. - [unknown location]
I am using a combination of RAD + WebSphere for development with the following code:
struts.xml:
<struts> <constant name="struts.devMode" value="true" /> <constant name="struts.custom.i18n.resources" value="ApplicationResources" /> <package name="default" extends="struts-default" namespace="/">
web.xml:
<filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>Login.jsp</welcome-file> </welcome-file-list>
I have read all blogs & tried everything mentioned on sites. It is an error because of some different reason what I am unable to find .
原文:https://stackoverflow.com/questions/30932742
最满意答案
你分配了
col=end; b[k]=(double*) calloc (col,sizeof (double));
col=end; b[k]=(double*) calloc (col,sizeof (double));
但你在循环中for(j=start;j<=end-1;j++){ b[i][j]=b[i][j+1]; }
b[i][end]
for(j=start;j<=end-1;j++){ b[i][j]=b[i][j+1]; }
在函数中。computeDeterminant
。 你设置col=end+1;
或者你改变<=
by<
。if(matrix == NULL) return 0.0; row = end; col = end; double ** b=(double **) malloc (row*sizeof (double*)); for(k=0; k<row ;k++){ b[k]=(double*) calloc (col,sizeof (double)); } for(i=0;i<end;i++){ for(j=0;j<end;j++){ b[i][j]=matrix[i][j]; } } for(i=0;i<end-1;i++){ // i<end-1 bcause of i+1 for(j=1;j<end;j++){ // j<end b[i][j]=b[i+1][j]; } } for(i=0;i<end;i++){ // i<end for(j=start;j<end-1;j++){ // j<end-1 bcause of j+1 b[i][j]=b[i][j+1]; } }
此外,您应该释放在函数
computeDeterminant
为b
分配的内存if (end-1==2){ s = b[1][1]*b[2][2]-b[1][2]*b[2][1]; } else{ for (j=0;j<end-1;j++){ s=s+pw(1+j)*b[1][j]*computeDeterminant(end-1,j,b); } } for(k=0; k<row ;k++){ free( b[k] ); } free(b); return s;
在函数
sum
存在类似的问题:double sum(int n,double **matrix) { int j; double s=0; if(n>2) { // for(j=1;j<=n;j++) <- change this for(j=1;j<n;j++) //^ s=s+pw(1+j)*matrix[1][j]*computeDeterminant(n, j, matrix); return s; } else return matrix[1][1]*matrix[2][2]-matrix[1][2]*matrix[2][1]; }
You allocated
col=end; b[k]=(double*) calloc (col,sizeof (double));
but you accesed tob[i][end]
in loopfor(j=start;j<=end-1;j++){ b[i][j]=b[i][j+1]; }
in function.computeDeterminant
. Either you setcol=end+1;
or you change<=
by<
.if(matrix == NULL) return 0.0; row = end; col = end; double ** b=(double **) malloc (row*sizeof (double*)); for(k=0; k<row ;k++){ b[k]=(double*) calloc (col,sizeof (double)); } for(i=0;i<end;i++){ for(j=0;j<end;j++){ b[i][j]=matrix[i][j]; } } for(i=0;i<end-1;i++){ // i<end-1 bcause of i+1 for(j=1;j<end;j++){ // j<end b[i][j]=b[i+1][j]; } } for(i=0;i<end;i++){ // i<end for(j=start;j<end-1;j++){ // j<end-1 bcause of j+1 b[i][j]=b[i][j+1]; } }
Further you should free the memory you allocated for
b
in functioncomputeDeterminant
if (end-1==2){ s = b[1][1]*b[2][2]-b[1][2]*b[2][1]; } else{ for (j=0;j<end-1;j++){ s=s+pw(1+j)*b[1][j]*computeDeterminant(end-1,j,b); } } for(k=0; k<row ;k++){ free( b[k] ); } free(b); return s;
In function
sum
there is a similar problem:double sum(int n,double **matrix) { int j; double s=0; if(n>2) { // for(j=1;j<=n;j++) <- change this for(j=1;j<n;j++) //^ s=s+pw(1+j)*matrix[1][j]*computeDeterminant(n, j, matrix); return s; } else return matrix[1][1]*matrix[2][2]-matrix[1][2]*matrix[2][1]; }
相关问答
更多-
矩阵排序分段故障(Matrix sorting segmentation fault)[2022-04-16]
你几乎拥有它。 您将size的地址传递给read_data因此可以在该函数中更改size ,但是没有传递mtx的地址,因此它不反映read_data完成的分配。 You almost had it. You passed the address of size to read_data so size could be changed within that function, but did not pass the address of mtx, so it does not reflect the a ... -
分段故障(Segmentation fault)[2022-04-03]
使用new而不是malloc在堆上创建C ++对象。 下列: head = (PNODE) malloc(sizeof(NODE)); 应该读 head = new NODE; malloc()在这里不起作用的原因是它不调用对象构造函数。 Use new rather than malloc to create C++ objects on the heap. The following: head = (PNODE) malloc(sizeof(NODE)); should read head = ... -
你可能只是在这里得到堆栈溢出。 该数组太大而不适合您程序的堆栈地址空间。 如果你在堆上分配数组,你应该没问题,假设你的机器有足够的内存。 You're probably just getting a stack overflow here. The array is too big to fit in your program's stack address space. If you allocate the array on the heap you should be fine, assuming y ...
-
保罗·德雷珀,你几乎是对的。 我认为,正确的代码应如下所示: Matrix* transp (Matrix* mat) { int i, j; int linesTrp = mat->nc ; int colTrp = mat->nl ; Matrix* trp = initMatrix (linesTrp, colTrp) ; // was correct originally for (i=0; i< colTrp; i++) { ...
-
分段故障(Segmentation fault)[2022-08-07]
检查fopen的返回值(好吧,检查任何调用的返回值),它可能无法打开文件。 Check the return value of fopen (well, check the return value of any call), it probably failed to open the file. -
分段故障(Segmentation fault)[2022-09-23]
检查是否确实分配了rn 。 它可能是导致分段错误的唯一因素。 我在我的电脑上测试了你的代码,它可以告诉你运行正常。 可以检查安装GSL,他们有一个你可以使用的测试套件 check to see if rn has really been allocated. It is probably the only thing that can cause segmentation fault. i tested your code on my computer, it runs okay as far as the ... -
矩阵分段故障(Matrix Segmentation Fault)[2022-08-13]
你分配了col=end; b[k]=(double*) calloc (col,sizeof (double)); col=end; b[k]=(double*) calloc (col,sizeof (double)); 但你在循环中for(j=start;j<=end-1;j++){ b[i][j]=b[i][j+1]; } b[i][end] for(j=start;j<=end-1;j++){ b[i][j]=b[i][j+1]; } 在函数中。 computeDeterminant 。 你设置co ... -
分段故障(Segmentation Fault)[2022-01-22]
如果缓冲区太小, strncpy不会终止其输出。 出于这个原因,许多人认为在几乎所有情况下它都是一个糟糕的功能选择。 你的代码有另一个问题, dst没有指向任何地方,但你试图通过它写字符。 你认为那些人物会在哪里? 可能这会导致您的段错误,尝试将字符写入您尚未分配的随机内存位置。 假设您希望坚持使用递归方法:不要每次都复制字符串,而是更改函数以传递字符串的长度。 那么你不需要分配任何内存,也不需要浪费任何时间调用strlen : unsigned int hash_code(const char *str, ... -
C中矩阵的分段故障(Segmentation fault in matrix in C)[2022-03-02]
你的分配应该是 a=malloc(5*sizeof(int*)); 请注意sizof的指针类型。 在某些系统(21世纪初的Windows桌面)中, int恰好与int*大小相同,但您不能认为。 scanf将指针作为参数:最清楚的方法是scanf("%d", &a[i][j]); 一旦完成,不要忘记free记忆。 最后,每当我看到这样的矩阵建模时,我就会死一点。 当然,它允许您使用[][]表示法,但通常最好将其建模为连续的内存块,并使用成语i * columns + j来访问(i, j)处的元素。 Your ... -
C中矩阵的分段故障(Segmentation fault with matrix in C)[2022-06-21]
你有三个选择: 像你不想做的那样在堆栈(或全局)上分配。 错误可能是因为您认为数组数组可以被视为指向指针的指针,但它不能。 动态分配,首先是第一维,每行分配第二维。 您错过了代码中的最后一步。 像现在一样使用单个维度动态分配,但使用例如row * column_length + column作为索引。 You have three choices: Allocate on the stack (or globally) like you don't want to do apparently. The er ...