Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Chetan Ram

Greenhorn
+ Follow
since Mar 10, 2011
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 Chetan Ram

Hi All,

In my struts based application, we have requirement where

point 1. User selects a name of an employee (click a link) where all his peers and managers name will be displayed in a table on a new page.
point 2. On that new page, we have another link "download details"
point 3. By clicking the link, user will be taken to another page which contains all peer and manager employee information.
point 4. On this page, users can download by clicking "download" link as we provide users to select what information of the employee to download like name, empID, department and so on.

Now, when users selects point 1. then we run a query which gets all the information about employee, peers and managers
when user clicks on link "download details" i.e. point 3. then we run another query by passing the employee, peers and managers information selected in the table.
when user clicks on link "download" point 4. then we run another query which get all the information about employee, peers and managers from the list.

The question is

During point 3. i.e. user clicking on link "download details", can we redirect the request to another server which uses same database?
For eg: The original URL will be https://testserver.com to https://dataserver.com to process the download i.e. point 4..

Thanks in advance

Regards,
Chinnu




8 years ago
Thanks Mark for the response.

I understand that it might take more time to write an example. Can you please provide a link which contains the information or sample needed?

Regards,
Chinnu
8 years ago
Hi,

I have an application which are used by recruitment team. I am using Spring mvc 3.1 annotations.

I have a page where new user information is entered like User profile, Experience, Projects & technology worked.

I am using tabs
i.e. first tab is for User Profile contains user name, age, address etc... with in a form using spring form
second tab is for Experience contains 1st, 2nd and 3rd previous companies worked with in a form
and third tab for Projects & technologies used with in a form.

Initially, only User Profile tab will be enabled



One JSP file contains all the forms, I don't want to have page refresh on adding each user information so want to make AJAX request to add User information i.e. on click of user form button then addUserInfo() method is called which makes AJAX request.

Same approach for adding User Experience and project.

After sending request, I want to know whether User information was successful added to data base or not. If successfully added, I want to return "success" or else "failure".

If the response contains "success" then I will enable next tab i.e. Experience and follow same approach to enable Projects & Technology

Thanks in advance.

Regards,
Chinnu
8 years ago
Thanks for the quick response.

My understanding is that " In Action class, instead of declaring instance variable we should declare them as local variable. So that values will not be shared among multiple users or threads."

This should resolve the issue we have.

Please let me know my understanding is correct.


Thanks,
Chinnu
9 years ago
Hi All,

I am working on a struts based application.

I need help in understanding the concept of maintaining privacy of the user and not disclosing other users trying to do.

When user logs into the application and do a company search and try to find its details. The user is getting to see different company information.

Reason : There is an automation code running at the background and trying to retrieve a list of company details.

So, when user tries to retrieve a company details information, the user see a company details that was running in the background by automation code.

for ex: If user wanted to see or download Sony company information instead user is getting different company details like LG comapany i.e. because at that point of time automation code is trying to retrieve LG company information in the back ground.

This is because the form data is getting updated by the time users try to retrieve company details.



Below are my thoughts:

1. May I know what will be best solution is it using synchronization will help but I believe it affects performance?
2. Is it a good idea to store company information in a session?

Please let me know if I am not clear about my question.

Thanks in advance

Regards,
Chinnu
9 years ago
Hi,

I am new to struts.

I have an arraylist which contains beans

i.e. ArrayList --->
bean1 -- name, dept
bean2 -- name, dept
bean3 -- name, dept
bean4 -- name, dept

I want to iterate over the arraylist and print them comma separated.

I must put "," after every element expect last element.
Currently, I am using <logic:iterate>.



Can any one please let me know how to get last element?

Thanks,
Chinnu
10 years ago
Thanks for the reply.

we store bean objects in an arraylist. So in JSP, we get arraylist which contains beans.
I want to pass bean properties values to javascript.

Expected : I want to pass bean properties values to datagrid to display it in UI.

What I understand is that data needs to be passed to form the datagrid content to display.
I am trying to use dojo datagrid.
10 years ago
JSP
Hi,

I have a bean class Person which has properties like name, age




I want to pass bean property values to javascript function for further use.

I can use struts <logic:iterate> or <c:foreach> to iterate over the bean properties.

Thanks for any help.

Chinnu
10 years ago
JSP
Hi All,

In our application, we can download files in 2 formats excel and ods (Open document spreadsheet).

In implementation level:

Excel format uses xml i.e. when a excel download is invoked it gets data from database (executing multiple complex queries). Here, each query result is written directly to response (output stream) i.e in the format which is readable by excel file.

for example:

