Vani Bandargal

Ranch Hand
+ Follow
since Oct 06, 2005
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 Vani Bandargal

We have configued our database package to output its log statments to databaselog. It works fine. However, I want to know if there is any way to output log statements from a method(within the database package only) to a separate log file(not to the database log file).


Thank you
I solved my problem using TinyMCE

I could have done the same using FCKEditor too and felt that TinyMCE is easier to integrate.

Basically I needed to achieve 2 things in our text area
1. Allow some basic formatting features(like bold, underline...)
2. Render a Clickabale links.

#1 is resolved since with TinyMCE, the normal text area we had before is now a rich text area whih allows all formatting.
#2 is not completely resolved but still OK with some work around
It is not possible to have clickable links directly in any editor(rich text editor) be it be using FCKeditor or TinyMCE or some other tool.
One has to hold Ctl key + click in order for a link to work.

Other way for clickable links would be through preview option available in rich text editor. We are OK with this now

[ October 15, 2008: Message edited by: Vani Bandargal ]

[ October 15, 2008: Message edited by: Vani Bandargal ]
[ October 15, 2008: Message edited by: Vani Bandargal ]
12 years ago
Thank you very much Joe Ess.

I just learned from the url mentioned below that FCKeditor is the solution.
I came back to this website and you confirmed it too. I am glad that I am heading in right direction.
http://www.oreillynet.com/onjava/blog/2006/02/integrating_a_richtext_widget.html

I do have few more questions on this.
1. I downloaded the FCKeditor 2.6.3 and not the FCKeditor.Java. Is this correct?
2. Is this OK only to copy the js file to my project or do I need to copy all the files available in that zip on to my project?
12 years ago
I have learned from googling that html text area do not recognize hyperlinks.
I am using stuts html:textarea in my code which eventually render the regular html text area to the browser.
Is this correct to use ruch text area for this ?
Please correct me if I am correct.
[ October 10, 2008: Message edited by: Vani Bandargal ]
12 years ago
We want to show some hyper links in the text area (which is basically user comment area in the application).
User should be able to click on that link which is inside the text area.

Any suggestions on this.

Thank you
12 years ago

Originally posted by James Clark:


There is a way to handle your requirement programatically. You need to keep track of the directory name and the file name of the file being uploaded. The directory name is the tricky part. You will need to manually enter this when deploying the application as a parameter.



Thank you very much James for taking time to answer my question.

We just now tried to create ActionForward object in our action class like below using the getHostURL method that I explained in my earlier post.

It is still showing the file name along with the directory up on the server where we have stored that file.

Please see the code below.

public class ReportTesterAction extends Action {
.
.
.
ActionForward forward = new ActionForward(getHostURL(request) + report_output_loc + report_output_file, true);

return (forward);
}
[ August 07, 2008: Message edited by: Vani D Bandargal ]
12 years ago
I would like to add more information to help us find the solution.
We have means to check which server the app is on.

We have a file up on each server (ServerType.txt) which will contain DEV or TEST or PROD values depending on where that file itself is.

We are already doing something like this to get the host name in other situation.

protected String getHostURL(HttpServletRequest request)
{
HttpSession session = request.getSession();
String hostURL="";
String deploymentType = HinProperties.getHinProperties().getStage();

if (deploymentType.equals("") || deploymentType.equals("DEV"))
{
hostURL="https://devserver.mycomany.state.xx.us/";
}


if (deploymentType.equals("TEST"))
{
hostURL="https://testserver.mycomany.state.xx.us/";
}


if (deploymentType.equals("PROD"))
{
hostURL="https://prodserver.mycomany.state.xx.us/";
}
session.setAttribute("hostURL",hostURL);
return hostURL;
}
12 years ago
Thank you James.
Can you please share how to do the same.

Also, is there a way to handle this dynamically?
Please note that the file that we are pointing to on the server is not same.(file names could be different)

It is a file that user uploaded to the server. We will let user to review the file once he uploaded. We will let user to review only once as soon as he uploaded. There is no second chance once he logs off

