⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsp页面内实现动态下拉框!!.htm

📁 有关JSP的技巧
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0042)http://www.chinaunix.net/jh/26/106326.html -->
<!-- Generated by LibHtt 2003-10-22 22:45:31   Templet source: /data0/chinaunix.net/cgisrc/do_html/viewtopics_jh.html  Warnings and errors: 0--><HTML><HEAD><TITLE>ChinaUnix.net - 请教:jsp页面内实现动态下拉框!!</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META 
content=Linux,Freebsd,Solaris,Sco,HP-UX,IBM-AIX,cisco,oracle,java,cgi,mysql,perl,Apache,proFTP,Sendmail,Qmail,DNS,Squid,Rsync,SSL 
name=keywords>
<META content=中国UNIX技术社区 name=description>
<STYLE type=text/css>BODY {
	FONT: 12pt 宋体
}
TH {
	FONT: 12pt 宋体
}
INPUT {
	FONT: 12pt 宋体
}
SELECT {
	FONT: 12pt 宋体
}
TEXTAREA {
	FONT: 12pt 宋体
}
SELECT {
	FONT: 12pt 宋体
}
checkbox {
	FONT: 12pt 宋体
}
BODY {
	FONT-SIZE: 12pt; FONT-FAMILY: "宋体", "serif"
}
TD {
	FONT-SIZE: 12pt; FONT-FAMILY: "宋体", "serif"
}
P {
	FONT-SIZE: 9pt; LINE-HEIGHT: 150%
}
</STYLE>

<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>
<DIV align=center>
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 width="75%" border=0>
  <TBODY>
  <TR>
    <TD height=45>
      <P align=center><A href="http://www.chinaunix.net/"><IMG alt=ChinaUnix.net 
      src="jsp页面内实现动态下拉框!!.files/logo.gif" 
      border=0></A>&nbsp;&nbsp;<B>CU-Java/JSP讨论区精华帖 &nbsp;&nbsp;</B></P></TD></TR>
  <TR>
  <TR>
    <TD vAlign=bottom align=left height=40><SMALL><A 
      href="http://www.chinaunix.net/">ChinaUnix.net</A> &gt; <A 
      href="http://www.chinaunix.net/forum">论坛首页</A> &gt; <A 
      href="http://www.chinaunix.net/jh">精华首页</A> &gt; <A 
      href="http://www.chinaunix.net/jh/26">Java/JSP精华区</A> &gt; 正文 
  </SMALL></TD></TR>
  <TR>
    <TD width="100%" bgColor=#49ade9 colSpan=5 height=2><IMG height=1 
      src="jsp页面内实现动态下拉框!!.files/bline.gif" width=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="75%" border=0>
  <TBODY>
  <TR>
    <TD vAlign=center align=middle bgColor=#edf0f5 height=40><FONT 
      size=5><B>请教:jsp页面内实现动态下拉框!!</B></FONT></TD></TR>
  <TR>
    <TD align=middle bgColor=#edf0f5 height=20><SMALL>http://www.chinaunix.net 
      作者:<A 
      href="http://www.chinaunix.net/forum/profile.php?mode=viewprofile&amp;u=46833" 
      target=_blank>full</A>&nbsp;&nbsp;发表于:2003-07-03 
  16:27:37</FONT></SMALL></TD></TR>
  <TR>
    <TD align=middle bgColor=#edf0f5>
      <TABLE style="WORD-BREAK: break-all; BORDER-COLLAPSE: collapse" 
      cellSpacing=0 cellPadding=0 width="90%" align=center border=0>
        <TBODY>
        <TR>
          <TD vAlign=top><BR>我想在网页中实现动态下拉框,具体如下: 
            <BR><BR>有两个下拉框A和B,选择了A中的一项后,B自动把根据A的选项[color=red:0adcd4a2c9]到数据库中查询的结果[/color:0adcd4a2c9]列出,供用户选择。 
            <BR><BR>这个问题困了我好久!目前我只能用两个页面来解决,即第一个页面用表单提交A的选择后,在第二个被请求的页面内显示B下拉框,很繁琐,各位高手能否提供好的解决方案,在此先谢了!!<BR><BR></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD align=middle><SMALL>【<A 
      href="http://www.chinaunix.net/forum/posting.php?mode=reply&amp;t=106326">发表回复</A>】【<A 
      href="http://www.chinaunix.net/forum/viewtopic.php?t=106326">查看CU论坛原帖</A>】【<A 
      href="javascript:window.close()">关闭</A>】</SMALL> </TD></TR></TBODY></TABLE><!-----------回复----------->