rs = stmt.executeQuery("select * from ABC");
out.write(rs.getString(1));
out.write(rs.getString(2));
rs = stmt.executeQuery("select * from DEF");
out.write(rs.getString(1));
out.write(rs.getString(2));

ODS file is a zip file which contains list of xml files. So when user selects ODS format to download then we need to generate all the xml files based on the data retrieved from database (executing multiple complex queries).

So, during this process i am getting Error 400 which says "proxy did not receive data from origin server. so connection was closed".
i.e. proxy server waits for 2 mins to get response from origin server, if it doesn't get any response then it closes the connection.

The problem is : executing db complex queries (takes 2:50 mins) and based on data received we generate 5 xml file and zipping all the files (takes 10 sec) i.e. totally it takes more than 3 mins. And later we pass the zip file to response outputstream. By the time it execute, we get Error 400.

Can anyone let me know if there is any approach where we can keep our response output stream busy, so that we can avoid Error 400 and download successfully or change the ods file download implementation approach?

Thanks,
Chinnu
10 years ago
Hi All,

I am getting Error 400 - Proxy Error: remote host didn't send any data.

In our application, we can download files by clicking on download link which has 2 options.
i.e. 1. download by excel
2. download by ODS format (Open document spreadsheet).

When the file size is lesser, then both the download option is working fine.
When the file size is huge (greater than 60 MB), then download by excel works fine, but download by ODS format doesn't work.

The above scenario is happening only in UAT (User Acceptance test) environment. But same code is working fine for all the scenarios in DEV and SIT (System Integration) environment.

From implementation point of view:

In excel, we write data directly to the output stream response object which will collected as text/excel.
In ODS format, we create 5 xml files and write the respective data to those file and then zip them and send the zip file to output stream response object.

Is this error 400, because its getting response timed out?

Please let me know how to fix this issue.

Thanks,
Chinnu.
Hi All,

We have deployed our application to a server in which JVM is crashing many, many times there are lot of heap dumps getting created in WebSphere6. In fact, our application's JVM is crashing every few minutes, creating 120MB dumps each time. Clearly there is something wrong with the application that needs to be addressed and until the app JVM crash issue is corrected, the WAS filesystem will continue to fill, causing problems with deployments and general WAS sanity.

If heapdumps are getting created and JVM is getting crashed everytime on server. Does this behavior should happen to me locally i.e development box? If locally, not able to produce. How do i handle this issue?


Thanks,
Chinnu
10 years ago
Hi All,

How do i convert huge file data (more than 100 MB) to byte array. Please let me know.


Thanks,
Chinnu
10 years ago
Thanks for the reply.

Does this affect performance since every 100 Kb we need to read from input and buffer it and then write to a file every time?
Does this make process slow? Please give me a sample if possible.
10 years ago
Hi All,

I have a file which is more than 100MB which needs to be written to a output stream (ServletOutputStream) as a response to a request where we can write byte array to a output stream. (outputStream.write(byte[])

Currently, i am using apache commons IOUtils package,

IOUtils.toByteArray(InputStream inputStream)
but this is not working when the file size is more.


Please let me know the better approach with good performance to handle huge files like more than 100MB.

Thanks,
Chinnu
10 years ago
Hi All,

I have 2 projects -

1. ProjecttContent - {context path ---> /hardware/xl/abc/content}
|--------------WebContent
|-----------ODSFileContent
|---------------- content.xml


and ProjectWeb - {context path ---> /hardware/xl/abc}
|-------------- JavaSource
| -------------- package com.xl.abc.data
| ---------- ContentData.java


Now, in ContentData.java i need to get content.xml file to do further operation which is in ProjectContent project.

In ContentData.java ------

I am getting contextpath from request. which returns /hardware/xl/abc since this java file is in ProjectWeb.

As content.xml is in ProjectContent, so appended /content to context path which is returned from request in ContentData.

i.e. request.getContextPath(); returns /hardware/xl/abc

BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(request.getContextPath()+"/content.xml"));

[3/30/11 21:53:06:328 IST] 0000003e SystemErrR java.io.FileNotFoundException: \hardware\xl\abc\content\content.xml (The handle is invalid.)
[3/30/11 21:53:06:343 IST] 0000003e SystemErrR at java.io.FileInputStream.open(Native Method)
[3/30/11 21:53:06:343 IST] 0000003e SystemErrR at java.io.FileInputStream.<init>(FileInputStream.java:129)

Please let me know how to get access to content.xml which is in ProjectContent from ContentData.java in ProjectWeb

Thanks,
Chinnu
10 years ago