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

kapil Gupta

Ranch Hand
+ Follow
since Dec 17, 2001
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 kapil Gupta

Hi,
I have the name of a javascript function as a variable. The function name may be in the form of MyNameSpace.myFunction.
One way is to use eval() but it is generally discouraged to use it.
Is there any other way to call a namespaced function whose name is stored in a variable?
Thanks,
Kapil
I was able to implement a dynamic combo with the help of this blog.
JSF SelectBox

Hope this will help you. The key here is that your managed bean should be in session scope. Other ways to implement this is also discussed in this blog
12 years ago
JSF
Hi Dan,

Am facing similar issue. Was able to find any solution for this?

Thanks,
Kapil
12 years ago
JSF
Hi,

I am facing problem in migrating my webapp to Tomcat 6. The issue is with using ResourceBundle using JSTL tags.

Am setting the resouce bundle anditerating over all the keys in my message bundle using following code


The above code is not executing well and I found that ${messageString.resourceBundle.keys} results in ???key???
But interestingly am able to a get a particular message using the below code

However, I overcame this problem using below hack


I could not understand why am not able to get resource bundle keys using JSTL tag.

Thanks,

Kapil
12 years ago
Am using Spring MVC for my web application. If I upload a file containing special characters like umlaut, they are converted to junk on the servlet side i.e. the MultiPart File object received shows junk in the file name attribute.

What could be the reason for this?
Thanks,
Kapil
Following is the pseudo code for login

The user name is set as member variable of MyCustomSessionObject class and retrieved in the JSP from session object.
14 years ago
Yes, there are not instance variables in servlets other than the singleton spring beans (service classes) that further validates the user from database.
14 years ago
Am developing a web application based on spring web MVC framework that runs in in tomcat server. The entry to the webapp is through a login page and after successful validation user is taken to home page that displays a greeting message like Good Morning Mr XYZ. The user name is set as session attribute from Login Servlet and is retrieved by the home page JSP.
During load testing it was noticed that the user name displayed in greeting message was of some other user. This problem occurred only twice and is not reproducible.
What could be the cause of this issue? Should I put the login code in synchronize block so there are no threading issues?
Thanks,
Kapil
14 years ago
Hi Paul,
Am converting XML received from a third party application to Html for editing purpose and then converting it back to Xml. The xml is then returned to this thirdparty application. There are some custom attributes which have to be maintained during this transformation and these attribute may contain white spaces. I have no control over the structure of XML. Is there any way to preserve the spaces? I tested this with Xml Spy and it preserves the extra white spaces but not with XALAN.
Thanks,
Kapil
Thanks for the reply Paul. Does that mean there is no way to have two consecutive spaces in the attribute value (other than to implement custom implementation of parser)?
Hi,
Am converting HTML to XML using java, XSLT. The HTML contains element having attribute value with white spaces, for example
<span attr1="There is double space here">some text</span>
The attr1 value contains two white spaces. When I convert this to Xml using XSLT, the extra white space is stripped.How can I preserve extra whitespaces for attribute value of an element.
Thanks,
Kapil
Hi,
Is it possible to get the nodes from the Range object?
My html consists of multiple div and span nodes, for example:
<div>start<span class="blue">text</span><span class="red">more text</span><span class="green">still more text</span>end</div
If the user selects the text between start and end and selects a class from a combo, I need to change the class of each span in the selection.
How can I get list of nodes from the Selection or Range?
Thanks,
Kapil
For creating two attribute am using the ancestor axis to get all nodes and iterating over them to check names.
The input is basically HTML and it is in the form of

So basically a span may contain n number of strong, em, strike tags in any order and I have to convert it into XML of the form

So if both strong and italic is applied to a text, I have to set two attribute s of richtext node.
The complete XSL is:

The other templates for em, strike etc are same as strong//text()

[ April 20, 2007: Message edited by: kapil Gupta ]
[ April 20, 2007: Message edited by: kapil Gupta ]
Ok, But What I could not understand is if the source content contains a tag say, strong and there is a template defined with match="strong//text()", then why the processor tries to process template with maximum priority and if the priority is same then it processes the last one again?
regards,
kapil