This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting 404 when trying to submit my form

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm using Struts 2. I have this on my JSP page ...

<html:form action="pcFlow" method="POST">

and I have this in my struts-config.xml file

<action-mappings>

<action path="/pcFlow"
type="com.myco.regui.struts.accounts.AccountsAction"
scope="request"
name="REAccountLookUpBean"
validate="true"
input="pcAccountLookupPage">
</action>

<global-forwards>
<forward name="pcAccountLookupPage" path="/jsp/pcAccountLookup.jsp" />

Yet when I submit my form, I'm getting a 404 error, telling me the URL http://localhost:7005/re/pcFlow.do cannot be found. What do I need to adjust/add in the above to make everything sync up?

Thanks, - Dave
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I might be remembering this completely wrong, but I thought the "input" attribute had to be an action, JSP, tile, etc. rather than a forward--there was a way to configure this via the controller's "inputForward" attribute (see here).

I'm not too sure about this though. A quick way to sanity-check this would be to try using the JSP name directly. If it works, I might actually be right. If it's still broken, then it's something else still.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Per the suggestion, I changed my action to use the JSP submitting to the form

<action path="/pcFlow"
type="com.myco.regui.struts.accounts.AccountsAction"
scope="request"
name="REAccountLookUpBean"
validate="true"
input="/jsp/pcAccountLookup.jsp">
</action>

but I still get a 404 when the form submits to http://localhost:7005/re/pcFlow.do. Any other ideas are greatly appreciated, - Dave
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd first look to make sure my app context ("re") is correct, then that the JSP page actually exists.

(Best practices, by the way, generally put JSPs under /WEB-INF, to disallow direct access from the browser. That's not related to this, though :)
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have verified that hte context path is correct. I can view this page

http://localhost:7005/re/jsp/pcAccountLookup.jsp

from which I'm submitting the form. Unfortunately I still get the 404 (http://localhost:7005/re/pcFlow.do). I even changed the action directive to include the context path ...

<action path="/pcFlow"
type="com.myco.regui.struts.accounts.AccountsAction"
scope="request"
name="REAccountLookUpBean"
validate="true"
input="/re/jsp/pcAccountLookup.jsp">
</action>

What next? - Dave
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No clue. I'd turn up logging and see if there's anything in the console.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic