你在jsp中用的struts的标签来传值的..
解决方案 »
- spring 线程安全 数据同步化的问题
- 过滤器问题,求高手解决谢谢
- JSP弹出确认对话框
- 如何得到本周的周一和周七的日期?
- axis部署不了,请帮忙看看
- 请问我在JSP中调用JavaBean老是不成功,不知道JAR要放在什么地方怎么配置才行啊
- servlet的图形显示方法
- There is no Action mapped for namespace [/] and action name [] associated with c
- 从jsp中调用Applet,出现java.lang.reflect.InvocationTargetException异常
- 支付宝即时到账的退款问题
- 关于struts验证问题
- tomcat+struts配置数据源
可是我不知道怎么把数据库得到的值放入taglib中
能在具体点吗
我现在只能是懂了半个struts,在页面的显示上我还是不懂
你吧他们copy到tomcat的wepapp目录下就可以自动部署了有好几个示例,慢慢研究吧:)
该目标在struts-config.xml中定义然后在你显示的jsp 可以用<bean:write name="employee" property="username" />
或者在前面通过request.getAttribute("beanname");接下来就跟以前的差不多了!
该目标在struts-config.xml中定义然后在你显示的jsp 可以用<bean:write name="employee" property="username" />
或者在前面通过request.getAttribute("beanname");接下来就跟以前的差不多了!
-- request (request.setAttribute())
-- session (session.getAttribute())dont recommend other places like servletContext.In jsp, all objects are viewed as java beans.the order of looking is from form to request, to sessin.
<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="../../inc/head.jsp"%>
<%@ include file="../../js/util.js"%>
<%@ page import="sun.jdbc.rowset.CachedRowSet"%>
<jsp:useBean id="major" class="peiyang.xueji.Major"/>
<jsp:useBean id="advisor" class="peiyang.jiaowu.Advisor"/>
<jsp:useBean id="direction" class="peiyang.jiaowu.Direction" scope="request">
<jsp:setProperty name="direction" property="*"/>
</jsp:useBean>
<%
direction.loadRecord();//将数据库中的记录复制给bean
%>
<html>
<head>
<title>
</title>
<link rel="stylesheet" href="../../inc/main.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body background=../../images/line.gif >
<center>
<br>
<script>
function check(){
if (!IsNumeric(form1.directionId.value)){
alert ('方向编号应该是数字') ;
form1.directionId.focus();
return false;
}
if (form1.directionId.value==''){
alert ('请填写方向编号');
form1.directionId.focus();
return false;
}
if (form1.directionName.value==''){
alert ('请填写方向的名称');
form1.directionName.focus();
return false;
}
}
</script>
<form name="form1" method="post" action="process.jsp" onSubmit="return check()">
<table cellpadding=0 cellspacing=0 border=0 width="600">
<tr height=25>
<td class=cl1_titleoff align=center colspan=2><font class=m2_1>添加方向</font></td>
</tr> <tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="8">方向编号</td>
<td class="mode5"> <img src=../../images/blank.gif width=10 height="8">
<input name="directionId" type="text" id="directionId" value="<jsp:getProperty name="direction" property="directionId"/>" maxlength="20">
</td>
</tr> <tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="8">方向名称</td>
<td class="mode5"> <img src=../../images/blank.gif width=10 height="8">
<input name="directionName" type="text" id="directionName" value="<jsp:getProperty name="direction" property="directionName"/>" size="50" maxlength="100" >
</td>
</tr>
<tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="8">方向描述</td>
<td class="mode5"><img src=../../images/blank.gif width=10 height="1">
<textarea name="directionDescription" cols="50" rows="5" id="directionDescription"><jsp:getProperty name="direction" property="directionDescription"/></textarea>
</td>
</tr>
<tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="8">学科带头人</td>
<td class="mode5"> <img src=../../images/blank.gif width=10 height="8">
<select name="advisorId" id="advisorId">
<%
CachedRowSet rs=advisor.getList(" where schoolId='"+request.getParameter("schoolId")+"'");
while(rs.next()){
out.println("<option value='"+rs.getString("advisorId")+"'>"+rs.getString("advname")+"</option>");
}
%>
</select> </td>
</tr>
<tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="8">开设日期</td>
<td class="mode5"> <img src=../../images/blank.gif width=10 height="8">
<strong>
<%
out.println(util.time.DateTimeUtil.dateList("setupDate",request.getParameter("setupDate_y"),request.getParameter("setupDate_m"),request.getParameter("setupDate_d"),1945,2010));
%>
</strong> </td>
</tr>
<tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="8">备注</td>
<td class="mode5"> <div class="box"> <img src=../../images/blank.gif width=10 height="1">
<input name="note" type="text" id="note" value="<jsp:getProperty name="direction" property="note"/>" maxlength="20">
</div></td>
</tr>
<tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="8">相关操作</td>
<td bgcolor="fafafa" class="mode5"><img src=../../images/blank.gif width=10 height="8">
<input name="add" type="submit" class="cl2_ipt" value="添加">
<input name="action" type="hidden" id="action2" value="add"> <input name="button" type="button" class="cl2_ipt" value="返回" onClick="window.location='index.jsp'">
<input name="majorId" type="hidden" id="majorId2" value="<%=request.getParameter("majorId")%>">
<input name="schoolId" type="hidden" id="schoolId" value="<%=request.getParameter("schoolId")%>">
注意:请先初始化学院、方向、导师数据后在录入本数据</td>
</tr>
</table>
</form>
<br>
</center>
</body>
</html>