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

📄 addpet.jsp

📁 宠物网站jsp
💻 JSP
字号:
<%@ page contentType="text/html;charset=gbk" import="cn.wy.Pet.Pet,cn.wy.factory.PetBuy"%>
<jsp:useBean id="pb" scope="page" class="cn.wy.factory.PetBuy"/>
<%
    //如果有Pet对象,就表明要修改改宠物的信息
    String btText = "确定增加";
    String title = "增加宠物";
    String esc = "返  回";
    String msgg = "不上传图片请保持为空" ;
    String ptPath = "images/selectImg.gif";
    String petName = "" ;
    String imgPath = "";
    String petDate = "2005-12-11";
    String sparea = "";
    String spRematrk = "";
    String sPprice = "";
    String sellPrice = "";
    String petId = "";
    
    //下面两是决定是否直接出售
    String cnaSpYes = " checked='checked' ";
    String cnaSpNo = "";
    String pageNo = "";
    int isUpdata = 0;
    
    //如果是更新宠物就有editPetId参数
    if (request.getParameter("editPetId") != null)
    {
        Pet pet = pb.QueryPet(Integer.parseInt(request.getParameter("editPetId")),false);
        //取出当前记录在第几页
        pageNo = request.getParameter("pageNo");
        
        isUpdata = 1 ;         
        btText = "确定修改";
        title = "修改宠物信息";
        esc = "取消修改" ;
        msgg = "不修改图片请保持为空,要修改就会自动覆盖以前的图片" ;
        ptPath = ".." + pet.getSpphotopath();
        petName = pet.getSpbreed();
        if (pet.getSpphotopath().length()>13)
            imgPath = pet.getSpphotopath().substring(13,pet.getSpphotopath().length()) ;
        petDate = pet.getSpBirthDate();
        
        sPprice = String.valueOf(pet.getSpprice());
        sellPrice = String.valueOf(pet.getSpsellprice());
        //如果是直接出售
        if (pet.isSpcansp())
            cnaSpYes = " checked=\"checked\" ";
        else
        {
            cnaSpYes = "";
            cnaSpNo = " checked='checked' ";
        }
        sparea = pet.getSparea();
        spRematrk = pet.getSpremark();
	petId = String.valueOf(pet.getSpetid());
    }
%>

<form  action="addpet_do.jsp" method="post"  ENCTYPE="multipart/form-data" name="addp">
  <table width="629" height="440" border="0">
    <tr>
        <input type="hidden" name="editPetId" value=<%=petId%> />
        <input type="hidden" name="isUpdata" value=<%=isUpdata%> />
        <input type="hidden" name="pageNo" value=<%=pageNo%> />
        <td height="60"></td>  
      <td height="60"><h2 align="right"><%=title%></h2></td>
      <td height="60" align="center" valign="bottom">图片预览</td>
    </tr>
    <tr>
      <td width="101" height="28"><div align="right">宠物名称:</div></td>
      <td width="253">
          <div align="left">
            <input name="spbreed" type="text" onFocus="this.select()" onMouseOver="this.focus()"  value="<%=petName%>" size="20" maxlength="32" /> 
      <font color="#FF0000" >* 必须填写</font>      </div></td>
      <td width="261" rowspan="8" align="right" valign="top">
	  
	  		<img name="petimg" src=<%=ptPath%> height="208" width="220" id="imggg" />	  </td>
    </tr>
    <tr>
      <td height="24"><div align="right">相关照片:</div></td>
      <td><div align="left">
        <input name="spphotopath" type="file" id="spphotopath" value="<%=imgPath%>" size="20" onchange="document.petimg.src = document.addp.spphotopath.value" />
      </div></td>
    </tr>
    <tr>
      <td height="24">&nbsp;</td>
      <td align="left"><font color="#FF0000" ><%=msgg%></font></td>
    </tr>
    <tr>
      <td height="26"><div align="right">出生日期:</div></td>
      <td>
          <div align="left">
            <input name="spBirthDate" type="text"  onFocus="this.select()" onMouseOver="this.focus()"  value="<%=petDate%>" size="10" maxlength="10" />
          <font color="#FF0000" >*(格式如:2008-09-18)</font></div></td>
    </tr>
    <tr>
      <td height="22"><div align="right">产地:</div></td>
      <td>
          <div align="left">
            <input name="sparea" type="text"  onFocus="this.select()" onMouseOver="this.focus()"  value="<%=sparea%>" />
          </div></td>
    </tr>    
    <tr>
      <td height="67"><div align="right">宠物备注:</div></td>
      <td>
          <div align="left">
            <textarea name="spremark" cols="28" rows="5" onFocus="this.select()" onMouseOver="this.focus()"  id="spremark"><%=spRematrk%></textarea>
      </div></td>
    </tr>

    <tr>
      <td height="27"><div align="right">是否要出售:</div></td>
      <td>
        <div align="left">
            <input name="radiobutton" type="radio"  value="true" <%=cnaSpYes%> />
            <input type="radio" name="radiobutton" value="fasle" <%=cnaSpNo%> />
      否&nbsp;&nbsp;<font color="#FF0000" >* 是否在网站上出售</font></div></td>
    </tr>
   
    <tr>
      <td height="29"><div align="right">购入价格:</div></td>
      <td>
          <div align="left">
          <input name="spprice" type="text" id="spprice"  onFocus="this.select()" onMouseOver="this.focus()"  value="<%=sPprice%>" size="10" maxlength="20" />
        ¥&nbsp;&nbsp;<font color="#FF0000" >只有管理员可见</font></div></td>
    </tr>
    <tr>
      <td height="27"><div align="right">出售价格:</div></td>
      <td>
          <div align="left">
          <input name="spsellprice" type="text"  onFocus="this.select()" onMouseOver="this.focus()"  id="spsellprice" value="<%=sellPrice%>" size="10" maxlength="20" />
        ¥&nbsp;&nbsp;<font color="#FF0000" >公开在主页</font></div></td>
      <td>&nbsp;</td>
    </tr>
    
    <tr>
      <td height="21" colspan="3">&nbsp;</td>
    </tr>
    <tr>
      <td height="27" colspan="3"><div align="center">
        <input type="hidden" name="imgPath" value="<%=imgPath%>">
        <input type="submit" name="Submit" value=<%=btText%> />&nbsp;&nbsp;
        <input type="reset" name="Submit2" value="重新填写" />&nbsp;&nbsp;
        <input type="button" onClick="history.back()" name="Submit" value="<%=esc%>">
      </div></td>
    </tr>
</table>

⌨️ 快捷键说明

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