Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Deepak Jain

Ranch Hand
+ Follow
since Aug 05, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
4
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 Deepak Jain


HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class org.directwebremoting.servlet.DwrServlet or a class it depends on



There you go, web container is not able to find the sevlet class that you defined in the deployment descriptor (web.xml) <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> Make sure

As i said earlier make sure
a) The .class file is present in WEB-INF/classes folder.
or
b) The .class file is present in jar file under WEB-INF/lib

And then restart tomcat and keep an eye on logs in case of trouble.
8 years ago
Its very difficult to analyse these issues remotely. I have also faced such issues in my early days with tomcat & my first webapp.

Suggestions
1) Check the log files in Tomcat @ ${CATALINA_HOME}/logs/ This will surely have information why is your webapp is not deployed or if there are other problems while accessing the page.
2) Also, check the complete URL that you are using to access the servlet. It better match the one defined in <url-pattern>/dwr/*</url-pattern>.
3) Make sure the servlet class <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>s is present in classes or in lib as jar.
8 years ago
B'day bumps from me
8 years ago
Understood !

Answer: The instance will have both the members so it will have two members test="parent" and test="child" and depending on the class where its accessed the value will be so. If accessed from parent class member method as this.temp, here temp would point to "parent" member and if accessed from child member method it will point to child class member method and hence have the value "child".



Question

parent class has a member String test = "parent";

child class has

String test = "child";

i instantiate a child class instance with parent class reference in some third class

what will the child class instance have in its test member varible? when i access the member in parent class member method (USing this reference) and when i access the member in child class method method ((USing this reference))
???
If both tags do exactly the same thing, I would only use one tag. --> They do almost the same thing, the place where they differ hence i have two tagHandlers A, B.

A extends SimpleTagSupport.

B extends A
overrides the methods, the makes sense for B.

With this inheritance, lot of duplication is hidden.
My question was in the .tld file there are two definitions for A, B.
A has 3 attributes.
B has 4 attributes. only one extra that differs.
There is this duplication of attribute definition.
Cant we declare B, like all the attributes of A and then my extra attribute.
9 years ago
JSP
Hello,
I have a JSP custom tag "A" defined in my .tld. It has 3 required attributes. It has its ATagHAndler that inherits SimpleTagHandler.
I need a new tag "B" that does excatly the same thing as the above "A" but in a little different way. Also the attributes that are present in "A", i copied them to "B" in the .tld file (Code duplication)). Further the I created a BTagHandler extends ATagHandler, and overrided the few methods that actually changes across these two handlers.and rest functionality is defined in "ATagHandler. On java side its cool, cause lot of code duplication is avoided due to inheritance.

But in the .tld file that has the defination of Tag A and TAg B, there are duplication of the attributes definition. Is there a way to avoid this duplication.
If not,
Is there a completely different approach for my problem. (Both tags do excatly same things, but a slight change, So i used inheritance)

Regards,
Deepak
9 years ago
JSP
If you open javaranch.com or gmail.com you can see "Log me automatically on each request" or "Remeber me on this computer" respectively. How can one implement that. I am using Web container based authentication and authoriazation. (web.xml based security). I did find a thread on this in the JSP form but the link pointed there is broken and the implementation is not clear on how to implement the above functionality.
9 years ago
JSP
I have completed SCBCD 5.0 with a very low score of 72%. I am not satisfied with the score nor the preparation and hence was thinking of taking the SCBCD 5.0 Upgrade Exam.
Any advice of weather or not i should go for it.

Currently i have completely forgotten whatever little i could read for the exam as my work is not at all based on EJB.
My purpose is
a) Understand EJB and Persistence properly.
b) Preapare in 3-4 months with loads of coding practice.

OR should i stop thinking of EJB 3.0 and go for Web Services exam Sun Certified Developer for Java Web Services 5 (CX-310-230) - NEW!

Advice will help.
Are there any good and valid certfications for Ruby?

Also is there is any PDF or doc that i can download and read on it in the website that you have mentioned.
9 years ago
Suppose I use container based form based authentication (j_username, j_password).
Suppose I request for a constraint resource and since its a constraint, container will ask me for authentication. Once I authenticate myself , the container will forward the request to requested constraint resource. Now in the constraint resource is there any way to get the user name that was used by the user and against which the container authenticated.
I tried
a) request.getParameterNames()
b) request.getQueryString()
Both these methods do not contain the user name.
1)Are you using the functionality with cookie enabled. -- YES, cookies are enabled on my browser. To logout, currently am clearing the browser cookes, thereby when i key in the URL for my webapp it shows the login screen. Hence i need a Sign Out link.
2) Are you using on custom cookie. No am not using custom cookies. Am using Container based authentication and authorization. (As described in the Head first servlets and jsp : Security Chapter).


I want to show a sign out link so that user can click on it and next time he/she points the browser to my web app, the container throws them with a login screen. I do not want a sign in link as it does not make sense in my scenario.

I) I have a header.jsp (Which displays normal headings and i want a sign out link at the right corner). Since header.jsp is common to
a) Login Page login.jsp
b) Rest of the application JSPs that shows the webapp.
I wanted to implement Sign Out link in header.jsp
Hence in header.jsp what conditions should i check so that I can display Sign Out href.
II) Further, I have the href pointed to signout.jsp that has the following code

I am hoping the above forward will throw a login screen since the session is already invalidated.

All the things that i have mentioned above are note working.
Can you guys help me with this.
9 years ago
thanks for your reply.
I understand the functionality but the thing how should i get signin/signout working?
9 years ago
I am using Web container based session as described above posts.
I need to display Sign in or Sign Out and hence i tried the below code


But the problem is the if condition always evaluates to true. How can i determine if the session does not exists and so i can display Sign in and once the user signs in and a session is created i want to display Sign Out

I even tried session.isNew() .


Even if i enter wrong credentials session.isNew() method returns false and i see sign out , when i should have seen sign in as i never entered the correct credentials.
9 years ago