soni lal

Ranch Hand
+ Follow
since Jan 31, 2011
Merit badge: grant badges
For More
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 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 :
iso9660.jar
jiic-1.2.2.jar
sabre-2.0.1.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 :

7 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)
but,

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

LOC_DATA_CURRENCY
MX EQ (EUR)
AAL
Gross Loss


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

Please help...
9 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...

9 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.....
9 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 (
"<html>\n"+
"<head>\n"+
" <title>"+calendarText+"</title>\n"+
"<link rel=stylesheet type=\"text/css\" href=\"/GPS/theme/style_gps_guide_ie.css\">"+
"</head>\n"+
"<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"+
"<tr>\n"+
"<td colspan=7 width=210 height=130 align=center>\n");
str_buffer+=
"<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\" "+
"onchange=\"window.opener.rollCalendar(dropmonth,dropyear,"+
"'"+str_target+"','"+ dt2dtstr4(dt_datetime)+"')\">\n";
for(z=0;z<monthNames.length-1;z++) {
str_buffer+=
"<OPTION value=\""+(z)+"\"";
if(z == dt_datetime.getMonth())
str_buffer+=" SELECTED";
str_buffer+=">"+monthNames[z+1]+"</OPTION>\n";
}
str_buffer+=
"</SELECT>\n"+
"<SELECT ID=\"dropyear\" style=\"font-family:Verdana, Geneva, Arial, "+
"Helvetica, sans-serif;font-size:10px;line-height:12px;"+
"background-color:#DBEAF5;color:black;width:60\""+
"onchange=\"window.opener.rollCalendar(dropmonth,dropyear,"+
"'"+str_target+"','"+ dt2dtstr4(dt_datetime)+"')\">\n";
for(z=1950;z<2051;z++) {
str_buffer+=
"<OPTION value=\""+z+"\" ";
if(dt_datetime.getYear() >1999){
if(z == dt_datetime.getYear())
str_buffer+=" SELECTED";
str_buffer+=">"+z+"</OPTION>\n";
}else{
if(z == "19" + dt_datetime.getYear())
str_buffer+=" SELECTED";
str_buffer+=">"+z+"</OPTION>\n";
}
}
str_buffer+=
"</SELECT>\n"+
"</td>\n</tr>\n";


// print calendar footer
str_buffer +=
"</table>\n" +
"</tr>\n</td>\n</table>\n" +
"</body>\n" +
"</html>\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
.getInstance("LocationLookUp");
}

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");
fc.setViewRoot(uiViewRoot);
}

}


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
InnerFacesContext.setFacesContextAsCurrentInstance(facesContext);
// 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) {
FacesContext.setCurrentInstance(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 !!!
11 years ago
JSF
Hi,

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 :
login-view-id="/auth/login.jspx">
<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 :

@Name("locationEditor")
@Scope(ScopeType.CONVERSATION)
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(Component.java:1945)
at org.jboss.seam.Component.getInstance(Component.java:2005)
at org.jboss.seam.Component.getInstance(Component.java:1983)
at org.jboss.seam.Component.getInstance(Component.java:1977)
at org.jboss.seam.Component.getInstance(Component.java:1972)
at com.agcs.locmgmt.web.location.LocationSummaryServlet.getViewController(LocationSummaryServlet.java:28)
at com.agcs.locmgmt.web.location.LocationSummaryServlet.doGet(LocationSummaryServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.agcs.locmgmt.web.seam.CookieMapServletFilter.doFilter(CookieMapServletFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)




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');
script.id = 'xdShortcutContainer';
script.type = 'text/javascript';
script.src = url;
head.appendChild(script);


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");
}
http.open("GET", url, true);
http.setRequestHeader("Access-Control-Allow-Origin","*");
http.send();


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'));
clearTimeout(setReadTimer);
store.remove('<%=articleNo%>');
store.remove('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.


12 years ago
JSP
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.
Hi,

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