0

ここで 2 つのことを試しています。まず、アクションを helloWorld.do として通常の jsp を実行します。

<html:form action="helloWorld.do" method="post">

htmlでも同じことが言えます:

<form action="helloWorld.do" method="post">
<input type="text" name="userName"> <!-- userName and password names do match the variables in form -->
<input type="password" name="password">
<input type="submit" value="Submit">
</form>

jspを実行すると、jspのアクションが正しいアクションにマップされ、ページが正しくレンダリングされますが、htmlでは実際にhttp://localhost/StrutsExample/helloworld.do. ここで helloWorld.do が helloworld.do に変更されました。そのため、空のページがレンダリングされました (これは、ユーザー名を表示しようとしているページです) それで、struts に新しいアクションを追加しようとしました:

<action path="/helloworld"
    type="com.org.common.action.HWdAction"
    name="hWForm">
    <forward name="success" path="/HW.jsp"/>
</action>

それでもうまくいきません。フォームは、html に入力された名前で自動的に入力されません。

4

1 に答える 1