anees ahamed

Ranch Hand
+ Follow
since Feb 19, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by anees ahamed

For your kind reference,once again, the code of header.jsp

14 years ago
JSP
http://localhost:8080/Application/hrms_user_login.jsp

http://localhost:8080/Application/servlet/server.hrms_user_login --> the page loaded is hrms_default.jsp. in this page, the image is not displayed in the common file header.jsp(the code for header.jsp I have given already, kindly refer)

14 years ago
JSP
Bear Bibeault,

I would be obliged to give whatever information you need to get a solution for this.
Kindly say, if I need to provide any other information.
14 years ago
JSP
The jsp's are those two(hrms_user_login.jsp and hrms_default.jsp) as shown in the application directory image.
14 years ago
JSP


I call this hrms_header.jsp in the other jsp's as I told.

<td ><%@ include file="hrms_header.jsp" %></td>

14 years ago
JSP
Hi,
Please refer the link given. This is the directory structure of one of my applications.

http://docs.google.com/View?id=dfzrknk_764x7hqbgq

I have encountered a small problem and need your valuable help in overcoming it. Also, I would be obliged if you could kindly let me know, why this problem occurs.

hrms_user_login.jsp -> servlet(authentication checking with db) -> hrms_default.jsp

The problem is, I have placed an image in the images folder. I have included this image in a header.jsp file and I have included header.jsp in the files hrms_user_login.jsp and hrms_default.jsp. The image in header.jsp is displayed in hrms_user_login.jsp, but not in hrms_default.jsp . I wonder why this happens.

This is how I included the image in header.jsp.

Can anyone kindly give a solution for this?

Any help in this regard is well appreciated.

Regards,
Anees
14 years ago
JSP
Thanks alot.
That FAQ section was very informative, I understood the concept and solved the problem.

Since, I have explained my question in detail here, I would like to clarify one more doubt. If possible, kindly give some hint.

1) I submit the hrms_user_login.jsp -> It gets submitted to a servlet -> From servlet it goes to default.jsp

The url's displayed in browser in this case

Before submitting

http://localhost:8080/WebContent/HRMS/hrms_user_login.jsp

After submitting

http://localhost:8080/WebContent/server.hrms_user_login

Is there any way by which I can replace "server.hrms_user_login" portion in the url with something else?



14 years ago
JSP
Hi experts,
This( http://docs.google.com/View?id=dfzrknk_74hk85dhcn ) is the directory structure of my application.

JSP's are inside the folder HRMS, Images inside images, Servlets inside WEB-INF/classes/Server

I have a small issue.

The images and css are getting loaded perfectly in the JSP's.

<link rel="stylesheet" href="../css/mystyle.css" type="text/css" />



This is how I load them in the JSP's.

My problem is that, I submit a JSP to a servlet; ie; hrms_user_login.jsp will be submitted to hrms_user_login.java . If it is a valid user, he will be forwarded to hrms_defult.jsp, from the servlet using rd.forward.

Now, comes the problem, images are not displayed and css is not applied to the default.jsp page this time even though I have included them as described above for hrms_user_login.jsp.

What can be the reason? How can I overcome this?

Regards,
Anees


Why does this happen
14 years ago
JSP
Nishan,
I did as per your suggestion.
But I get null pointer exception from

httpReq.getSession(false) in doFilter
14 years ago
JSP
Hi,
I use request.getSession(false).getAttribute("user_id") == null to check whether the user is in session.

I have written a filter. I presume that, I should use the above checking in the public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) method of the filter class.


If it is so, ServletRequest request does not have the method getAttribute .

What is the solution for this? Or is it in some other way that I should perform this session checking in the filter?

Please help with soluion.

Regards,
Anees
14 years ago
JSP
Hi,
Below given is a suggestion which I got from one of my friends who work in j2ee. Kindly say whether this is a good approach.


you can save the logged in user_id in the session when logged in by request.getSession().setAttribute("user_id",user_id) then check on this user_id on every init servlet you have or in the jsp or make BasicServlet for you and let all your servlets extends from it and put this check in it and if the request.getSession(false).getAttribute("user_id") == null then throw exception
14 years ago
JSP
Hi experts,

Hope you might have understood my question from the title itself.

To be more precise, I have an application in which 5-10 jsp pages are there. Entry point of application is login.jsp .

When login.jsp is submitted, it goes to a servlet and from the servlet to an authentication method inside a bean. It performs the required checking and transfers the user to the next page(default.jsp), if he is a valid user.

Now, if a person access the default.jsp page straightaway, he can access it.

My question is, how can I restrict the users from accessing the other jsp pages straightaway without authentication? What is the most common and effectife method used for it. Do I need to set some values to session once i perform authentication check for login.jsp and use it for other jsp's or are there any other better methods?

If I am unclear somewhere in my question, kindly say, so that I will explain it.

Please help with a solution.

Regards,
Anees
14 years ago
JSP
Thanks to one and all. I tried each of your suggestions and ultimately, it got solved.
14 years ago

1. Did you restart the container ?
Yes

2. Put the servlet in a package
This has to work. After that I will do with package.

3. Which container are you using ? Which version ? You are using a configuration for Servlets 2.3, which looks a bit old.
I use apache-tomcat-6.0.18

4. Why are you implementing the Servlet interface ? I think you want to extend the HttpServlet class instead.
I am just trying out an example.

Kindly help with a solution.
14 years ago
Thanks Dawn.
I tried exactly as you told, and here is my modified xml.
Unfortunately, it gives the same eror.

14 years ago