Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting error when redirecting from jsp page to .java

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • 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

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65339
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65339
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • 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);%>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic