This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Problem with JSPs in web application

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I am developing a web application that manages the data of employees
The following are the jsp files that I am using

Index.jsp(login details )



The Servlet for the above JSP LoginServlet




The above code is working without any errors ,On successful login it takes me to the FirstLinkPage and on invalid login it takes me to the InvalidUserPage.


FirstLinkPage.jsp



InvalidUserPage.jsp




Other jsps that I am using


CreateEmployeePage.jsp



ModifyEmployeePage.jsp



My web.xml is



The Problem

1)The problem that I face here is when I click the link on highlighted link in InvalidUserPage ,I get a page called Welcome.jsp with the two text boxes namely username and password .The password text box has its type as Text and not as password.
2)I don’t know how I got this page

Because I have created only the following JSPs and NOT a JSP called Welcome.jsp
CreateEmployeePage.jsp
Index.jsp
ModifyEmployeePage.jsp
FirstLinkPage.jsp
InvalidUserPage.jsp
3) Whenever I get back to the index jsp by clicking the link on FirstLinkPage jsp, the password text box type is changed to text(making the password visible) .when I give the correct login details after this it goes to Welcome.jsp
Can anyone please help me find a solution to this problem ,Thank you in advance




 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>OOPS!!! You seem to have entered invalid login credentials try again</h1>
<a > Click here to go back to the login page</a>

</body>
</html>



I doubt, whether you get any highlighted link in InvalidUserPage.jsp, because here there no href only, are you sure, you have posted the correct code...
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply Mr.Prasad Krishnegowda,

Sorry for the inconvenience,i didn't take notice of that part , but my jsp already has a href parameter in the anchor tag , when i paste my code here in javaranch the href attribute is removed ,i dont know the reason

The tag in my InvalidUser.jsp has href attribute as

The First
tag in my FirstLinkPage has href attribute as

The Second
tag in my FirstLinkPage has href attribute as

The Third
tag in my FirstLinkPage has href attribute as
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you click on highlighted link, in InvalidUser.jsp, are you sure, you will get welcome.jsp and not index.jsp, because even index.jsp displays you two text boxes... what you see in the url, index or welcome.jsp?
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I click the link in the InvalidUserPage ,the resulting page has the URL index.jsp and the password textbox has now become an ordinary textbox(the password i enter is now visible).
even if i enter an invalid userid password,it takes me to another page with the URL Welcome.jsp .

 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In all the href in jsp's remove the /, just give the filename like index.jsp and try..
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I tried as you said but after removing the '/' when i click the login page link in the InvalidUserPage

i am getting the 404 error com/index.jsp is not available
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where is your login.jsp located, inside WEB-INF or WEB-INF/com. can you post your directory structure here...
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure,

I have attached directory structure screen shot with this reply,please do refer the attachment and give me your suggestions.
directory-structure.JPG
[Thumbnail for directory-structure.JPG]
Directory structure of my project
 
Ranch Hand
Posts: 282
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

nidhivel raja wrote: when i paste my code here in javaranch the href attribute is removed ,i dont know the reason


This has happened to me as well. I think it's a security feature on these forums to help prevent cross-site scripting, etc. If you could, please edit your original post by placing all "<" and ">" with "&lt;" and "&gt;" for all the link tags:


It seems like older versions of your files exist in your deployment environment. Try doing a clean build and then re-deploying your application.

 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you , for the suggestions Mr.Michael Angstadt

It seems like older versions of your files exist in your deployment environment. Try doing a clean build and then re-deploying your application.




I did as you said but i am facing the same problem.I even created a new web application but the problem with the welcome page and the text box exists ,Is there any other solution for this problem:(


 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when your application takes you to welcome.jsp, click on view source and see the code is matching which jsp or not matching with any jsp at all..
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Sure,
I viewed the source code of the Welcome.jsp,it is the same as another webpage in a different application with the name Welcome.jsp,

The following is the code of the Welcome.jsp


As an alternative, I have deleted the other applications and right now i have created a very simple web app with just three jsp
pages

1)index.jsp
2)WrongUser.jsp
3)Home.jsp
4)LoginServletThree

index.jsp




WrongUser.jsp



Home.jsp




LoginServletThree





The above servlet works fine when i run the webapp ,the Welcome page didnot appear this time(THANKS A LOT for your suggestions ) ,but when i the click the login page link in Home page and the Wronguser page i get a blank page instead of the index page(but the URL is /index.jsp) ......can you please give me a solution for this?
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it just a blank page or page not found exception?.. also, check the server logs, to see what it is showing..
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I checked the server Tomcat Server 6.0 Log,its not showing any errors,but in the server window ,i got the following exception before startup



Any idea what is the reason for this error?
 
nidhivel raja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mr.Prasad Krishnegowda& Mr.Michael Angstadt ,

The Problem is solved ,I tried replacing the existing anchor tags with the following attributes,

and it works !!!

Thanks a lot for spending your time in helping me to solve my problem
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are welcome.. glad you figured out, and it worked.. Also, thank you for posting the worked out solution here..
 
Michael Angstadt
Ranch Hand
Posts: 282
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good to hear!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Michael Angstadt wrote:Good to hear!


The same to me!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!