对jsp网页布局
我有一段JSP写的网页,里面用了大量的标签,但是我现在想在整个网页外加一个大表格,是整个网页不占满整个屏幕,而是按照宽度为1003像素固定显示,但是用表格不行,请问应该怎么弄?
代码如下,我也不知道用没用框架,好像没用,但是左边的导航栏始终控制不了宽度
<%--
- home.jsp
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
<%@ page import="java.io.File" %>
<%@ page import="java.util.Enumeration"%>
<%@ page import="java.util.Locale"%>
<%@ page import="javax.servlet.jsp.jstl.core.*" %>
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
<%@ page import="org.dspace.core.I18nUtil" %>
<%@ page import="org.dspace.app.webui.util.UIUtil" %>
<%@ page import="org.dspace.content.Community" %>
<%@ page import="org.dspace.core.ConfigurationManager" %>
<%@ page import="org.dspace.browse.ItemCounter" %>
<%
Community[] communities = (Community[]) request.getAttribute("communities");
Locale[] supportedLocales = I18nUtil.getSupportedLocales();
Locale sessionLocale = UIUtil.getSessionLocale(request);
Config.set(request.getSession(), Config.FMT_LOCALE, sessionLocale);
String topNews = ConfigurationManager.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-top.html"));
String sideNews = ConfigurationManager.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-side.html"));
boolean feedEnabled = ConfigurationManager.getBooleanProperty("webui.feed.enable");
String feedData = "NONE";
if (feedEnabled)
{
feedData = "ALL:" + ConfigurationManager.getProperty("webui.feed.formats");
}
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
%>
<dspace:layout locbar="nolink" titlekey="jsp.home.title" feedData="<%= feedData %>"><这里用了layout标签,该标签有很多属性>我在下面贴出这个的源码
<table width="95%" align="center">
<tr align="right">
<td align="right">
<% if (supportedLocales != null && supportedLocales.length > 1)
{
%>
<form method="get" name="repost" action="">
<input type ="hidden" name ="locale"/>
</form>
<%
for (int i = supportedLocales.length-1; i >= 0; i--)
{
%>
<a class ="langChangeOn"
onclick="javascript:document.repost.locale.value='<%=supportedLocales[i].toString()%>';
document.repost.submit();">
<%= supportedLocales[i].getDisplayLanguage(supportedLocales[i])%>
</a>
<%
}
}
%>
</td>
</tr>
<!--
<tr>
<td class="oddRowEvenCol"><%= topNews %></td>
</tr>
-->
</table>
<br/>
<!-- <form action="<%= request.getContextPath() %>/simple-search" method="get">
<table class="miscTable" width="95%" align="center">
<tr>
<td class="oddRowEvenCol">
<h3><fmt:message key="jsp.home.search1"/></h3>
<p><label for="tquery"><fmt:message key="jsp.home.search2"/></label></p>
<p><input type="text" name="query" size="20" id="tquery" />
<input type="submit" name="submit" value="<fmt:message key="jsp.general.search.button"/>" /></p>
</td>
</tr>
</table>
</form> -->
<table class="miscTable" width="95%" align="center">
<tr>
<td class="oddRowEvenCol">
<h3><fmt:message key="jsp.home.com1"/></h3>
<p><fmt:message key="jsp.home.com2"/></p>
<%
if (communities.length != 0)
{
%>
<table border="0" cellpadding="2">
<%
for (int i = 0; i < communities.length; i++)
{
%> <tr>
<td class="standard">
<a href="<%= request.getContextPath() %>/handle/<%= communities[i].getHandle() %>"><%= communities[i].getMetadata("name") %></a>
<%
if (ConfigurationManager.getBooleanProperty("webui.strengths.show"))
{
%>
[<%= ic.getCount(communities[i]) %>]
<%
}
%>
</td>
</tr>
<%
}
%>
</table>
<%
}
%>
</td>
</tr>
</table>
<dspace:sidebar>
<dspace:include page="/components/login-form.jsp" />
<!--
<%= sideNews %>
<%
if(feedEnabled)
{
%>
<center>
<h4><fmt:message key="jsp.home.feeds"/></h4>
<%
String[] fmts = feedData.substring(feedData.indexOf(':')+1).split(",");
String icon = null;
int width = 0;
for (int j = 0; j < fmts.length; j++)
{
if ("rss_1.0".equals(fmts[j]))
{
icon = "rss1.gif";
width = 80;
}
else if ("rss_2.0".equals(fmts[j]))
{
icon = "rss2.gif";
width = 80;
}
else
{
icon = "rss.gif";
width = 36;
}
%>
<a href="<%= request.getContextPath() %>/feed/<%= fmts[j] %>/site"><img src="<%= request.getContextPath() %>/image/<%= icon %>" alt="RSS Feed" width="<%= width %>" height="15" vspace="3" border="0" /></a>
<%
}
%>
</center>
<%
}
%>
-->
</dspace:sidebar>
</dspace:layout>