Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

soni lal

Ranch Hand
+ Follow
since Jan 31, 2011
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by soni lal

HI All,

                 I have a requirement to create ISO image file using Java.  I am using JIIC image creator and imported following jar :

I am trying to develop the code in eclipse but getting error :  The constructor ISO9660File(String) refers to the missing type Handler Exception at line no. 31, 33, 35, 69, 71. I am not sure what mistake I am doing ..  

    Please assist ....

The code is as follows :

3 years ago
Hi Paul,

Thanks for the reply!!

Yes you are right .... while displaying both the string one is getting printed as complete value i.e "LOC_DATA_CURRENCY\nMX EQ (EUR)\nAAL\n Gross Loss" ( I think \n is getting treated as two separate characters not as single i.e line separator)

if the same is hardcoded then the string is getting printed as :

Gross Loss

Now, what I have to do to split the string on basis of "\n" ...

Please help...
6 years ago
Hi Paul,

Thanks for your reply..

I have already debugged the code and also put SOP to print the value getting from list.. Copied the same value (LOC_DATA_CURRENCY\nMX EQ (EUR)\nAAL\n Gross Loss) from console and hardcoded in String variable.

But still split is working fine with hardcoded String variable but, not with the value getting from list.... This is really strange behavior......

Please help...

6 years ago
Hi All,

I an facing one very strange issue while getting string value from a bean and split it using pattern :

I have to get the value and split it on the basis of "\n" presenting in String. I am doing as follows :

String attributeName = (attributeList.get(i).getName());
Pattern pattern = Pattern.compile("\n");
String[] formatArray1 = pattern.split(attributeName,0);

Problem : THe split is not working
But, If the same string value is hardcoded then split works perfectly fine as follows

String attributeName = "LOC_DATA_CURRENCY\nMX EQ (EUR)\nAAL\n Gross Loss";
Pattern pattern = Pattern.compile("\n");
String[] formatArray1 = pattern.split(attributeName,0);

This code is working fine and giving the length of array as 4.

I am not getting why it is not working as expected if getting from list .

Someone please assist. I got completely fed up and not finding any solution.....
6 years ago
I have a code in my project to open a calendar in child window on click of a link in home page. The calendar has 2 drop downs (for month and year). The calendar drop down is working fine in all browser except IE9.

In IE9 the drop down is not getting displayed. On click of arrow button of drop down nothing is happening. I am debugging the javascript in browser , I tried to add few new style to the <select> tag in debugging tool only, e.g height : 50px then the drop down came but, If I am adding the same property in code then it is not working......Cleared the browser cache then verified but still the style changed through code is not reflecting at all.

The code to print calendar is in javascript as follows :

// html generation (feel free to tune it for your particular application)
// print calendar header
var str_buffer = new String (
" <title>"+calendarText+"</title>\n"+
"<link rel=stylesheet type=\"text/css\" href=\"/GPS/theme/style_gps_guide_ie.css\">"+
"<body bgcolor=\"#4682B4\">\n"+
"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"210\">\n"+
"<tr><td bgcolor=\"#4682B4\">\n"+
"<table STYLE=\"table-layout:fixed\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
"<td colspan=7 width=210 height=130 align=center>\n");
"<select ID=\"dropmonth\" class=\"blueText\" style=\"font-family:Verdana, Geneva, Arial, "+
"Helvetica, sans-serif;font-size:10px;height:52px;display:inline-block;"+
"background-color:#DBEAF5;color:black;width:100\" "+
"'"+str_target+"','"+ dt2dtstr4(dt_datetime)+"')\">\n";
for(z=0;z<monthNames.length-1;z++) {
"<OPTION value=\""+(z)+"\"";
if(z == dt_datetime.getMonth())
str_buffer+=" SELECTED";
"<SELECT ID=\"dropyear\" style=\"font-family:Verdana, Geneva, Arial, "+
"Helvetica, sans-serif;font-size:10px;line-height:12px;"+
"'"+str_target+"','"+ dt2dtstr4(dt_datetime)+"')\">\n";
for(z=1950;z<2051;z++) {
"<OPTION value=\""+z+"\" ";
if(dt_datetime.getYear() >1999){
if(z == dt_datetime.getYear())
str_buffer+=" SELECTED";
if(z == "19" + dt_datetime.getYear())
str_buffer+=" SELECTED";

// print calendar footer
str_buffer +=
"</table>\n" +
"</tr>\n</td>\n</table>\n" +
"</body>\n" +

I am totally exhausted... not getting any solution that why in IE9 drop down is not working and why the new style attribute is not showing its effect...

Please help... I really need help to solve this issue......

Thanks in advance..
Hi All,

My application has been developed using following tools:
JSF, JBOSS server, seam framework
Now, there is a requirement to make one Http servlet call which will redirect to one jspx page to end user.

In my servlet I am getting FacesContext instance and trying to get access to jspx file. Please find servlet code below :

public class LocationSummaryServlet extends HttpServlet {
public LocationSummaryServlet() {}

private LocationLookUpServiceImpl getLookUpServiceImpl() {
return (LocationLookUpServiceImpl) Component

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
String locationID = request.getParameter("locationID");
String flag = request.getParameter("flag");
out.println("locationID::::"+locationID+" flag :::::"+flag);
FacesContext fc=new LocationFacesContextHelper().getFacesContext(request, response);
System.out.println("::::: facesContext ::::: "+facesContext);
UIViewRoot uiViewRoot= fc.getApplication().getViewHandler().createView(fc, "/location/location.jspx");


import javax.faces.FactoryFinder;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.context.FacesContextFactory;
import javax.faces.lifecycle.Lifecycle;
import javax.faces.lifecycle.LifecycleFactory;
import javax.servlet.http.*;
public class LocationFacesContextHelper {

protected FacesContext getFacesContext(HttpServletRequest request, HttpServletResponse response) {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null) {
FacesContextFactory contextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

facesContext = contextFactory.getFacesContext(request.getSession().getServletContext(), request, response, lifecycle);

// Set using our inner class
// set a new viewRoot, otherwise context.getViewRoot returns null
//UIViewRoot view = facesContext.getApplication().getViewHandler().createView(facesContext, "/location/location.jspx");
// facesContext.setViewRoot(view);
return facesContext;
private abstract static class InnerFacesContext extends FacesContext {
protected static void setFacesContextAsCurrentInstance(FacesContext facesContext) {


I am getting the facesContext instance but the jspx file is not getting called.... meither I am getting any exception.

I am not getting the problem... I wasted my 3 days to find out the root cause....

Please anyone suggest that is my approach is right to access a jspx file from HTTP servlet ... If yes then why it is not working...

Thanks in advance !!!
7 years ago

I am using following technologies to develop my application:
Seam 2.2
JBoss 5

The security configuration has been done Pages.xml and components.xml.

In Pages.xml following configuration is done :
<page view-id="/*" login-required="true" /> // It will redirect all the request to login page if the user is not logged in.

In Components.xml following code is done:
<security:identity authenticate-method="#{authenticator.authenticate}" /> // This will go to authenticate method for authentication.

Now, I have to bypass the authentication for a specific page.

The requirement is : One other application will try to hit our application url to get access to One particular page. That page will be shown to them as readOnly page.
For this, I created one servlet and through that servlet trying to call one method in following class :

public class LocationViewController implements Serializable {


While calling the above given class from the servlet, I am still getting the login page and getting following exception in console:

ERROR [[LocationSummaryServlet]] Servlet.service() for servlet LocationSummaryServlet threw exception
java.lang.IllegalStateException: No application context active
at org.jboss.seam.Component.forName(
at org.jboss.seam.Component.getInstance(
at org.jboss.seam.Component.getInstance(
at org.jboss.seam.Component.getInstance(
at org.jboss.seam.Component.getInstance(
at com.agcs.locmgmt.web.location.LocationSummaryServlet.getViewController(
at com.agcs.locmgmt.web.location.LocationSummaryServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at com.agcs.locmgmt.web.seam.CookieMapServletFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(
at org.jboss.seam.web.LoggingFilter.doFilter(
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(
at org.jboss.seam.web.ExceptionFilter.doFilter(
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(
at org.jboss.seam.web.IdentityFilter.doFilter(
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(
at org.jboss.seam.servlet.SeamFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(

Please help me that how I can bypass login page for the requested servlet call.

Thanks in advance.
Hi All,

I have to make one synchronous ajax call which solves cross site domain issue.

The ajax call using window.XMLHttpRequest throws error while making call in cross domain.

The ajax call using JSONscriptRequest supports only asynchronous ajax call.

I tried in third way. But it is also not be bale to make synchronous ajax call. Please find the code below:

url = url + '&callback=' + "ACFeedStatistics.callbackSuccess";
var head = document.getElementsByTagName('head')[0];
script = document.createElement('script'); = 'xdShortcutContainer';
script.type = 'text/javascript';
script.src = url;

I am totally stuck.

Please help me.

Thanks in advance!!

Hi All,

I am facing Cross Site Script error while making AJAX call using XMLHttpRequest(). I used following code to resolve the issue : http.setRequestHeader("Access-Control-Allow-Origin","*");

Please find the code :
if (window.XMLHttpRequest) { // code for IE7+, FF, Chrome, Opera, Safari
http=new XMLHttpRequest();
else { // code for IE6, IE5
http=new ActiveXObject("Microsoft.XMLHTTP");
}"GET", url, true);

Issue : After adding this statement " http.setRequestHeader("Access-Control-Allow-Origin","*");" the AJAX call only is not happening.
I am not getting any error also.

But, not getting why it is not working.

Please help me. If any other way is there to solve Cross Site Script error then also suggest me.

Thanks in advance !!
Hi All,

In my project I have a requirement that on unload of page one ajax call has to happen . As per the url of this ajax call , it will go to one jsp and update some values in database.

Problem : The ajax call is happening, url is also getting created but the control is not going inside the jsp.
If I make the same call on load of page then the jsp is getting called properly.

I tried to make a synchronous ajax call but still same problem.

Please find the code snippet below:

Event.observe(window, 'beforeunload', function(){
// Apple Instant Feed statistics code
if(locale.indexOf("en")!=-1 && (enableAppleInstant == "yes")){
var store = new Persist.Store('FeedStats');
if (store.get('resultActivity')=='true' && store.get('<%=articleNo%>') !== null){
var time = new Date();
var timeDiff = time.getTime() - store.get('<%=articleNo%>');
if (timeDiff < 3000){
var feedStats = new ACFeedStatistics();
feedStats.updateNotRead('<%=articleNo%>', store.get('position'));

Here timeDiff is checking whether the page got unloaded before 3 secs.

Please anyone suggest me how to do the same.

Thanks in advance!!

Hi All,

In my application web pages have several buttons and the application is for all locale.

The Button is coming properly in all locale except Japanese locale. For ja_JP locale the button is getting slightly defomed in IE browser.
In safari and mozilla it is coming perfect.

Please anyone help to solve this issue.

Thanks in advance
Hi All,

I need to track that the page has been refreshed or been referred by some other page.

I used document.referrer for this. It worked like a charm in all browser except IE .
In IE document.referrer is returning space all the time.

So, my functionality is breaking in IE.
Now I got stuck.

I am looking for any other way to get to know that the page has been refreshed
or, to make document.referrer work in IE

Please any one help.

Thanks in advance!!
Hi All,

I have to get the referral URL.

I tried with following method in javascript:
a) document.referrer
b) window.document.referrer

Both are returning correct value in safari and mozilla but in IE both are returning space.

I tried to use Java API method : request.getHeader("Referer");

This is also returning correct value in safari and mozilla but in IE it is returning null.

I am really surprised that how every method is returning space or null in IE.

Does anyone have any idea about it?

Please help me!! I am not getting any other way which can work in all browser.

Need your help.

9 years ago
Hi Eric,

Thanks for the reply!!

In my application document.referrer is working absolutely fine in safari and mozilla but in IE it is returning blank space.

I am serving it with http protocol only.

document.referrer is not working fine in safari but in IE it is returning space.

Which method should be used in IE to get the URL of the document that loaded the current document.

Please anyone help me.

Thanks in advance