Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Hello world not work
Hello world not work [message #643825] Wed, 08 December 2010 12:26
No real name is currently offline No real nameFriend
Messages: 1
Registered: December 2010
Junior Member
Hallo,

i m trying to send a hello world with strus2. but it return empty page.

http:// www.flickr.com/photos/56834047@N06/5243835760/in/photostream /lightbox/

Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>struts2</filter-name>
 <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>


Struts.xml
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <package name="testStruts2" extends="struts-default" >
        <action name="StevStruts" class="testStruts2.StevStruts">
            <result>index.jsp</result>
        </action>
        <!-- Add your actions here -->
    </package>
</struts>


index.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
 <h2>qsdf<s:property value="message" /></h2>

</body>
</html>


.java:
package testStruts2;
import com.opensymphony.xwork2.ActionSupport;

public class StevStruts extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static final String MESSAGE = "Struts is up and running ...";

    public String execute() throws Exception {
        setMessage(MESSAGE);
       return SUCCESS;
    }

    private String message;

    public void setMessage(String message){
        this.message = message;
    }

    public String getMessage() {
        return message;
    }

}


http:// www.flickr.com/photos/56834047@N06/5243835732/in/photostream /lightbox/

question:
1.is the name of package in struts.xml must be the same name package in.java (green color in image above) ?
2.is the name of action in struts.xml must be the same name in class dans .java (cblue color in image above) ?

thanx in advance,
Stev

[Updated on: Thu, 09 December 2010 19:23]

Report message to a moderator

Previous Topic:How to enlarge a line in a Table (SWT)
Next Topic:How to print "Project Explorer" pane (only) ?
Goto Forum:
  


Current Time: Thu Apr 25 23:36:39 GMT 2024

Powered by FUDForum. Page generated in 0.03317 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top