struts+spring+hibernate的web应用【11】

products.jsp页面代码:

 

<%@page pageEncoding="GBK" contentType="text/html; charset=GBK" import="com.game.commons.Pager;"%>
<%@ taglib uri="struts-html" prefix="html" %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="struts-bean" prefix="bean" %>
<%
String flag=(String)request.getAttribute("flag");
String totalRows=(String)request.getAttribute("totalRows");
String fieldname="";
String value="";
if(flag.equals("2")){
    fieldname=(String)request.getAttribute("fieldname");
    value=(String)request.getAttribute("value");
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK"/>
<title></title>
<script language = "JavaScript">
function btnQuery() {
    if(myfm.value.value=="")
    {    
        alert("请输入查询关键字!");
    }else{
        window.location.href="/game/queryProducts.do?method=doQueryProduct&&flag=2&&fieldname="+myfm.fieldname.value+"&&value="+myfm.value.value;
     }
 }
 </script>
</head>
<body>
<form  name="myfm" method="post">
<table border="1">
<tr>
<td>
<a href="/game/getProducts.do?method=doGetProducts&&flag=1">察看所有记录</a>
&nbsp;&nbsp;&nbsp;
</td>
<td>
<a href="/game/addProductPage.do?method=doAddProductPage&&flag=<%= flag%>&&fieldname=<%=fieldname%>&&value=<%= value%>">添加</a>
&nbsp;&nbsp;&nbsp;
</td>
<td>
    <select name="fieldname" >
        <option value="gameNameCn">中文名称</option>
        <option value="gameNameEn">英文名称</option>
        <option value="gameCapacity">碟数</option>
        <option value="gameVersion">版本</option>
        <option value="gameMedia">介质</option>
        <option value="gameCopyright">版权</option>
    </select>
    <input value="" name="value"  />

<a href="#" οnclick="btnQuery()">查询</a>
</td>
</tr>
</table>
<br>
<br>
  
<table border="1">
    <tr>
        <td>游戏中文名称</td>
        <td>游戏英文名称</td>
        <td>软件版本</td>
        <td>软件介质</td>
        <td>碟数</td>
        <td>版权</td>
        <td>价格(元)</td>
        <td>攻略</td>
    </tr>
    <logic:iterate id="pd" name="productsList">
    <tr>
        <td><a href="/game/getProduct.do?method=doGetProduct&&flag=<%=flag%>&&gameId=<bean:write name="pd" property="gameId"/>&&flag=<%= flag%>&&fieldname=<%=fieldname%>&&value=<%= value%>"><bean:write name="pd" property="gameNameCn"/></a></td>
        <td><bean:write name="pd" property="gameNameEn"/></td>
        <td>
            <logic:equal name="pd" property="gameVersion" value="1">
                中文版
            </logic:equal>
            <logic:equal name="pd" property="gameVersion" value="2">
                英文版
            </logic:equal>
        </td>
        <td>
            <logic:equal name="pd" property="gameMedia" value="1">
                CD
            </logic:equal>
            <logic:equal name="pd" property="gameMedia" value="2">
                DVD5
            </logic:equal>
            <logic:equal name="pd" property="gameMedia" value="3">
                DVD9
            </logic:equal>
        </td>
        <td><bean:write name="pd" property="gameCapacity"/></td>
        <td>
            <logic:equal name="pd" property="gameCopyright" value="1">
                正版
            </logic:equal>
            <logic:equal name="pd" property="gameCopyright" value="2">
                翻版
            </logic:equal>
        </td>
        <td><bean:write name="pd" property="gamePrice"/></td>
        <td><bean:write name="pd" property="gameContent"/></td>
    </tr>
    </logic:iterate>
    <tr>
        <%if(flag.equals("1")){%>
            <td colspan="8" align="right" class="head">
                共有<%=totalRows%>条记录&nbsp;&nbsp;&nbsp;&nbsp;
                第<bean:write name="PAGER" property="currentPage"/>页&nbsp;
                共<bean:write name="PAGER" property="totalPages"/>页&nbsp;
                <html:link action="/getProducts.do?method=doGetProducts&&flag=1&&pagerMethod=first" paramName="PAGER" paramProperty="currentPage" paramId="currentPage">首页</html:link>
                <html:link action="/getProducts.do?method=doGetProducts&&flag=1&&pagerMethod=previous" paramName="PAGER" paramProperty="currentPage" paramId="currentPage">上一页</html:link>
                <html:link action="/getProducts.do?method=doGetProducts&&flag=1&&pagerMethod=next" paramName="PAGER" paramProperty="currentPage" paramId="currentPage">下一页</html:link>
                <html:link action="/getProducts.do?method=doGetProducts&&flag=1&&pagerMethod=last" paramName="PAGER" paramProperty="currentPage" paramId="currentPage">尾页</html:link>
            </td>    
        <%}else if(flag.equals("2")){%>
        <% Pager pager=(Pager)request.getAttribute("PAGER");%>
            <td colspan="8" align="right" class="head">
                共有<%=totalRows%>条记录&nbsp;&nbsp;&nbsp;&nbsp;
                第<bean:write name="PAGER" property="currentPage"/>页&nbsp;
                共<bean:write name="PAGER" property="totalPages"/>页&nbsp;
                <a href="/game/queryProducts.do?method=doQueryProduct&&flag=2&&fieldname=<%=fieldname%>&&value=<%= value%>&&pagerMethod=first&&currentPage=<%=pager.getCurrentPage()%>" >首页</a>
                <a href="/game/queryProducts.do?method=doQueryProduct&&flag=2&&fieldname=<%=fieldname%>&&value=<%= value%>&&pagerMethod=previous&&currentPage=<%=pager.getCurrentPage()%>" >上一页</a>
                <a href="/game/queryProducts.do?method=doQueryProduct&&flag=2&&fieldname=<%=fieldname%>&&value=<%= value%>&&pagerMethod=next&&currentPage=<%=pager.getCurrentPage()%>" >下一页</a>
                <a href="/game/queryProducts.do?method=doQueryProduct&&flag=2&&fieldname=<%=fieldname%>&&value=<%= value%>&&pagerMethod=last&&currentPage=<%=pager.getCurrentPage()%>" >尾页</a>
                
            </td>    
        <%}%>
    </tr>
</table>
</form>
</body>
</html>

 

addproduct.jsp页面代码:

<%@page pageEncoding="GBK" contentType="text/html; charset=GBK" %>
<%@ taglib uri="struts-html" prefix="html" %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="struts-bean" prefix="bean" %>
<%
String flag=(String)request.getAttribute("flag");
String fieldname="";
String value="";
if(flag.equals("2")){
    fieldname=(String)request.getAttribute("fieldname");
    value=(String)request.getAttribute("value");
}
String maxid=(String)request.getAttribute("maxid");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK"/>
<title></title>
<html:base/>
<html:javascript formName="productsForm" method="validate"/>
<script Language="JavaScript">
       function btn_AddFolder() {
           if(confirm("确定要保存吗?")){
            if(document.productsForm.onsubmit()){        
                document.forms[0].submit();
            }
        }  
    }
</script>
</head>
<body>

<a href="/game/returnProduct.do?method=doReturnProduct&&flag=<%= flag%>&&fieldname=<%=fieldname%>&&value=<%= value%>">返回</a>
<html:form action="/addProduct.do" οnsubmit="return validate(this)">
<table border="1">
    <tr>
        <td>游戏中文名称</td>
        <td>游戏英文名称</td>
        <td>软件版本</td>
        <td>软件介质</td>
        <td>碟数</td>
        <td>版权</td>
        <td>价格(元)</td>
        <td>攻略</td>
    </tr>
    <tr>
        <td><html:text property="gameNameCn"/></td>
        <td><html:text property="gameNameEn"/></td>
        <td>
            <html:select property="gameVersion" >
                  <html:option value= "2">英文版&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
                  <html:option value= "1">中文版</html:option>
              </html:select>   
        </td>
        <td>
            <html:select property="gameMedia" >
                  <html:option value= "1">CD&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
                  <html:option value= "2">DVD5</html:option>
                  <html:option value= "3">DVD9</html:option>
              </html:select>   
        </td>
        <td><html:text property="gameCapacity" size="5"/></td>
        <td>
            <html:select property="gameCopyright" >
                  <html:option value= "2">翻版&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
                  <html:option value= "1">正版</html:option>
              </html:select>  
        </td>
        <td><html:text property="gamePrice"/></td>
        <td><html:text property="gameContent"/></td>
    </tr>
    
</table>
<html:hidden property="gameId" value="<%= maxid%>"/>
<html:hidden property="method" value="doAddProduct"/>
<html:hidden property="flag" value="<%= flag%>"/>
<html:hidden property="fieldname" value="<%= fieldname%>"/>
<html:hidden property="value" value="<%=value%>"/>
<input type="button" value="保存" οnclick="btn_AddFolder()"/>

</html:form>
</body>
</html>

 

product.jsp页面代码:

<%@page pageEncoding="GBK" contentType="text/html; charset=GBK" %>
<%@ taglib uri="struts-html" prefix="html" %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="struts-bean" prefix="bean" %>
<%
String flag=(String)request.getAttribute("flag");
String fieldname="";
String value="";
if(flag.equals("2")){
    fieldname=(String)request.getAttribute("fieldname");
    value=(String)request.getAttribute("value");
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK"/>
<title></title>
<html:javascript formName="productsForm" method="validate"/>
</head>
<body>
<a href="/game/addProductPage.do?method=doAddProductPage&&flag=<%= flag%>&&fieldname=<%=fieldname%>&&value=<%= value%>">添加</a> &nbsp;&nbsp;&nbsp;
<a href="/game/returnProduct.do?method=doReturnProduct&&flag=<%= flag%>&&fieldname=<%=fieldname%>&&value=<%= value%>">返回</a>&nbsp;&nbsp;&nbsp;
<a href="/game/deleteProduct.do?method=doDeleteProduct&&flag=<%= flag%>&&gameId=<bean:write name="pd" property="gameId"/>&&fieldname=<%=fieldname%>&&value=<%= value%>">删除</a>
<br>
<br>
<html:form action="/updateProduct.do" οnsubmit="return validate(this)">
<table border="1">
    <tr>
        <td>游戏中文名称</td>
        <td>游戏英文名称</td>
        <td>软件版本</td>
        <td>软件介质</td>
        <td>碟数</td>
        <td>版权</td>
        <td>价格(元)</td>
        <td>攻略</td>
    </tr>
    <tr>
        <td><html:text name="pd" property="gameNameCn"/></td>
        <td><html:text name="pd" property="gameNameEn"/></td>
        <td>
            <html:select name="pd" property="gameVersion" >
                  <html:option value= "1">中文版&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
                  <html:option value= "2">英文版</html:option>
              </html:select> 
        </td>
        <td>
            <html:select name="pd" property="gameMedia" >
                  <html:option value= "1">CD&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
                  <html:option value= "2">DVD5</html:option>
                  <html:option value= "3">DVD9</html:option>
              </html:select>  
        </td>
        <td><html:text name="pd" property="gameCapacity" size="5"/></td>
        <td>
            <html:select name="pd" property="gameCopyright" >
                  <html:option value= "1">正版&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
                  <html:option value= "2">翻版</html:option>
              </html:select>  
        </td>
        <td><html:text name="pd" property="gamePrice" size="10"/></td>
        <td><html:text name="pd" property="gameContent"/></td>
    </tr>
    
</table>
<html:hidden property="method" value="doUpdateProduct"/>
<html:hidden name="pd" property="gameId" />
<html:hidden property="flag" value="<%= flag%>"/>
<html:hidden property="fieldname" value="<%= fieldname%>"/>
<html:hidden property="value" value="<%=value%>"/>
<html:submit property="submit" value="保存"></html:submit>
</html:form>
</body>
</html>

 

 

 

 

 

 

 

 

 

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。、可私 6信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 、可私信6博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 、可私信6博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值