Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to enter action class without using action form

 
satya pradh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i am new to struts application . in my applicaton i got an error regading form bean returns null (Exception) while executing it. Actually what i did i enter user id & password in to login page it works fine & got the result .now i add one button named logout ,i got the problem here ,i wnt to login. i gave the userid & password i got the error .what i did in my application i used </html:fom> wher it call anothe action class

my jsp code
<html:submit value="login">Login</html:submit>
<html:submit>Logout</html:submit>
<html:form action="/Logout" method="post">

Strutsconfig.xml
<form-beans>
<form-bean name="LoginForm" type="com.app.orbit.Form.LoginForm"/>

</form-beans>
<action-mappings>
<action path="/Login"
type="com.app.orbit.Action.LoginAction"
name="LoginForm"
scope="request"
validate="true"
input="/pages/login.jsp">
<forward name="success" path="/pages/loginsuccess.jsp"/>
<forward name="fail" path="/pages/Loginfail.jsp"/>
</action>
<action path="/Logout"
name="LoginForm"
scope="request"
input="/pages/login.jsp"
type="com.app.orbit.Action.LogoutAction">
<forward name="success" path="/pages/login.jsp"/>

</action>
<action path="/Welcome" forward="/pages/login.jsp"/>
</action-mappings>

please help how i can enter to anothe action class

Thanks in advance
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satya, welcome to javaranch.

When you use html:form tag, the target action class must have a form bean defined for it. I suppose you can skip this by using a normal form tag instead of html:form tag...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or just use a link.
 
satya pradh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit ,yes you are right


i did not write form bean.so can you please tell me if i use general from to call action, i tried that one also but when i clicked on button no event hasnotbeen occured . can you plese guide me regarding this
<input type="submit" name="submit" value="logout" onclick=logout()>
function logout(){
<form action=/login.do>
}

Thanks in advance
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags.

Am I understanding what you've written here correctly?Is that a form tag inside a JavaScript function?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic