SSH 初学之 HelloWorld
【问题】
如何不点击提交按钮,就能显示Server端的信息?
【环境】
eclipse7.5 JRE7 J2EE1.4 tomcat7
【struts.xml】
<action name="HelloWorld2" class="helloWorld.HelloWorld2">
<result name="SUCCESS">/HelloWorld2.jsp</result>
</action>
【action】
public class HelloWorld2{
private String message;
public String getMessage() {
return message;
}
public String execute() throws Exception{
message = "HelloWorld2 from server";
return "SUCCESS";
}
}
【jsp】
<%@ page contentType="text/html;charset=GBK" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
<title>Hello World2</title>
</head>
<body>
<s:form action="HelloWorld2" >
<h1><s:property value="message"/></h1>
<!-- <s:submit/>
--> </s:form>
</body>
</html>
如何不点击提交按钮,就能显示Server端的信息?
【环境】
eclipse7.5 JRE7 J2EE1.4 tomcat7
【struts.xml】
<action name="HelloWorld2" class="helloWorld.HelloWorld2">
<result name="SUCCESS">/HelloWorld2.jsp</result>
</action>
【action】
public class HelloWorld2{
private String message;
public String getMessage() {
return message;
}
public String execute() throws Exception{
message = "HelloWorld2 from server";
return "SUCCESS";
}
}
【jsp】
<%@ page contentType="text/html;charset=GBK" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
<title>Hello World2</title>
</head>
<body>
<s:form action="HelloWorld2" >
<h1><s:property value="message"/></h1>
<!-- <s:submit/>
--> </s:form>
</body>
</html>
...全文
相关推荐
ssh_helloworld(初学参考)
这个"ssh_helloworld"项目是专为初学者设计的,旨在帮助他们理解并掌握SSH框架的基本用法。
SSH整合案例 helloworld 很经典
这个“SSH整合案例 helloworld 很经典”应该是为了帮助初学者理解和掌握如何将这三个框架协同工作,创建一个简单的应用程序。下面将详细解释SSH框架以及它们的整合过程。1.
JavaWeb_SSH框架入门,IntelliJ idea搭建Struts2的helloWorld
【JavaWeb_SSH框架入门,IntelliJ IDEA搭建Struts2的HelloWorld】是一个适合初学者的教程,主要讲解如何在IntelliJ IDEA这个强大的Java集成开发环境中搭建一个基于
ssh2的helloworld(含mysql库)
这个“ssh2的helloworld(含mysql库)”项目是一个基础教程,旨在帮助初学者了解如何将这三个框架整合起来,并与MySQL数据库进行交互。
SSH框架配置
但不管如何,对于初学者来说,SSH框架仍然是一块不错的敲门砖,有助于理解Web应用的分层结构和开发流程。


