srikanth darbha

Ranch Hand
+ Follow
since May 19, 2013
Merit badge: grant badges
For More
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 srikanth darbha

Hi Team,

I have a snippet of code like below,

From the above code i want to pass the value comtval as  a parameter to the function  saveEditComment(),and then send this whole html table as response to ajax response,i am getting the response but i could not get the comtval value ,it is also just appended as a string value.
Please find the response from ajax side

can anyone please help me out on how to pass the argument value also.

Thanks in Advance.

Campbell Ritchie wrote:Will it even be a second thread?  . . . As DT says, you only have one thread at all, so that thread is permitted access to any code with that same lock on.

Thanks, Ritche,
That was a very good explanation got my doubt clarified.
6 years ago
Hi Team,

From the above code the output is a below

Locked: false
Held by me: false
Lock acquired: true
Lock acquiredaaaa===true
came in here

But from the above code,i am obtaining the lock in second executor task without unlocking the lock in first executor task(which is commented).My question is how can the output "Lock acquiredaaaa===" is  true,since the lock cannot be obtained when it is still in locked state in another task. Can any one please help me on this.

6 years ago
Hi Team,

I am trying to upload a PDF file of size greater than 1mb(1.16mb) of size i have configured as below,

<bean id="multipartResolver"

<property name="maxUploadSize" value="10485760" />
 <property name="maxInMemorySize" value="1048576" />


But even after configuring I am getting an error as below,

Request processing failed; nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size of 1000000 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (1220447) exceeds the configured maximum (1000000)

I am using tomcat 7 server.

Can anyone please suggest me on how to proceed further.

Thanks in Advance,

6 years ago
Thanks Spencers
7 years ago
Hi CodeRanch,

I have a query on Multithreading topic,

Consider i have a 2 objects of a same class and there are 2 threads running on each object.And there is a method test() in the class.How to ensure that only thread can call this method.

I have considered the option of making the method as synchronized but since there are two different objects and the lock will be object level how can i make sure only one thread at a time can call the method.

Please help me out in understanding this.

Hi Code ranch,

I have a spring controller class method as below

I have not annonated the Pojotest class @ModelAttribute but still an default object is created ,but it should be null as it is a normal Pojo class.

I have given a String object also in the parameters but no object is created for come only pojo objects are getting created?

Can anyone please help me on this.

Thank you.

7 years ago

Liutauras Vilda wrote:

srikanth darbha wrote:I can see that modifying content will not result in any error but reference change will give an error.

Here you go. So what the correct answer you can conclude about the statement:

"Objects declared as final can always be initialized only once. If there is an attempt to change the object reference or the contents, then compilation error will occur."
  • true
  • false

  • ?

    The answer is true as i have said earlier..
    7 years ago

    Liutauras Vilda wrote:Looking to the code snippet above, and the statement you posted, try to see what this code proves wrong about the statement you posted?

    I can see that modifying content will not result in any error but reference change will give an error.
    7 years ago
    Hi Code ranch,

    Objects declared as final can always be initialized only once. If there is an attempt to change the object reference or the contents, then compilation error will occur.

    According to me the above statement is true.

    But i have read in an documentation it is false.

    Can you please help me out in this as if we change the object reference which is declared as final will result in compilation error.

    7 years ago

    Tim Moores wrote:All URLs start with the protocol, "file:" in this case. See File URI scheme for more information.

    Thanks Tim,

    but on doing the below also it is not working,
    String selectedurl = "D:\Jbehave\Jbehave-09012016\reports.html";

                   selectedurl ="file:///"+selectedurl;
    pw.println("<a href='selectedurl'>"+selectedurl+"</a>");

    it is showing as an hyperlink but when i click it is redirecting to "http://localhost:8080/jbehaveauto/selectedurl" but not to the file system "file:///D:\Jbehave\Jbehave-09012016\reports.html"

    7 years ago
    Hi Coderanch,

    i just want to write an anchor tag inside a servlet  as below,
    where selectedurl="D:\Jbehave\Jbehave-09012016\reports.html";

    pw.println("<a href='selectedurl'>"+selectedurl+"</a>");

    i am able to get the link but when i click,it is getting redirected to "http://localhost:8080/jbehaveauto/selectedurl" in browser but i just want to access the local file system file,can any one please help me out.
    7 years ago
    Hi Code Ranch,

    I require an urgent help regarding the below scenario,

    I have a url "http://localhost:8080/xyz/companies/printECF" i need to redirect this and i want to read the html content from the reponse ,

    can anyone please suggest me on this as response.sendredirect does not return any value

    Urgent help please help me on this...............

    8 years ago

    Joe Ess wrote:

    srikanth darbha wrote:
    I am new to struts,

    If it is at all possible, don't use Struts 1. See here.
    As for your question, it looks like the Struts servlet has a problem starting up. Can you hit the same URL with a web browser?
    Can you show us some code?

    Yes joe, please find the code snippets,The web.xml and struts-config.xml were already posted above,

    8 years ago
    Hi Code ranch,

    I am new to struts, i am trying to redirect to an action class using servlet.but i am getting the below error,can anyone please help me out.

    SEVERE: Allocate exception for servlet action
    javax.servlet.UnavailableException: Connection refused: connect
    at org.apache.struts.action.ActionServlet.init(
    at javax.servlet.GenericServlet.init(
    at org.apache.catalina.core.StandardWrapper.initServlet(
    at org.apache.catalina.core.StandardWrapper.loadServlet(
    at org.apache.catalina.core.StandardWrapper.allocate(
    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.apache.catalina.valves.AbstractAccessLogValve.invoke(
    at org.apache.catalina.core.StandardEngineValve.invoke(
    at org.apache.catalina.connector.CoyoteAdapter.service(
    at org.apache.coyote.http11.AbstractHttp11Processor.process(
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$ Source)
    at org.apache.tomcat.util.threads.TaskThread$
    at Source)

    The below is my web.xml and struts-config.xml
    8 years ago