• 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

c:redirect not working

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys ,

Offlate i have been facing problems with <c:redirect> tag. What i am doing is:

1)Entry.jsp->This JSP has a textbox and a submit button.
2)Error.jsp->This JSP is my errorHandler Page.
3)Hello.jsp->This JSP actually has the logic.

Now, What i want is , When the user does not enter anything in the textbox in Entry.jsp he is forwarded to Error.jsp which has an implicit object exceptionwhich shows the error.

Its working fine ! But the place im puzzled is if the user is redirected to Error.jsp , Here i am redirecting the user again to Entry.jsp where he would again need to enter the details. So , In short i am doing this.



It gives the error saying "Unreachable Statement" and it says "out.write("/r")".. Can anyone of us please help me ?

Thanks in Advnnce.
Yogendra Joshi.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using <c:redirect> why aren't you using <c:if>?
 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear ,

Thanks for your reply.

Can't we use scriptlets with JSTL ? I mean is there anything wrong with the code i am using.

Help is again appreciated.

Thanks.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there anything wrong with that code? Are you really saying "ur request" on a web page?

However if there is no "name" parameter passed, then the tp variable will be null and not the empty string. I got lost in all those forwards and redirects in your description so I can't tell whether this page is part of the original request or a subsequent request caused by a redirect.

Bear's comment is directly relevant in that if you were using <c:if> instead of a scriptlet, you could be using the JSTL "empty" function that returns true both for null and for the empty string.
 
This tiny ad is guaranteed to be gluten free.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic