补充一下啊:
index.jsp<%@ page language="java" %>
<%@ taglib
uri="/WEB-INF/struts-html.tld"
prefix="html" %>
<html>
<head>
<title>Wiley Struts Application</title>
</head>
<body>
<table width="500"
border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="left">
<img src="images/hp_logo_wiley.gif"
width="220"
height="74">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<html:form action="Lookup"
name="LookupForm"
type="wiley.LookupForm" >
<table width="45%" border="0">
<tr>
<td>Symbol:</td>
<td><html:text property="symbol" /></td>
</tr>
<tr>
<td colspan="2" align="center"><html:submit /></td>
</tr>
</table>
</html:form>
</body>
</html>
quote.jsp<html>
<head>
<title>Wiley Struts Application</title>
</head>
<body>
<table width="500"
border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="left">
<img src="images/hp_logo_wiley.gif"
width="220" height="74">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
Current Price : <%= request.getAttribute("PRICE") %>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
index.jsp<%@ page language="java" %>
<%@ taglib
uri="/WEB-INF/struts-html.tld"
prefix="html" %>
<html>
<head>
<title>Wiley Struts Application</title>
</head>
<body>
<table width="500"
border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="left">
<img src="images/hp_logo_wiley.gif"
width="220"
height="74">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<html:form action="Lookup"
name="LookupForm"
type="wiley.LookupForm" >
<table width="45%" border="0">
<tr>
<td>Symbol:</td>
<td><html:text property="symbol" /></td>
</tr>
<tr>
<td colspan="2" align="center"><html:submit /></td>
</tr>
</table>
</html:form>
</body>
</html>
quote.jsp<html>
<head>
<title>Wiley Struts Application</title>
</head>
<body>
<table width="500"
border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="left">
<img src="images/hp_logo_wiley.gif"
width="220" height="74">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
Current Price : <%= request.getAttribute("PRICE") %>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
解决方案 »
- 日志处理
- 怎样更深入的学习J2EE
- JAVA连接SQL server2000数据库
- 导出word出现问题?请各位帮帮忙
- 奇怪了 frame框架集 怎么没效果?
- java jsp页面用dwr异步循环多次调用一个方法 打断点正常 不打就不能正常运行 加了线程锁 也没用 来个大神帮帮我 求求了 跪求··
- 请问我的tomcat为什么用127.0.0.1时可以,而换为localhost时却不行呢?
- 问:EJB中的Bean、remote/local、home/localHome三者之间的关系?
- 为甚么我的jsp找不到servlet?
- 求助,关于SpringMvc的注入问题
- 在struts 中怎样把jsp页面的from数据写到formBean
- eclipse中的ant问题
非常强烈推荐你到ftp://210.36.70.51下载JSPStudio开发工具,
在JSPStudio中,利用Struts文件向导建立struts文件:在文件目录工具栏中点击鼠标右键,然后选择“Struts文件向导”。 在Struts文件向导对话框中输入JSP文件名,系统自动产生ActionForm、Action、JSPOut文件,自动产生及更新XML配置文件。
例如只要输入表格JSP文件名为“lyk01”五个字母,自动生成文件lyk01.jsp(输入)、lyk01Out.jsp、lyk01ActionForm、lyk01Action及自动产生及更新XML配置文件。
lyk01Out.jsp
<%@ page contentType="text/html;charset=GB2312" language="java" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
<%@ 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" %><html:html>
<head>
<title></title>
<html:base/>
</head>
<body bgcolor="white">
<html:form action="/lyk01Action.do" method="post">
<html:text property="mybeanvariable1" />
<html:submit value="提交" />
<html:reset value="重写" />
</html:form>
</body>
</html:html>lyk01Out.jsp
<%@ page contentType="text/html;charset=GB2312" language="java" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
<%@ 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" %><html:html>
<head>
<title></title>
<html:base/>
</head>
<body bgcolor="white">
<html:html>
<head>
<title></title>
<html:base/>
</head>
<body bgcolor="white">
<bean:write name="lyk01Form" property="mybeanvariable1" />
</body>
</html:html>
</body>
</html:html>lyk01Form.java
package org.apache.struts.webapp.example;import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;public final class lyk01Form extends ActionForm
{
private String mybeanvariable1;//myfiledata;public String getMybeanvariable1()
{
return (this.mybeanvariable1);
}public void setMybeanvariable1(String mybeanvariable1)
{
this.mybeanvariable1=mybeanvariable1;
}}lyk01Action.java
package org.apache.struts.webapp.example;import java.lang.reflect.InvocationTargetException;
import java.util.Locale;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.ModuleException;
import org.apache.struts.util.MessageResources;public final class lyk01Action extends Action
{
// 变量定义:
private Log log = LogFactory.getLog("org.apache.struts.webapp.Example");//函数定义:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
// Extract attributes and parameters we will need
Locale locale = getLocale(request);
MessageResources messages = getResources(request);
HttpSession session = request.getSession();
lyk01Form myform = (lyk01Form) form;
String variable1= myform.getMybeanvariable1();
try
{
if(variable1.trim().equals(""))
{
return new ActionForward(mapping.getInput());
}
//其它代码
return (mapping.findForward("success"));
}
catch (Exception e)
{
//log.error("出错", e);
//log.trace("出错");
throw new RuntimeException(e.getMessage());
}
}
}
type="org.apache.struts.webapp.example.lyk01Form" />
</form-beans>///////////////////////////
<action path="/lyk01Action"
type="org.apache.struts.webapp.example.lyk01Action"
name="lyk01Form"
scope="session"
input="/lyk01.jsp">
<forward name="success" path="/lyk01Out.jsp" />
</action>