Please help a struggling newbie, and first time mailing list user.

The following Netbeans 6.0 project is using Glassfish.

 

Directory listing:

 

TS_6

TS_6/src/

TS_6/src/conf/

TS_6/src/conf/MANIFEST.MF

TS_6/src/java/

TS_6/src/java/HelloWorld.java

TS_6/src/java/struts.xml

TS_6/src/java/ts/

TS_6/src/java/ts/BaseAction.java

TS_6/src/java/ts/Login.java

TS_6/src/java/ts/ts_struts.xml

TS_6/test/

TS_6/web/

TS_6/web/HelloWorld.jsp

TS_6/web/index.html

TS_6/web/index.jsp

TS_6/web/jsp/

TS_6/web/jsp/login.jsp

TS_6/web/jsp/login_error.jsp

TS_6/web/jsp/login_input.jsp

TS_6/web/jsp/login_success.jsp

TS_6/web/WEB-INF/

TS_6/web/WEB-INF/sun-web.xml

TS_6/web/WEB-INF/web.xml

TS_6/web/WEB-INF/lib/

TS_6/web/WEB-INF/lib/commons-fileupload-1.2.1.jar

TS_6/web/WEB-INF/lib/commons-io-1.3.2.jar

TS_6/web/WEB-INF/lib/commons-logging-1.0.4.jar

TS_6/web/WEB-INF/lib/freemarker-2.3.12.jar

TS_6/web/WEB-INF/lib/ognl-2.6.11.jar

TS_6/web/WEB-INF/lib/struts2-core-2.1.2.jar

TS_6/web/WEB-INF/lib/xwork-2.1.1.jar

 

Below find the files that I view as being involved in my problem

 

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-cla
ss>  

    </filter>  

    <filter-mapping>  

        <filter-name>struts2</filter-name>  

        <url-pattern>/*</url-pattern>  

    </filter-mapping>

 

    <welcome-file-list>

        <welcome-file>index.html</welcome-file>

        <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>  

    

    <include file="ts/ts_struts.xml"/>

 

    <package name="hello" extends="struts-default">  

        <action name="HelloWorld" class="HelloWorld">  

            <result>/HelloWorld.jsp</result>  

        </action>  

    </package> 

 

</struts>  

 

ts_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="ts" namespace="/ts" extends="struts-default">  

        <action name="Login" class="ts.Login">  

            <result name="success">/jsp/login_success.jsp</result>

            <result name="input">/jsp/login_input.jsp</result>

            <result name="error">/jsp/login_error.jsp</result>

        </action>  

    </package>  

</struts>

 

index.html

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

    <head>

        <META HTTP-EQUIV="Refresh" CONTENT="0;URL=ts/Login.action">

    </head>

    

    <body>

        <p>Loading ...</p>

    </body>

</html>

 

Login.java

 

package ts;

 

public class Login extends BaseAction {

    

    public String execute() throws Exception {

 

        if (isInvalid(getUsername())) {

            return INPUT;

        }

 

        if (isInvalid(getPassword())) {

            return INPUT;

        }

 

        return SUCCESS;

    }

 

    private boolean isInvalid(String value) {

        return (value == null || value.length() == 0);

    }

    private String username;

 

    public String getUsername() {

        return username;

    }

 

    public void setUsername(String username) {

        this.username = username;

    }

    private String password;

 

    public String getPassword() {

        return password;

    }

 

    public void setPassword(String password) {

        this.password = password;

    }

}

 

BaseAction.java

 

package ts;

 

import com.opensymphony.xwork2.ActionSupport;

 

public class BaseAction extends ActionSupport {

 

}

 

login_input.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=UTF-8">

        <title>Login Input</title>

    </head>

    <body>

        <h1>/jsp/login_input.jsp</h1>

        <h2>Input Page</h2>

    </body>

    

</html>

 

 

RUN...

 

http://localhost:8080/TS_6/

 

yields this url...

 

http://localhost:8080/TS_6/ts/Login.action

 

which displays...

 


/jsp/login_input.jsp


Input Page


 

This all seems wired up well enough for the Login action to find the
mapped jsp

 

BUT...

 

When I edit the same jsp by adding a form...

 

login_input.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=UTF-8">

        <title>Login Input</title>

    </head>

    <body>

        <h1>/jsp/login_input.jsp</h1>

        <h2>Input Page</h2>

        

        <s:form action="Login" namespace="/ts">

            <s:textfield key="username"/>

            <s:password key="password" />

            <s:submit/>

        </s:form>

    </body>

    

</html>

 

 

And execute again, 

 

http://localhost:8080/TS_6/ts/Login.action

 

there is an exception...

 

java.lang.IllegalArgumentException: URI is not hierarchical

 

What is it with the <s:form> tag that is causing this error?

 

What does the error log entry mean?

 

java.lang.IllegalArgumentException: URI is not hierarchical

 

Thanks for any help, I've tried many times to work this out, and I just
can't see the forest through the trees.

 

 

 

 

Reply via email to