0

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

无法访问的代码就在第一行的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 = "<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: 76 en el archivo jsp: /WorkingDB/HTML.jsp
Unreachable code
73:         case 3:
74:           this.HtmlMeta = "<meta http-equiv=\"Content-Type\" content=\"text/html;     "+this.CharSet[(Integer)argv[2]]+"\" />";
75:           this.HtmlTitle = "<title>"+(String)argv[1]+"</title>";
76:           break;
77:         case 2:
78:           this.HtmlTitle = "<title>"+(String)argv[1]+"</title>";
79:           this.HtmlMeta = "<meta http-equiv=\"Content-Type\" content=\"text/html; "+this.CharSet[0]+"\" />";

实际代码中再次出现类似错误:

HTMLForm(String Name, String Form, int Method, Object... argv) {
  this.Name = Name;
  this.Form = Form;
  this.Method = Method;
  switch( argv.length ) {
    case 1:
      this.css = (CSS)argv[0];
      break;
    case 2:
      this.css = (CSS)argv[0];
      this.Action = (String)argv[1];
      break;
  }
}

消息错误再次:

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

4

0 回答 0