Home > front end >  The requested resource (/Strutsdemo/] is not available (for help)
The requested resource (/Strutsdemo/] is not available (for help)

Time:09-22

Save the children, quick crazy

Tomcat7.0.105

Struts2.2.3.1



Web.xml

<? The XML version="1.0" encoding="utf-8"?>
XMLNS="http://java.sun.com/xml/ns/j2ee"
XMLNS: web="http://xmlns.jcp.org/xml/ns/javaee" xsi: schemaLocation="HTTP://http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.4" & gt;

Struts 2 & lt;/filter - name>
Org, apache struts 2. Dispatcher. Filter. StrutsPrepareAndExecuteFilter



Struts 2 & lt;/filter - name>
/* & lt;/url - pattern>


Index. Jsp








Struts. XML

<? The XML version="1.0" encoding="utf-8"?>

"-//Apache Software Foundation//DTD Struts Congfiguration/2.0/EN"
"Http://struts.apache.org/dtds/struts-2.0.dtd" & gt;


This package has inherited the Struts 2 framework of the default package Struts - default -- & gt;
And map to success. The JSP page - & gt;
/success. Jsp







Struts. Propertoes




The index. The JSP

<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "
PageEncoding="utf-8" % & gt;
<% @ taglib prefix="s" uri="/struts tags -" % & gt;



<meta HTTP - equiv="content-type" Content="text/HTML. Charset="& gt;
Insert title here

<body>







Success. The JSP

<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "
PageEncoding="utf-8" % & gt;
<% @ taglib prefix="s" uri="/struts tags -" % & gt;



<meta HTTP - equiv="content-type" Content="text/HTML. charset=UTF-8">
Insert title here

<body>
<body>







TestAction. Java

Package com. The action;

The import com. Opensymphony. Xwork2. ActionSupport;

Public class TestAction extends ActionSupport {
Private static final long serialVersionUID=1 l;
Private String helo.//the Action attribute
//getters
Public String getHelo () {
Return helo.
}
//a setter method
Public void setHelo (String helo) {
Enclosing helo=helo;
}
//reload the execute () method
Public String the execute () throws the Exception {
Helo="hello, world".
The return SUCCESS.
}
}


  • Related