• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jsp refering to itself

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The following is the structure of the code I am working on

index.jsp - first page
SelectedItemActionForm - a form class for the index.jsp
SelectedItemAction - action class for index.jsp

I have made entries in struts-config.xml file
<forward name="success" path="/path1.jsp">
<foward name="failure" path="/path2.jsp">

The code is working fine for path1 since that is just a normal jsp file that is printing a message.
Now, path2.jsp ... the code is as follows



Now, the error I am getting is

cannot retrieve mapping for action /path2

Since I am not using beans here, do I have to make an entry in action mappings in struts-config.xml and what should it be since no beans are allowed here.

Thank You.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Struts.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're using a JSP as the "action" attribute for the form. Besides that in general you don't want to submit to a JSP, the "action" attribute is expected to be just that--an action.
 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As i remember and as David said, you are suppose to use a real Action(servlet) in case of Struts 1 and do validation and respectively do return (mapping.findForward("failure")); or success depending on what you want. The point of the framework is MVC, so you would want to use the controller to dispatch around relative to validation or something else. There's a struts Login example here that shows the proper way to use the framework basicly: http://www.vaannila.com/struts/struts-example/struts-login-page-example-1.html
 
namrata suri
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the replies. I changed my code now. I have another doubt though.

I am using the jsp to take a value and am passing it to another jsp.

<%@ page import="java.util.*" %>






Now depending on the loop, some n values are being submitted in this form. I am catching all those in this code



Problem is the parameters thing is not getting all the values submitted in the previous form. Its just taking the first 2 values.

 
Tudor Raneti
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Proper way (although mixing jsp with scriptlet java is not recommended):

 
reply
    Bookmark Topic Watch Topic
  • New Topic