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

Html:form tag in struts 1.1

 
ajay solanki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on an application which uses Struts 1.1. I have defined a Action class and overridden the execute method. I defined that action into struts-config.xml and set the mapping in web.xml. e.g action path is /newAction.
I used a html:form in jsp page where my action is this action


But when my jsp page renders in browser the action for form tag changes automatic.

Here SampleProject is my project name which is deployed on tomcat server. In my jsp I am using Tiles also.

Please help me to find out the issue behind it.

Thanks in advance
 
ajay solanki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any solution to this behavior. It will be great if someone could respond to this.

Thanks in advance
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Try removing the slash "/" from the action name in the html form

Change it to
 
ajay solanki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank for reply Asif, I have tried that and it is not working in that case also.

Thanks
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It still doesn't work. Then I will require some additional information to look into the matter. Kindly provide me your struts-config.xml and your web.xml file. I need to see all mappings.
 
ajay solanki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Asif here are the configurations

Web.xml



struts-config.xml



Thanks
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I found some configuration related issue

In the web.xml you have defined the servlet as follows



while in the strus-config.xml you have declared the action with the servlet as follows



So , to access the servlet , you have to use the name of the Action , Not the servlet name . Try changing it to this

 
ajay solanki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Asif, correct me if I am wrong,


here name is the name of form bean, not the name of action. Action always known by its path. So in that case my form tag seems right.

 
ajay solanki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, does someone know the reason behind this issue?

Here I am posting the java file from JSP page.



As you can see my action is being set to the html form, but I have no idea why it show different in my browser.
Please, if someone has encountered this problem or know the solution, help me.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic