Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with html:form

 
abheeshek reddy
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am build a sample struts application.
My requirement is "while calling the welcome page itself i should call a action.

1st trial..
below is my code..
welcome.jsp
html:form action="/tlistForm"
......
......
html:form

struts-config.xml

form-bean name="TopicListForm"
type="com.web.struts.TopicListForm"
form-bean

action
path="tlistForm"
name="TopicListForm"
scope="request"
validate="true"
input="/pages/welcome.jsp"
type="web.struts.action.TopicListAction"
action


1st trial
I am getting error message as /tlistForm cannot be retrieved


guide me on this


thanks

Abhee
 
Cendy Van
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a slash in the path attribute.
 
abheeshek reddy
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean
<html:form action=""> will call action at the loading itself.
 
Lakshmi Narayana puvvada
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Intead of that, you can use following code to execute your action.
write the below code in the jsp scriptlet of welcome page

response.sendRedirect("tlistForm.do");
 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is logic redirect tag for this purpose I guess.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abheeshek reddy wrote:hi all,

action
path="tlistForm"
name="TopicListForm"
scope="request"
validate="true"
input="/pages/welcome.jsp"
type="web.struts.action.TopicListAction"
action


As mentioned earlier put"/" in your path attribute and also to which page you are forwarding after the action.
 
AKHIL Thakur
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this


<html:form action="/whatever.do" method="post">
 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<logic:redirect forward="toaction" />

where toaction is a global forward and it forwards you to your required page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic