Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

himanshu.harish agrawal

Ranch Hand
+ Follow
since Oct 18, 2010
himanshu.harish likes ...
Oracle Java Linux
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by himanshu.harish agrawal

Bear Bibeault wrote:You will have to be clearer about what you are doing.



Precisely, I am creating an object in A.jsp; including it another JSP through include directive and include standard action. And I am able to access the properties of that object in both the cases.
You can try the same and I hope you will get the same results.

In nutshell: We can access the object created in one JSP into another JSP through include directive and include standard action.


Regards,
Himanshu
10 years ago
JSP

Bear Bibeault wrote:An include will not cause the same object instance to be shared across JSP pages.



Hello Bear,

I could get the access to object created in included JSP into including JSP, both though include directive and standard action.
I think we can get the access.

Please let me know if I am going in wrong direction.

Regards,
Himanshu
10 years ago
JSP
Hello Kumara,

Why do you want to have an object of org.ex.UserInfo in both JSP's. If your requirement suffice then I would prefer to have this object created in B.jsp and as you are including it in A.jsp then you would automatically get access to this object from B.jsp. I am not sure about include standard action but include idrective should do the job!

Makes sense?

Regards,
Himanshu
10 years ago
JSP
Before heading towards big daddies like Ajax and jQuery, try visiting . I think you get you solution.

Regards,
Himanshu
10 years ago
JSP

Arun Giridharan wrote:If the servlet was deleted and not the configuration in web.xml it must give ClassNotFoundException , why it's not giving the exception ???



Exactly, but only when you try to access that servlet, and luckily I didn't!

Regards,
Himanshu
10 years ago
JSP
Dude,

Here you go



uday singh rajpurohit wrote:The radio button is not selected in the next page.


If you had noticed then your drop was not working as well.
Also, you are not getting Gender text displayed, I will leave this to you to figure the problem!

Regards,
Himanshu
10 years ago
JSP

Bear Bibeault wrote:YOur web app is likely misconfigured.

Start from scratch building a web app



Hello Bear,

Thanks a lot!!! Yes, there were some issues in my web.xml; actually I configured a servlet in my web.xml but later I deleted that servlet but didn't delete its configuration in web.xml. Because of this, it seems my web container was causing issues. Once I deleted that configuration I could see my JSP scripltes executing well.

Silly mistake but a good lesson to learn!

Thanks again!!!

Regards,
Himanshu
10 years ago
JSP

Bear Bibeault wrote:It's likely sending the output to a log file somewhere. In any case, scriptlets have been discredited since 2002. You should no longer be using them in JSP pages.



Hello Bear,

Thanks for reply!!!

Ok, please see me rely which I have posted to Stefan. Even those scripltes are not working for me. It seems my JSP container is not working as my JSPs are not compiling.


Regards.
Himanshu
10 years ago
JSP
Hello Stefan,

Greetings and thanks for reply!!!

Below is the output which I got


Which suggests that my scriplets are not executing. And as I said I am not even getting compiled JSP servlets under "work" directory.
NOTE: I am not manually compiling my JSPs through ant task. I remember tomcat compiles them on its own.
My web context root is "webdav" and I am running it as below
Just as a try out I have tried to run this both in Jakarat Tomcat 5.0 also apart from Apache Tomcat 5.5.33 but none is displaying JSPs correctly. Initially I tried with default configurations and then I tried adding "Context" element in my conf/server.xml. But none is helping.
I remember that few months back I also was able to execute JSPs but then later my system was reformatted and now with new installation all these softwares My JAVA_HOME env. variable is also correctly set.
I am unable to execute my JSPs. :(

Please help me out as I am preparing for OCPWCD and my JSP container is not working. :(

Regards,
Himanshu
10 years ago
JSP
Hello,

I have written a very basic JSP as below:


But I am unable to see sysout in my console, which means that my scriplet is not getting displayed.
In am running it in Apache tomcat container 5.5.30.

If we see then JSP are complied under "work" directory for the generated servlet. But that directory is also not having any generated servlet. So, basically mu JSPs are not getting compiled and hence page is showing up as simple HTML page.

I having a hard time rectifying it. Somebody kindly help me out!

Regards,
Himanshu
10 years ago
JSP
@Javad: Just to add some information that is also going to work the same way because URLClassLoader and Object both are bootstrap classes and both are loaded by Bootstrap class loader. So, replacing with above code should also work.

@Wouter: Correct me if i am wrong; may be will differ from Javad's in the sense that with your's it will ask AppClassLoader to load the resource and in Javad's case it will ask Bootstrap class loader. And this should be useful as child loader (AppClassLoader) will have visibility into classes/resources loaded by parent class loader (Bootstrap class loader).

Regards,
Himanshu
10 years ago

Jason Cone wrote:If you have fields that are mutable, you should start with an object returned by super.clone() and then make sure you set the state for the mutable fields.



I think you mean to mention deep cloning by this, because this is what we need to do with mutable objects. But there is certainly a flip in it that the mutable object should also support cloning else you will land up with CloneNotSupportedException.

Thanks.
11 years ago
Lets try to do it your way ..



Don't specify any encoding scheme because by default it is UTF-8.

You can determine which encoding an InputStreamReader or OutputStreamWriter uses by invoking the getEncoding method, which you may be aware of ..

Thanks.
11 years ago