[ August 07, 2008: Message edited by: Vani D Bandargal ]
[ August 07, 2008: Message edited by: Vani D Bandargal ]
12 years ago
Thank you very much Merill.

I apologize for not fully explaining the requirement.

We deploy this application on different servers like demo, test server and the actual prod server. Depending on the server, the path gets changed. how do we handle this?
[ August 07, 2008: Message edited by: Vani D Bandargal ]
12 years ago
In our struts application, we are redirecting to an HTML file on the server on some button click. We have following requirement for the same.
1.Don't show the name of the file that's up on the server
2.The path where the file is loacted.

We want to know if there is a way to achieve both 1 and 2 OR atleast any one of this.

thank you for any suggestions.
[ August 07, 2008: Message edited by: Vani D Bandargal ]
12 years ago
Thanks for the reply. I figured it out that I was not convering Byte to char. Very silly mistake.

Here is what we did

public ActionForward doUpload(ActionMapping mapping,ActionForm form,HttpServletRequest request,
HttpServletResponse response) throws Exception{
try {
ExampleForm csForm = (ExampleForm ) form;

// Process the FormFile
FormFile myFile = csForm.getMyFile();
String contentType = myFile.getContentType();
String fileName = myFile.getFileName();
int fileSize = myFile.getFileSize();
byte[] fileData = myFile.getFileData();
StringBuffer fileContent = new StringBuffer();

char chars[] = new char[fileData.length];

for (int x = 0; x < fileData.length; x++) {
chars[x] = (char) fileData[x];
fileContent.append(chars[x]);
}




csForm.setUploadFileData(fileContent.toString());

request.setAttribute(mapping.getAttribute(), csForm);

} catch (Exception e) {
System.out.println("Exception: " + e);
logger.error("Exception: "+ e);
throw new WebException(e);
}
return mapping.findForward(IConstants.SUCCESS_KEY);
}

You are correct. as you mentioned we took that to a form variable and the textarea in the jsp is assigned that property.
[ August 01, 2008: Message edited by: Vani D Bandargal ]
12 years ago
We want to write the contents that we read from a file to a textbox.

Can anyone please share how to do this.

This is how we are reading the file
public ActionForward doUpload(ActionMapping mapping,ActionForm form,HttpServletRequest request,
HttpServletResponse response) throws Exception{
ExampleForm csForm = (ExampleForm) form;

// Process the FormFile
FormFile myFile = csForm.getMyFile();
String contentType = myFile.getContentType();
String fileName = myFile.getFileName();
int fileSize = myFile.getFileSize();
byte[] fileData = myFile.getFileData();

System.out.println("contentType: " + contentType);
System.out.println("File Name: " + fileName);
System.out.println("File Size: " + fileSize);
System.out.println("File data: " + fileData);

return mapping.findForward("success");
}

User clicks on the Browse button(implemented using html:file tag) to select the fileName and then clicks on Upload button.
This calls the doUpload method that I mentioned above. After this we need to write the contents of the file to a text box shown below the Upload button on the jsp.
12 years ago
restToken basically invalidates the current token assigned to the page. so, if sombody tries to resubmit the page using the browser back button, since the restToken already invalidated the token assigned that page, it will not be processed.
13 years ago
If you want to aviod resubmitting the page using the browser back button, this is what we can do.

1. On load of page(in the action class method that you call while loading the page) ,
call this method : saveToken(request)

2. On submitting the page(in the action class method that you call when submitting the page), before you start processing the the form elements(contacts infromation in your case),
call this method: isTokenValid(request)
Ex:
if(!isTokenValid(request)){
return mapping.findForward("displayReSubmitError");
}

3. At the end of the method that you called on submitting the page, (after you process the contacts information),
call this method: resetToken(request)
[ December 27, 2007: Message edited by: Vani D Bandargal ]
13 years ago
Thank you.
Yes, I am using code from this. http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip2.htm.

This shows up tolltip when I hover the mouse on select box, which is good but I would like to show tool tip when I hover mouse on each options(items) shown in the dropdwon. I mean I expand the dropdowwn, and as and when I hover the mouse on each of the item, a tool tip must be shown. Is there any event to capture on mouse over of each of the option list?
13 years ago