Vishnu Prakash

Ranch Hand
+ Follow
since Nov 15, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Vishnu Prakash

After some research, I found the issue is not with the charset getting appended to the content type.

As the warning message states, the browser couldn't recognize the extension. So based on the file extension, I dynamically appended the extension.


.do for all types of files like jpg, pdg, doc, docx, txt, html

replace the .do with .xls(or).xlsx based on the file extension of the attached file. In this way browser does not throw the warning message and opens the xl file.

Put the .xls and .xlsx mappings in web.xml for action class.

8 years ago
While downloading Excel documents both 2003 (xls) and 2007 (xlsx) I am getting a warning message pop-up with "Yes"\"No"

The file you are trying to open, '' is in a different format than specified by the file extension. Verify that the file is not corrupted and is from
a trusted source before opening the file. Do you want to open the file now?

Though I set the content type header with application/ (excel 2003) and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (excel 2007), I see charset=UTF-8 is appended automatically to the content type header.

Content Type Header: application/; charset=UTF-8

Am I getting the warning message because of the charset being appended at the end of the content type header? If yes, is there a way to remove it?

Any help would be greatly appreciated?
8 years ago
Hi Ranchers,

I have 2 tabes, one below another. First table contains country details like name, population, capital, etc and second table contains states, population and other related details.

On click of one of the rows in first table related information should be displayed in the second table accordingly.

Requirement is this should happen without page refresh. So AJAX is the way to go. My question is since we are going to populate a table with data, can we accomplish this using simple AJAX or should we be using any AJAX framework?
I am having a String which contains a hypen. I am using JDBC to connect to Oracle 10g database. When the string content is stored in the database hypen gets converted to inverted question mark.

Any suggestion on how to retain the hypen in database is greatly appreciated.

[ September 23, 2008: Message edited by: Vishnu Prakash ]
[ September 23, 2008: Message edited by: Vishnu Prakash ]

I didn't know where to post my design question. Here is my requirement.

In my application we are implementing record locking concept. There are 2 different kinds of users. A normal user and a super user. There are 2 columns in my table where user's name and current locked by time will be stored. I have a button called lock in my page. When a normal user clicks the lock button then that particular record is locked by the normal user for 30 minutes. After 25 min there should be a pop-up message stating there is only 5 min left. After that a SQL query should be triggered which removes the user's name and time from those columns.

When a normal user has locked a particular record then another normal user cannot lock the same record. Whereas a superuser can lock the same record which was locked by a normal user. In this case the normal user must be notified that the lock has been taken by a superuser and he cannot edit the request any more and the control to go the search screen.

Coming to implementation part, calculating the 30 min can be done using two ways.

Using the setTimeout function in JS and
Using Thread in Java layer.

With javascript function implementation is easy. With threads we can calculate the time, but how to notify to the user after 25 seconds? How to take back the control to UI from java layer. I am using Struts 1.2.

I have the same doubt when superuser locks the record which is already locked by a normal user. How to notify the normal user (with a pop-up) about the changes that has taken place in back end. I am not using AJAX. Is it possible to achieve this with and without AJAX.

Please suggest me a solution without AJAX.
Thanks for your response.

I am using Struts in my application.

This is my requirement. I have couple of columns in a table where one is a key and another is a value. I need to show those values in those pages which are mapped to the key(different pages are identified by using the key).

I thought of using a generic JSP page and control the display with logic equal tags. But my problem is how to trigger the query to fetch the values in the included JSP page.

Is there a better design to this requirement.
10 years ago
I have a parent JSP, lets say JSP-1 and a small jsp (JSP-2)which will be included in JSP 1.

Whenever jsp 1 is loaded I want jsp-2 to make a call to db and fetch the latest values. The real challenge is we don't have any buttons to use. The invocation should happen on the fly.

Can we do this without having java code in the jsp page?
10 years ago
Thanks for your reply Bear.

Is it possible to achieve the same using any struts tags.

Of course you need to get your users to tell you what time zone they are in. Most sites with registration make this part of the member profile.

Users will be logging into the application using sso. Can't we just render the page as per user's locale specific time.
10 years ago

My application is accessed across the globe. I am setting the date and time in java layer and displaying it in JSP. The server is running in US. When ever someone outside US wants to look at the date and time on screen, they will be looking at the US time and date. I want it be locale specific. I guess it should be done at JSP page level. Can you please give inputs on how to implement the date and time for locale specific.
10 years ago
Hi All,

I am doing a action chaining. I have my scope as session in both the action mappings of action classes. I set few properties(5 values) in action 1 before sending to action 2. In action 2 I couldn't see few property(2 values) values. Then I set those 2 values in request attribute in action 1 and received in action 2.

Later I had a requirement where we aren't supposed to use request attributes. I used redirect attribute of forward tag.

<forward name="abc" path="/app/" redirect="true"/>

I started getting the values of those 2 properties without request attributes. As I understand redirect kills all request attributes/parameters. But couldn't understand how redirect attribute is setting the value of those 2 attributes.
10 years ago
how to find if a field exists in the parent form from pop-up windows javascript?
Thanks for your response Bear.

Here is my requirement.

Using indexed properties I iterate through the name List and assign myName property to a textbox in my JSP page.

Adjacent to the textbox I have a link which opens a pop-up window, which has a textbox and a submit button. On click of submit button the value entered in the textbox should come and sit in the parent windows textbox.

If the parent windows textbox property is in the parent form as a String setting is simple and straight forward.


But in my case the property is in a bean object which I iterate dynamically.

I don't know how to get the value from pop-up window to parent window. Can you please suggest me a way out.
10 years ago
[ November 02, 2007: Message edited by: Vishnu Prakash ]
My form bean object has an arraylist (or) simply list property like

class MyForm extends ActionForm {

private List name;
private String department;


We can directly set the department property in javascript like


But name property contains a bunch of objects(since it is a ArrayList (or) List) of type EmployeeName class which has the property myName of String type.

class EmployeeName {
String myName;

I am using indexed properties to iterate through the name List and display the myName property in my JSP page.

For one particular scenario I need to set the myName property via Javascript.
10 years ago
To set the name property in a form we can simply specify


But how to set the same name property thats part of a class thats inside an ArrayList which is
in a form?

This doesn't work

10 years ago