• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

page redirecting problem!

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a basic struts project i can't redirect my jsp page to another.But i did the similar example before that it was working but know it's not.
My problem is bookAdd.jsp dont redirect to the data.jsp it's redirecting to the bookAdd.do please help!Thanks

Here is my BookAddForm


BookAddAction


Book.Java


bookAdd.jsp


struts_config.xml


when i click submit button at the jsp file it shows me the same page can't redirect to data.jsp but my browser changes bookAdd.jsp to bookAdd.do
i cant understand why it is
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I couldn't understand your problem properly because I think its working the way it is supposed to. You have a struts action named bookAdd, and your bookAdd.jsp has a form which has the action as bookAdd. So the form will be submitted to bookAdd action. Then that action will forward (not redirect) to data.jsp. If you want bookAdd action to redirect to data.jsp, then you should use redirect="true" in your result i.e.
(I've not worked on struts 1.x much, but I think this will work as given here)...
 
ali okur
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for reply.
You said "Then that action will forward (not redirect) to data.jsp" but it didnt.When i click to the Add button at the bookAdd.jsp it dont forward to the data.jsp it's still at the bookAdd.jsp.(When i click button i wanna forward to data.jsp) but browser changes http://localhost:8080/databaseOrnek/faces/bookAdd.jsp to http://localhost:8080/databaseOrnek/faces/bookAdd.do where am i wrong?



 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using validations?? I can think of only that reason because of which struts is sending you back to the input page...
 
ali okur
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No i didnt use validator.i did an example like thiss and it's working fine but its not icant understand where am i wrong i'm loosing my mind
 
ali okur
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is another example and its working fine i cant understand what is the difference between the other example why this signup example working but addbook not.in this example when i click the submit button at the signup.jsp the page forward to the signUpSuccess.jsp it works fine
please help me i will be really grateful

signupAction.java


signupform



signup.jsp



struts config


user.java



 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please make sure that there isn't any exception at runtime when the action is called. Also add some logging or System.out.println statements in your action to see what exactly is going on, is your action even being called or not. Also if I remember correctly, if mapping.findForward(SUCCESS) returns null i.e. you return null from your execute method, struts doesn't process your request any further (although that would result in a blank page as output as opposed to the input page). Check if it is returning a valid ActionForward object...
 
ali okur
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i return null from execute method i found my fault.special thanks for your advice .Now it's working fine
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic