Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法访问的代码、开关、中断。JSP-Java_Java_Jsp_Switch Statement_Break - Fatal编程技术网

无法访问的代码、开关、中断。JSP-Java

无法访问的代码、开关、中断。JSP-Java,java,jsp,switch-statement,break,Java,Jsp,Switch Statement,Break,我有此代码,但我收到以下消息: 无法访问的代码就在第一行,带有中断语句 这里是我的代码的另一个例子: public HTMLFile(Object... argv) { this.Name = (String)argv[0]; switch( argv.length ) { case 6: //assigning the value 6th variable and follow with other variables this.StyleSheet = "<

我有此代码,但我收到以下消息:

无法访问的代码就在第一行,带有中断语句

这里是我的代码的另一个例子:

public HTMLFile(Object... argv) {
  this.Name = (String)argv[0];
  switch( argv.length ) {
    case 6: //assigning the value 6th variable and follow with other variables
      this.StyleSheet = "<link rel=\"stylesheet\" href=\""+(String)argv[5]+"\" type=\"text/css\" />";
    case 5://assigning the value 5th variable and follow with other variables
      this.ShortCutIcon = "<link rel=\"shortcut icon\" href=\""+(String)argv[4]+"\" type=\"image/x-icon\" />";
    case 4:
      this.css = (CSS)argv[3];
    case 3:
      this.HtmlMeta = "<meta http-equiv=\"Content-Type\" content=\"text/html; "+this.CharSet[(Integer)argv[2]]+"\" />";
      this.HtmlTitle = "<title>"+(String)argv[1]+"</title>";
      break;
    case 2:
      this.HtmlTitle = "<title>"+(String)argv[1]+"</title>";
      this.HtmlMeta = "<meta http-equiv=\"Content-Type\" content=\"text/html; "+this.CharSet[0]+"\" />";
      break;
    case 1:
      this.HtmlTitle = "<title></title>";
      this.HtmlMeta = "<meta http-equiv=\"Content-Type\" content=\"text/html; "+this.CharSet[0]+"\" />";
      break;
   }
  this.ResetFile();
}
再次显示错误消息:

Ha tenido lugar un error en la línea: 825 en el archivo jsp: /WorkingDB/HTML.jsp
Unreachable code
822:       switch( argv.length ) {
823:         case 1:
824:           this.css = (CSS)argv[0];
825:           break;
826:         case 2:
827:           this.css = (CSS)argv[0];
828:           this.Action = (String)argv[1];
也许这是一个愚蠢的问题,但我不能理解这个错误

C:\Users\PC>java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode, sharing)

C:\Users\PC>

Tomcat版本:Tomcat 7.0.19

您不是意外地编写了
开关(sSpc.length)
而不是
开关(argv.length)
。Java编译器通常会尝试进行常量传播…有趣的是,即使使用sSpc.length,我也没有发现错误,但是我同意提供的代码与实际代码之间可能存在一些差异。argv.length是该方法变量参数的长度…只是一个观察:在第二个示例中,错误发生在第一个块上,带有
break
。您的
JavaEE
版本是什么?您是否使用SDK、IDE(如Eclipse)或其他编译器?请提供产生您所描述问题的/actual/代码。
Ha tenido lugar un error en la línea: 825 en el archivo jsp: /WorkingDB/HTML.jsp
Unreachable code
822:       switch( argv.length ) {
823:         case 1:
824:           this.css = (CSS)argv[0];
825:           break;
826:         case 2:
827:           this.css = (CSS)argv[0];
828:           this.Action = (String)argv[1];
C:\Users\PC>java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode, sharing)

C:\Users\PC>