Asvin Kumar

Greenhorn
+ Follow
since Mar 01, 2010
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Asvin Kumar

Yes, I did that. Actually I wanted to ask for this scenario but I pasted the wrong query,


I tried this,



But it is not working.
Hi,

Im new to hibernate, how can I do a sum of subquery values?

SELECT SUM(Salary) as sal from (

SELECT salary
FROM SAL
WHERE EMPLOYEE_NUM = ?
AND CUR_MONTH = CONCAT( TO_CHAR( SYSDATE, 'MON'), TO_CHAR(SYSDATE,'YYYY'))
AND CONTRACT_END_DATE < LAST_DAY(SYSDATE)

)

Any input would be helpful.

Thanks,
Asvin
I got it. I changed the http://www.springframework.org/schema/mvc/spring-mvc.3.1.xsd to http://www.springframework.org/schema/mvc/spring-mvc.xsd and it worked.

Not sure if I'm lucky. I see the jars for 3.0.5, so just tried without specifying the version.

Thanks,
Asvin
4 years ago

Hi,

Me too new to Spring and I'm trying to run a sample code from a tutorial. This is my applicationContext.xml,

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"
default-lazy-init="false">

<!-- This required so that Spring can recognize our annotated beans -->
<context:annotation-config />

<!-- This required so that Spring can recognize certain annotations,
For example @Controller and @Service. Make sure you set the correct base-package
-->
<context:component-scan base-package="org.krams.tutorial" />

<!--
This is responsible for automatically converting our custom POJO to JSON.
Make sure you have Jackson in your classpath
-->
<mvc:annotation-driven />

</beans>


I get the error message cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'.
4 years ago
Wendy,

Yes, thats what the problem is. I figured it out in the morning, the fetching column can't be passed, it has to be appended in the SQL string.


Thanks,
Asvin


Hi,

I am getting an error while trying to fetch a NUMBER value from a table. The error is,

PreparedStatementCallback; uncategorized SQLException for SQL [SELECT ? FROM MQT_SYNC_TSDISCOUNT WHERE REGION=? AND COUNTRY=? AND TS_OFFER=? and rownum=1]; SQL state [null]; error code [17059]; Fail to convert to internal representation

I know this error would occur when I am trying to do wrong type cast. But this is what my code does to fetch the value,

Integer techGroup = 0;
try
{
techGroup = (Integer)jdbcTemplate.queryForObject(FETCH_DISCOUNT_YEARS, new Object[] { column, region, country, tsOffer }, Integer.class);
}

where the FETCH_DISCOUNT_YEARS = SELECT ? FROM MQT_SYNC_TSDISCOUNT WHERE REGION=? AND COUNTRY=? AND TS_OFFER=? and rownum=1.

Please note that I am using wrapper Integer, i have also tried this way


int techGroup = 0;
try
{
techGroup = jdbcTemplate.queryForInt(FETCH_DISCOUNT_YEARS, new Object[] { column, region, country, tsOffer });
}

and I got the Invalid Column type error. Not sure if there is an issue with fetching SQL NUMBER as Java int.

Please help.

Thanks,
Asvin

Thanks Neeraj and sorry if im not clearing the air.

My project is... every jsp page loads on a command called editCmd. editCmd is the command which will reach a class. So when I click on a link to create a new inventory, the inventory page comes fields(date created, created by, doc id.. etc). One of its field is a drop down called Order Type.

Now the requirement is, when the user clicks on the create inventory link, the drop down page should appear and then to the corresponding type, the other fields to be populated. I have created the page with the dropdown and the others. The requirement is done. The situation is, i need to include a error message if nothing selected and the go pressed.

1. When the user click create inventory, the jsp to populate the drop down -> editCmd =6 (ie dropdown page).
2. When the user clicks on Go (the form submit action takes to) -> editCmd = 5 ( ie fields page based on the entry in the drop down).

If i have selected null and clicked on Go, all the fields appears with null.

The condition here is, if any error message has to be displayed, it has to be addError method. I did use the javascript to validate the form and stop the action like this,

function fldCheck(){
if(document.frmMain.aa_type.value == ''){
<% uiModule.addError(new Error("Error"));%>
return;
//document.frmMain.action="url";
}
else
{document.frmMain.action=submit;}

}

But my problem is, when the go is clicked, the action takes me to the editCmd value 5. Which means im already in the submitted class. I can control the look of the JSP by the conditions and make the user to see only the drop down. But since im already in the submitted class, i cannot take the drop down value and resubmit again.

I need some information on how to get back to the callee form from the caller from ie after the action submit, if the value is null, i should get back to old form.

I dont have any options to change the editCmd.

Im not sure if im still clear.
5 years ago
JSP
Ok, let me try this...


the url http://localhost:8090/MyProj/MyPage/Edit=6

got the drop down with the "Go" and "Cancel". The Go button will submit the value and takes to the Url with the Edit=5 ie http://localhost:8090/MyProj/MyPage/Edit=5.

My requirement is, if the null is selected and clicked on "Go", i need the error message to be displayed and the Edit should stay at 6 ie http://localhost:8090/MyProj/MyPage/Edit=6. (which means back to the drop down page)

Hope it makes sense?
5 years ago
JSP
I understand, but not sure how to stay in the same page after hitting the action submit. Any ideas would be appreciated.
5 years ago
JSP
Hi Geeks,

I have a requirement here,

No session, no multiple jsp. All i have is one jsp which shows a drop down with go and cancel buttons and based on the drop down the same jsp will be called with respective values(which called from java methods) . Please remember everything is in a single JSP.
something like this,

<%
if(editMode == 0)
dropdown
else{
-----
values
------
}
%>

The Go button carries the dropdown value to the else part

The problem is, the drop down has null at the top followed by options, when nothing selected and clicked on go, an inbuilt java method addError needed to be added and the page shouldn't submitted to next.
Since things should happen after clicking on Go, the page is getting forwarded to the else part. All i want is, is to call the addError method and stay back to the same page even after clicking on "Go".

I have tried adding javascript onClick like this,

function fldCheck(){


if(document.frmMain.field.value == ''){
<% uiModule.addError(new Error("message"));%>
return;
//document.frmMain.action="url";
}
else
{document.frmMain.action=submit;}

}

and also tried handling within jsp like this,

if(editMode== 5 && fieldVal == 0){

uiModule.Error(new Error("ErrorMessage"));
String redirectURL = "ur";

response.sendRedirect(redirectURL);

}

Both showing the same page but no error message added. It is because the page is called and the errors are refreshed. Any ideas would help a lot.

Thanks,
Asvin
5 years ago
JSP
Hi,

I am using JDK1.4 for a project and trying to connect to Oracle db which is in a remote system. I get the following error,

java.sql.SQLException: Io exception: Connection reset by peer: socket write error
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:361)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)

I can telnet the server without any errors. Does it requires any other configuration change???

Kindly help..
Sorry!!! nevermind... i got it...
6 years ago
I have downloaded both the compatability zip and also the installer. Can someone please let me know how to integrate the compat???
6 years ago
Thanks for your replies...
7 years ago
I want to use a string in switch case and I get the following error,

[javac] UserData.java:58: incompatible types
[javac] found : java.lang.String
[javac] required: int
[javac] switch(type)

any help??
7 years ago