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

📄 searchcontent.jsp

📁 java电子相册一般网页里面实现图片切换的这个电子相册的代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=GBK" language="java" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/album.tld" prefix="out" %>
<%
    String contextPath = request.getContextPath();
%>
<script>
<!--
function toDate(){
	with(document.all){
		vYear=parseInt(fromYear.options[fromYear.selectedIndex].text)
		vMonth=parseInt(fromMonth.options[fromMonth.selectedIndex].text)
		fromDay.length=0;
		for(i=0;i<(new Date(vYear,vMonth,0)).getDate();i++){fromDay.options[fromDay.length++].value=fromDay.length;fromDay.options[fromDay.length-1].text=fromDay.length;}
	}
	toDay();
}

function toDay(){
	vDay=parseInt(document.all.fromDay.options[document.all.fromDay.selectedIndex].value);
}

function toDate1(){
	with(document.all){
		vYear=parseInt(toYear.options[toYear.selectedIndex].text)
		vMonth=parseInt(toMonth.options[toMonth.selectedIndex].text)
		toDay.length=0;
		for(i=0;i<(new Date(vYear,vMonth,0)).getDate();i++){toDay.options[toDay.length++].value=toDay.length;toDay.options[toDay.length-1].text=toDay.length;}
	}
	toDay1();
}

function toDay1(){
	vDay=parseInt(document.all.toDay.options[document.all.toDay.selectedIndex].value);
}

function initD(){
toDate();
toDate1();
}
window.onload=initD;


function doSearch() {
    document.searchForm.actionType.value = "search";
    document.searchForm.submit();
}

function doSort() {
    var sortField = arguments[0];
    var sortOrder = arguments[1];
    document.searchForm.actionType.value = "search";
    document.searchForm.sortField.value = sortField;
    document.searchForm.sortOrder.value = sortOrder;
    document.searchForm.submit();
}

function doPreview() {
    var picAdd = arguments[0];
    document.all.picSpan.innerHTML = "<img src='<%=contextPath%>/picture?id=" + picAdd + "'" + "width=140 height=105/>";
}

function doView() {
    var pop = window.open("about:blank","doView","width=600,height=680,resizable=0,scrollbars=1,status=no,toolbar=no,location=no,menu=no");
    var picId = arguments[0];
    document.viewForm.pictureId.value = picId;
    document.viewForm.actionType.value = "init";
    document.viewForm.target = "doView";
    document.viewForm.submit();
}

-->
</script> 
<jsp:useBean id="searchForm" scope="session" type="cn.edu.seu.album.web.SearchForm" />
<table>
<tr><td>

<html:form method="POST" action="/searching">
<html:hidden property="actionType" name="searchForm"/>
<html:hidden property="sortField" name="searchForm"/>
<html:hidden property="sortOrder" name="searchForm"/>
<center><font class="font2">搜索图片</font></center><br>
<font class="font1">上传时间</font>
<html:select property="fromYear" onchange="toDate()" style="width:60">
<script>for(i=1970;i<=2020;i++){
if(i!=1970){document.write("<option>"+i+"</option>")}
else{document.write("<option selected>"+i+"</option>")}}</script>
</html:select>
<html:select property="fromMonth" onchange="toDate()" style="width:40">
<script>for(i=1;i<=12;i++)document.write("<option>"+i+"</option>")</script>
</html:select>
<html:select property="fromDay" onchange="toDay()" style="width:40"/>
</select>

----
<html:select property="toYear" onchange="toDate1()" style="width:60">
<script>
for(i=1970;i<=2020;i++){
if(i!=2010){document.write("<option>"+i+"</option>")}
else{document.write("<option selected>"+i+"</option>")}}</script>
</html:select>
<html:select property="toMonth" onchange="toDate1()" style="width:40">
<script>for(i=1;i<=12;i++)document.write("<option>"+i+"</option>")</script>
</html:select>
<html:select property="toDay" onchange="toDay1()"  style="width:40"/>
<font class="font1">上传人</font>
<html:text property="owner" style="width:100" maxlength="15"/></td>
<td rowspan=2>  
<span id="picSpan"><img src="<%=contextPath%>/picture?id=welcome/science.jpg" width="140" height="105"/></span></td></tr><tr>
<td><input type="button" onclick="doSearch()" value="查询"> <input type="reset" value="清除"></td>
</tr></table>
<logic:equal name="searchForm" property="canList" value="true">
<table width="95%" align="center" border="1">
<tr>
    <td class="tableLable" width="10%" align="center">序号</td>    <td class="tableLable" width="45%" align="center">最后更新时间 (<a href="#" onclick="doSort('photo.lastUpdateDate','ASC')">升序</a>) (<a href="#" onclick="doSort('photo.lastUpdateDate','DESC')">降序</a>)</td>
    <td class="tableLable" width="10%" align="center">公开程度</td>
    <td class="tableLable" width="15%" align="center">查看图片</td>
</tr>
<%
int i = 1;
%>
<logic:iterate id="data" name="searchForm" property="picList" type="cn.edu.seu.album.model.PictureListBean">
<tr>
    <td align=center><%=i%></td>
    <td align=center><out:write name="data" property="lastModifyTime"/></td>
    <td align=center><out:write name="data" property="picturePrivName"/></td>
    <td align=center>
        <button onclick="doPreview('<out:write name="data" property="pictureName"/>')">预览</button>&nbsp;
        <button onclick="doView('<out:write name="data" property="pictureId"/>')">详细</button>
    </td>
    <%
    i++;
    %>
</tr>
</logic:iterate>
</table>
</logic:equal>
</html:form>
<html:form action="/view">
<html:hidden property="actionType" name="viewForm"/>
<html:hidden property="pictureId" name="viewForm"/>
</html:form>

⌨️ 快捷键说明

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