Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Basic question

 
Prannav Santhosh
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a welcome.jsp (as shown below)

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<html:form action="/Data" method="post" >
</html:form>
</body>
</html>

In the struts config.xml , I have the below entry.

<form-beans>
<form-bean name="dataForm" type="com.forms.DataForm">
</form-bean>
</form-beans>

<action-mappings>
<action path="/Data" type="com.actions.DataAction" name="dataForm">
<forward name="success" path="/Success.jsp"></forward>
</action>
</action-mappings>
The question here is , when i type in the http://localhost:9080/<webcontext>/welcome.jsp , will the DataForm object be created ?
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. If you use a URL with .jsp, you are going around the Struts framework and going right to the JSP. To go through Struts, you will have to use a URL that matches the mapping you configured in web.xml, usually (but not necessarily) something ending in .do
 
Prannav Santhosh
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe- thanks for your time..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic