再线等小问题,请帮忙

wuxinlangman 2005-04-28 01:18:19
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
String zzbjxm="";
String select_list;
String lx=request.getParameter("lx");
String ggfb,cyxy,hdsj,wycy,
switch(lx) {
case ggfb:
zzbjxm="广告发布";
select_list="<option value=\"71\">项目广告</option>";
select_list+="<option value=\"72\">产品广告</option>";
break;
case cyxy:
zzbjxm="创业学苑";
select_list="<option value=\"21\">创业明星</option>";
select_list+="<option value=\"22\">创业知识</option>";
select_list+="<option value=\"23\">政策法规</option>";
break;
case hdsj:
zzbjxm="活动实践";
select_list="<option value=\"31\">创业培训</option>";
select_list+="<option value=\"32\">创业实践</option>";
select_list+="<option value=\"33\">创业感言</option>";
break;
case wycy:
zzbjxm="我要创业";
select_list="<option value=\"41\">投资观察</option>";
select_list+="<option value=\"42\">项目推荐</option>";
select_list+="<option value=\"43\">合作加盟</option>";
break;
default:
zzbjxm="频道精选";
select_list="<option value=\"11\">游戏-娱乐</option>";
select_list+="<option value=\"12\">经济-生活</option>";
select_list+="<option value=\"13\">体育-军事</option>";
select_list+="<option value=\"14\">时事-科技</option>";
break;
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>公告发布</title>
<LINK href="images/css.css" rel=stylesheet type=text/css>
<script language="JavaScript">
<!--
function fPopUpCalendarDlg(ctrlobj) //弹出日历
{
showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
showy = event.screenY - event.offsetY + 18; // + deltaY;
newWINwidth = 210 + 4 + 18;

retval = window.showModalDialog("js/con_CalendarDlg.htm", "", "dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; " );
if( retval != null ){
document.all[ctrlobj].value = retval;
}else{
//alert("canceled");
}
}
//---></script>
</head>
<body leftmargin="0" topmargin="2">
<table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><fieldset>

<legend><font color="#FF0000"><%=zzbjxm%>管理</font></legend>
<form method="POST" action="" name="form1" style="margin:0">
<input name="pass_lx" type="hidden" value="<%=lx%>">
<table width="100%" border="0" cellspacing="0">
<tr bgcolor="#E9F0F6">
<td>查找条件</td>
<td align="right">【 <a href="news.php?lx=<%=lx%>">添加新的纪录</a>】</td>
<td width="200"> </td>
</tr>
<tr>
<td width="80">选择类型:</td>
<td><select name="sslb">
<%=select_list%> </select>
</td>
<td> </td>
</tr>
<tr>
<td>关 键 词:</td>
<td><input type="text" name="gjc" size="32"> </td>
<td><input type="submit" name="tijiao" value="提交">
           
<input type="reset" name="Submit2" value="重置"></td>
</tr>
<tr>
<td>发布时间: </td>
<td> <input name="fbsj" type="text" readonly size="10" maxlength="16">
    <img style="CURSOR: hand" onClick="fPopUpCalendarDlg('fbsj');return false;" alt="日期选择" src="images/riqi.gif">
(点击日期图标)</td>
<td> </td>
</tr>
<tr>
<td colspan="3" align="center" >             
</td>
</tr>
<tr>
<td colspan="3"><table width="100%" cellspacing="0" border="0" bgcolor="#cccccc" height="1" cellpadding="0">
<tr>
<td></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#E9F0F6">
<td colspan="3"><font color="#FF0000">搜索结果:</font></td>
</tr>
<tr><td colspan="3" class="xu"><img src="images/ds.gif">    [<a href="news_manage.jsp?action=del&xwxh=&lx=">  删除记录  </a>]</td></tr>";
<tr align="right" bgcolor="#E9F0F6">
<td colspan="3"><font color="#FF0000"> 
</font></td>
</tr>
</table>
</form>
</fieldset></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
谁帮我看看这个是什么错误
...全文
89 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuxinlangman 2005-04-28
  • 打赏
  • 举报
回复
谢谢,这个问题刚才就解决了,哎半年前学的java现在都忘记完最近没有事情就来看看基本上都快忘记了现在突然来学jsp好困难阿!
希望大家能给点帮助谢谢了
edei2004 2005-04-28
  • 打赏
  • 举报
回复
我觉得楼主还是要好好看一看JAVA的语法哦!
jihanzhong 2005-04-28
  • 打赏
  • 举报
回复
String 类型要用equals()方法,如:
if(lx.equals("ggfb")){
zzbjxm="广告发布";
select_list="<option value=\"71\">项目广告</option>"+"<option value=\"72\">产品广告</option>";
}

if....
jihanzhong 2005-04-28
  • 打赏
  • 举报
回复
found : java.lang.String
required: int //需要int类型
switch(lx) {
^


学会看日志报告8!
InWang 2005-04-28
  • 打赏
  • 举报
回复
switch里面不能用string,java下也一样的

如果你一定要比较的话,还是用if。。。else if 。。。吧
InWang 2005-04-28
  • 打赏
  • 举报
回复
String不能直接这样比较吧
AhWave 2005-04-28
  • 打赏
  • 举报
回复
FT
wuxinlangman 2005-04-28
  • 打赏
  • 举报
回复
可是在java中不时可以写成String吗?
那要是这样的话下面的条件就不能是String le
rower203 2005-04-28
  • 打赏
  • 举报
回复
switch(lx)中的参数不能用String型,要转成int型。
MARS.nEIL 2005-04-28
  • 打赏
  • 举报
回复
请问有什么问题?
wuxinlangman 2005-04-28
  • 打赏
  • 举报
回复
message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /test/admin/news_manage.jsp

Generated servlet error:
[javac] Compiling 1 source file

D:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\test\admin\news_005fmanage_jsp.java:48: incompatible types
found : java.lang.String
required: int
switch(lx) {
^



An error occurred at line: 2 in the jsp file: /test/admin/news_manage.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\test\admin\news_005fmanage_jsp.java:49: incompatible types
found : java.lang.String
required: int
case ggfb:
^



An error occurred at line: 2 in the jsp file: /test/admin/news_manage.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\test\admin\news_005fmanage_jsp.java:54: incompatible types
found : java.lang.String
required: int
case cyxy:
^



An error occurred at line: 2 in the jsp file: /test/admin/news_manage.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\test\admin\news_005fmanage_jsp.java:60: incompatible types
found : java.lang.String
required: int
case hdsj:
^



An error occurred at line: 2 in the jsp file: /test/admin/news_manage.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\test\admin\news_005fmanage_jsp.java:66: incompatible types
found : java.lang.String
required: int
case wycy:
^



An error occurred at line: 2 in the jsp file: /test/admin/news_manage.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\test\admin\news_005fmanage_jsp.java:72: incompatible types
found : java.lang.String
required: int
case sztz:
^


^
6 errors


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:418)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:461)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.
出现这样的错误帮我看看阿

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