<TABLE cellSpacing=0 cellPadding=0 width="75%" border=0>
  <TBODY>
  <TR>
    <TD bgColor=#edf0f5>
      <TABLE style="WORD-BREAK: break-all; BORDER-COLLAPSE: collapse" 
      cellSpacing=0 cellPadding=0 width="90%" align=center border=0>
        <TBODY>
        <TR>
          <TD>
            <HR>
            <SMALL>&nbsp;<A 
            href="http://www.chinaunix.net/forum/profile.php?mode=viewprofile&amp;u=6872" 
            target=_blank>cinc</A> 回复于:2003-07-03 16:50:19</SMALL></TD></TR>
        <TR>
          <TD>比如该页叫做&nbsp;list.jsp 
            <BR><BR>开始&nbsp;A&nbsp;列表有东西,&nbsp;B&nbsp;列表为空 
            <BR><BR>选中&nbsp;A&nbsp;的一项后&nbsp;,自动转向到这个页面: 
            <BR><BR>list.jsp?listb_id=2 
            <BR><BR>list.jsp&nbsp;根据&nbsp;listb_id&nbsp;做查询,把查询出来的内容列在列表&nbsp;B&nbsp;里 
            <BR><BR>具体传什么参数,你自己再根据你的应用做决定。<BR><BR></TD></TR>
        <TR>
          <TD>
            <HR>
            <SMALL>&nbsp;<A 
            href="http://www.chinaunix.net/forum/profile.php?mode=viewprofile&amp;u=31634" 
            target=_blank>rollingpig</A> 回复于:2003-07-03 16:51:37</SMALL></TD></TR>
        <TR>
          <TD>这是一个很经典的问题 <BR><BR>基本解决方法有几个 <BR><BR>1。你现在用的方法: <BR>选择了A,转向页面。 
            <BR>你可以继续使用 <BR>但是可以考虑转向页面是本页面,可能感觉上会好一点 
            <BR><BR><BR>2。直接把所有数据预先写到页面里的javascript的数组中,再在选择A的时候改动B 
            <BR>这种方法适用于数据量比较少的情况,如果数据量大了就不行了 <BR><BR>3。比较特殊的方法 
            <BR>在A选中之后,到服务器去下载一段动态script,在script里改动B的值<BR><BR></TD></TR>
        <TR>
          <TD>
            <HR>
            <SMALL>&nbsp;<A 
            href="http://www.chinaunix.net/forum/profile.php?mode=viewprofile&amp;u=46833" 
            target=_blank>full</A> 回复于:2003-07-03 19:49:04</SMALL></TD></TR>
        <TR>
          <TD>我也考虑过转向本页面,可是有个问题:如果用表单的话,应该要在该页面上写上诸如: 
            <BR><BR>String&nbsp;stepname&nbsp;=&nbsp;new&nbsp;String([color=red:78f242aacc]request[/color:78f242aacc].getParameter("stepname")) 
            <BR><BR>的语句,可是这样的话,第一次打开此页面是,会引发[color=red:78f242aacc]NullPointer[/color:78f242aacc]的例外!因为第一次打开时,此页面并没被任何页面请求,也就没有request对象啊。 
            <BR><BR>那么应该怎么处理呢?<BR><BR></TD></TR>
        <TR>
          <TD>
            <HR>
            <SMALL>&nbsp;<A 
            href="http://www.chinaunix.net/forum/profile.php?mode=viewprofile&amp;u=31634" 
            target=_blank>rollingpig</A> 回复于:2003-07-03 19:51:27</SMALL></TD></TR>
        <TR>
          <TD>呵呵 <BR><BR>你判断他 <BR>[code:1:ec21b7b8a5] 
            <BR>if(stepname&nbsp;==null){ <BR>stepname="DEFAULT"; <BR>} 
            <BR><BR>[/code:1:ec21b7b8a5] 
        <BR><BR>DEFAULT改为你的A中的第一项!!<BR><BR></TD></TR>
        <TR>
          <TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -