srikanth darbha

Ranch Hand
+ Follow
since May 19, 2013
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
1
Given in last 30 days
0
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.
D.Srikanth

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.

Regards,
D.Srikanth
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"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

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

</bean>

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,

D.Srikanth
6 years ago
Thanks Spencers
6 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.

Regards,
D.Srikanth
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 that..how come only pojo objects are getting created?

Can anyone please help me on this.

Thank you.


Regards,
D.Srikanth
6 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..
    6 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.
    6 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.


    Regards,
    D.Srikanth
    6 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"

    Regards,
    D.Srikanth
    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...............


    Regards,
    D.Srikanth
    7 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,








    7 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: java.net.ConnectException: Connection refused: connect
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1241)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

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