aspose file tools*
The moose likes Struts and the fly likes problem with html:form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with html:form" Watch "problem with html:form" New topic
Author

problem with html:form

abheeshek reddy
Ranch Hand

Joined: Nov 28, 2008
Posts: 41
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

Joined: Nov 06, 2007
Posts: 6
Add a slash in the path attribute.
abheeshek reddy
Ranch Hand

Joined: Nov 28, 2008
Posts: 41
You mean
<html:form action=""> will call action at the loading itself.
Lakshmi Narayana puvvada
Greenhorn

Joined: Jul 20, 2005
Posts: 3
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

Joined: Dec 30, 2007
Posts: 96
There is logic redirect tag for this purpose I guess.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Dec 26, 2008
Posts: 1
try this


<html:form action="/whatever.do" method="post">
Dishpal Bhaluja
Ranch Hand

Joined: Dec 30, 2007
Posts: 96
<logic:redirect forward="toaction" />

where toaction is a global forward and it forwards you to your required page.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem with html:form