Abhishek Asthana

Ranch Hand
+ Follow
since Sep 08, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Abhishek Asthana

Detailed from the javadoc:



Returns a Boolean instance representing the specified boolean value. If the specified boolean value is true, this method returns Boolean.TRUE; if it is false, this method returns Boolean.FALSE.

Parameters:
b - a boolean value.
Returns:
a Boolean instance representing b.


Returns a Boolean with a value represented by the specified String. The Boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".
Example: Boolean.valueOf("True") returns true.
Example: Boolean.valueOf("yes") returns false.

Parameters:
s - a string.
Returns:
the Boolean value represented by the string.

And since the second method does not return an instance, it is recommended to be used instead of constructor Boolean(String value).

13 years ago
From the Boolean javadoc:



Wheras:




What I am not able to understand is that since for both methods return type is same, how come for one a new Boolean instance is being returned and for the other boolean primitive is being returned.

Any pointers will help.

Thanks
Abhishek
13 years ago
OK, this is the solution:
Instead of

or


do :
14 years ago
JSP
Actually I first tried using just

when that didn't work, I used


14 years ago
JSP
Yes, I tried passing encoding explicitly, but that doesn't work either. I am using Weblogic server. Can we set encoding for weblogic also?

Please Please Please guys, this is very critical for me. Please help!

Thanks
Abhishek
14 years ago
JSP
I have a form in which user can upload a file and another field 'name' in which she can give any name to the file being loaded. (Please see the image in attachements) When I submit the form, the file is uploaded fine but the value in name field is messed up. I have followed all the possible suggestions I found:

1) <%@page pageEncoding="UTF-8"%> set.
2) <%@page contentType="text/html;charset=UTF-8"%> set after the first directive.
3) <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> in the head.
4) enctype="multipart/form-data" attribute in the form.
5) accept-charset="UTF-8" attribute in the form.

in the Servlet:
1) before doing any operations on request object: request.setCharacterEncoding("UTF-8");

2) Getting the value:

On the UI, I can see the characters properly but when the value is being passed to java strings, all hell breaks loose!

But nothing seems to be working.

This issue is coming in this form only where enctype is multipart/form-data. Rest everywhere having just 1) and 2) work fine.
Can someone please give some ideas what can be going wrong?

Thanks
Abhishek
14 years ago
JSP
Hi

I created a small webservice using Jersey framework. I added couple of methods in the service. Below is the code:


I try to access the service using following client code:



The first method succeeds and gives list of users but second call fails with following exception:


I am not able to understand what is wrong here. I tried changing the path also users/8 and users/8/ both fail.
Can someone please give any clues?

Thanks
Abhishek
14 years ago
Hi

I am very new to Hibernate. I did my 'Hello World' with a Netbeans tutorial which showed how to generate the POJOs and mapping files from the relational tables, which seemed very logical to me!

However now when I am reading more about it, the books mention that classes are written first, then mapping files and then the DB is created. I am slightly confused. Can someone please tell me which is correct approach (I mean, how is it done in real world)

Thanks
Abhishek
That worked Shailesh.

Thanks very much.
Hi

I am using AJAX to save a name value. This is my JS code in the JSP file:



In my servlet I simply extract the parameters and use them:



This works fine until user gives name like 'This & That' (anything that has an '&'). When this happens the servlet gets only the string before & (eg. 'This ')
This is happening because it thinks that there is another parameter due to occurrence of &.

Using & doesn't work too, because & comes there also.

Can someone please suggest how can I work around this?

Thanks in advance
Joseph

If you have created a web project in NetBeans, you must be having a Web Pages folder under your project directory. This will have more folders like:
META-INF
WEB-INF
and your JSP pages.

You can create an images folder right here. And access the images simply images/imagesname.jpg

Hope this helps.

15 years ago
JSP
Rahul

You may want to have a look at MVC architecture. To put it simply, put your 'business logic' in servlet (if you don't want to put in some other 'model' class) and send it to JSP, which will form the presentation layer.

I guess you wanted to avoid business logic in JSP and hence decided to put presentation logic in servlet, but as Bear said it is not correct too!
15 years ago
Umm Leinad, let's put it this way: A browser doesn't know what is a JSP (or ASP/PHP/Ruby whatever), it can show only HTML.
A JSP page has HTML content interspersed with scriptlets/expressions/JSTLs which are executed on Tomcat to create HTML content, which is sent to browser. So in the end, our humble browser gets to see just the HTML stuff which it dutifully renders!

So, whatever javascript you want to put in your page, put it in your JSP. It will be untouched by server and sent to browser.

Hope this helps.

Abhishek
If it is a servlet, do the redirect conditionally.
15 years ago

Bauke Scholtz wrote:That does not necessarily have to be a form. A plain vanilla link can also perfectly point to some servlet.



That's right Bauke! Form is not needed. Thanks for correcting.
15 years ago
JSP