• 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

Getting error when redirecting from jsp page to .java

 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<% String destination="/Business_Model/LoginConnect.java"; %>
<%response.sendRedirect(destination);%>


i guess I am going wrong when initializing the destination Variable...Please help on this issue.


Thnks in advance for your response <3

 
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
You can't redirect to a Java file. What would you expect that to do?

(And, as always, Java code in a JSP is a poor practice to be avoided.)
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,
1. i creatd a simple html login page

2. html page once submitted was redirctd to jsp page

3. in the jsp page the above redirect code was written so that the user is not aware as of where this page is redirected to

4. it was redirectd to a java file which is usd to cnect to the database to chk usrid and paswd

also tried creatin a .jsp file with the same name in business --- folder still the same error
 
Bear Bibeault
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

Vishal Hegde wrote:2. html page once submitted was redirctd to jsp page


"redirected", you missed an 'e'. Forms should be submitted to servlets, not JSPs.

3. in the jsp page the above redirect code was written so that the user is not aware as of where this page is redirected to


Huh? Why do you care, and again, why to a java file?

4. it was redirectd to a java file which is usd to cnect to the database to chk usrid and paswd


Please use real words when posting. redirectd, usd, cnect, chk, usrid and paswd are all not real words.

also tried creatin a .jsp file with the same name in business --- folder still the same error


You'll have to better explain what you are actually trying to accomplish (using real words) before we can begin to suggest real-world ways to get it done.
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

Apologies for using the abbreviations..Right now i am a novice programmer for JSP SERVLETS , I am just trying to develop a webpage for my personal use but

Model, View,Controller i iam getting confused in these three domains.

Model: refering to the Business logic and the reason i am trying to redirect it to a java file because i only know how to code for connectivity using .java files



View: refering to the display of webpages , i also tried redirecting using .jsp but no help

Controller: I guess the servlets for controlling the flow.

I am really getting confused as what to redirect where??

But my real concern is also created LoginConnect.jsp in Business Logic folder and redirected my loginBean1

<% String destination="/Business_Model/LoginConnect.jsp"; %>
<%response.sendRedirect(destination);%>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic