贴上代码:
<%@ page contentType="text/html; charset=GBK" language="java" errorPage="" %>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>添加资讯</title>
</head>
<body>
<table width="780" align="center" cellspacing="0"
background="images/bodybg.jpg">
<tr>
<td >
<h3 align="center">请输入资讯详情</h3>
<div align="center">
<s:actionerror cssClass="error"/>
<s:form action="AddInfo" >
<s:textfield name="infoTitle" label="标题" />
<s:textfield name="infoOrder" label="优先级"/>
<s:textfield name="infoAuthor" label="作者"/>
<s:textarea name="content" cols="50" row="8" label="内容"/>
<s:textfield name="infoUrl" label="URL"/><br>
<s:submit value="提交" />
</s:form>
</div>
</td>
</tr>
</table>
</body>
</html>
<%@ page contentType="text/html; charset=GBK" language="java" errorPage="" %>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>添加资讯</title>
</head>
<body>
<table width="780" align="center" cellspacing="0"
background="images/bodybg.jpg">
<tr>
<td >
<h3 align="center">请输入资讯详情</h3>
<div align="center">
<s:actionerror cssClass="error"/>
<s:form action="AddInfo" >
<s:textfield name="infoTitle" label="标题" />
<s:textfield name="infoOrder" label="优先级"/>
<s:textfield name="infoAuthor" label="作者"/>
<s:textarea name="content" cols="50" row="8" label="内容"/>
<s:textfield name="infoUrl" label="URL"/><br>
<s:submit value="提交" />
</s:form>
</div>
</td>
</tr>
</table>
</body>
</html>
解决方案 »
- 在js里把一个button设成disable了,然后又取消disable。怎么按钮不变亮呢?
- struts1.2 action中获取对应的资源文件
- jsp页面问题
- 求助 Oracle 10g 64位 jdbcurl
- 在JSP中的文件操作大全(好东东)
- struts html:select问题!
- java 我想同时继承两个类有什么办法?继承AbstractInterceptor和ActionSupport
- 懒人问题:如何调用SQLSERVER的视图啊
- 怎么在jsp和servlet里使用自己编的类???怎么导入?
- 关于tomcat运行web 应用程序的问题
- 关于html frame框架下怎么使用struts action
- hibernate+struts+spring页面,显示查询结果的页面怎么写呢?
给个method。
<s:form action="AddInfo" method="post">
import com.ns.Action.base.BaseAction;
import com.ns.Service.AppManager;
import com.ns.exception.AppStoreException;public class AddInfoAction extends BaseAction {
String infoTitle;
int infoOrder;
String infoAuthor;
String content;
String infoUrl;
Date infoTime;
public String excute() throws Exception {
Integer infoId=mgr.addInfo(infoTitle, infoOrder, infoAuthor, content, infoUrl, infoTime);
if(infoId!=null&&infoId>0) {
return SUCCESS;
}
else {
addActionError("添加资讯失败,请重新填写。");
return "failure";
}
}
public String getInfoTitle() {
return infoTitle;
}
public void setInfoTitle(String infoTitle) {
this.infoTitle = infoTitle;
}
public int getInfoOrder() {
return infoOrder;
}
public void setInfoOrder(int infoOrder) {
this.infoOrder = infoOrder;
}
public String getInfoAuthor() {
return infoAuthor;
}
public void setInfoAuthor(String infoAuthor) {
this.infoAuthor = infoAuthor;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getInfoUrl() {
return infoUrl;
}
public void setInfoUrl(String infoUrl) {
this.infoUrl = infoUrl;
}
public Date getInfoTime() {
return infoTime;
}
public void setInfoTime(Date infoTime) {
this.infoTime = infoTime;
}
}
<result name="success">/AddInfo.jsp</result>
<result name="input">/error.jsp</result>
<result name="failure">/error.jsp</result>
<!-- 显式引用系统默认拦截器栈 -->
<interceptor-ref name="defaultStack"/>
</action>