This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!

ashwin bala

Ranch Hand
+ Follow
since Dec 07, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 ashwin bala

But the ajax call is not reaching the servet.Please find the stack trace.


Thanks in advance.
5 years ago
Hi All,

I am trying to make a simple AJAX call to dispatcher servlet from JSP and get string as response.But,I am able to call dispatcher servlet using form tag in jsp and success page is getting called. Please find the code for reference.I just want to know whether am I doing it in a right way.My goal is to get AJAX response

test.jsp


HelloController.java


HelloWeb-servlet.xml



web.xml

5 years ago
Thank you.I resolved it.


It is the final working code.
Hello All,

I am trying to parse JSON content in a AJAX response inside JSP. The response is a list of objects.I am not able read individual variables.Please find the attached code for your reference.

JsonTest.jsp



TestBean.java


code1.java


The alert is not popping up the name value.is this the right way to parse?or any corrections required ?
Hi All, I am working on basic spring and hibernate application.I am using createCriteria() methods for retrieving data from database.But I have removed transaction methods (like beginTransaction() or commit).Is it possible to use criteriaQueries without transaction methods ? I understand that I can achieve this using spring transaction.But I want to do it in Hibernate.Can anyone clarify this for me ? Thanks in advance.
5 years ago
Hi All,

I am building a sample spring hibernate application.Spring part is working fine.In hibernate I have mapped the bean class and the table.Still I get a error saying bean class is not mapped.Please find the attached code for reference.need your help fixing this.

Circle.java

   

HibernateDAOImpl.java

 
JDBCDemo.java
   
spring.xml

   

Following is the stack trace

Aug 08, 2016 4:53:10 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1077fc9: startup date [Mon Aug 08 16:53:10 IST 2016]; root of context hierarchy
Aug 08, 2016 4:53:10 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [Spring.xml]
Aug 08, 2016 4:53:11 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
Aug 08, 2016 4:53:12 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.3.Final}
Aug 08, 2016 4:53:12 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.11.Final}
Aug 08, 2016 4:53:12 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Aug 08, 2016 4:53:12 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Aug 08, 2016 4:53:12 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.SQLServer2008Dialect
Aug 08, 2016 4:53:12 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Aug 08, 2016 4:53:12 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
test
**Exception in thread "main" org.hibernate.hql.internal.ast.QuerySyntaxException: Circle is not mapped [from Circle]
   at org.hibernate.hql.internal.ast.QuerySyntaxException.generateQueryException(QuerySyntaxException.java:96)
   at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120)
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:234)
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
   at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
   at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
   at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
   at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
   at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
   at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
   at re.test.HibernateDAOImpl.getTableCount(HibernateDAOImpl.java:26)
   at re.test.JDBCDemo.main(JDBCDemo.java:14)
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Circle is not mapped
   at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:189)
   at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:109)
   at org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:95)
   at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:338)
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3678)
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3567)
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:708)
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:564)
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249)
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278)
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206)
   ... 9 more**
Thank you so much. I got the error after putting printstacktrace. I did not map the ID column properly


Jun 03, 2016 4:08:29 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;D:\Ashwin\Java\Eclipse - Juno\eclipse;;.
Jun 03, 2016 4:08:30 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:HibernateProject1' did not find a matching property.
Jun 03, 2016 4:08:30 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 03, 2016 4:08:30 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 03, 2016 4:08:30 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 791 ms
Jun 03, 2016 4:08:30 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 03, 2016 4:08:30 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Jun 03, 2016 4:08:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\Ashwin\Java\Workspace_22_06_2015\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\HibernateProject1\WEB-INF\lib\javax.servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jun 03, 2016 4:08:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 03, 2016 4:08:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 03, 2016 4:08:31 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 861 ms
test 1
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Jun 03, 2016 4:08:35 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.4.Final}
Jun 03, 2016 4:08:35 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Jun 03, 2016 4:08:35 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Jun 03, 2016 4:08:35 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Jun 03, 2016 4:08:35 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Jun 03, 2016 4:08:35 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: EmployeeBean.hbm.xml
Jun 03, 2016 4:08:35 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Jun 03, 2016 4:08:35 PM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
test 1.5
Jun 03, 2016 4:08:35 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Jun 03, 2016 4:08:35 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
Jun 03, 2016 4:08:35 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
Jun 03, 2016 4:08:35 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] at URL [jdbc:sqlserver://localhost:1433;databaseName=JAVADB]
Jun 03, 2016 4:08:35 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=sa, password=****}
Jun 03, 2016 4:08:36 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.SQLServer2008Dialect
Jun 03, 2016 4:08:36 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
Could not parse mapping document from resource EmployeeBean.hbm.xml
error

Hi All,

When I am executing my code I get error saying "Could not parse mapping document from resource EmployeeBean.hbm.xml"

I have checked my hbm file multiple times.But, I am not able get my mistake.Requesting your help in this.I have attached my code for reference.

Testfile.jsp


web.xml

EmployeeBean.hbm.xml


hibernate.cfg.xml



EmployeeBean.java

EmployeeDAO.java
I passed arr1 but when I get the parameter in servlet it is showing null.So instead of passing as array I passed as a big string.It worked.Anyways thank you.
Hi All,

I have made an array of strings in jquery. I want to pass this array to my servlet class without using scriplets. Is there a way ?.Please find the code for reference.Thanks in advance.

Hi All,

In the below JSP code, on the dropdown value change event, I am fetching values from the database and displaying inside table tag.I am doing it scriplets code.
I request you to check the code once as it is not printing the database values.


In the above code, the second table was displaying values.I have issue only with the first table tag code.Request your help in this.
6 years ago
JSP
Hi ,

I am trying display the result set from the database.I am getting the following exception :

Caused by: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:286)

My Jsp code :


My servlet code


My bean class is



and my web.xml is


Thanks in advance.
6 years ago
JSP
Hi I am trying a implement CRUD operation using struts 1 and hibernate.I am trying to list all the records from the table in my JSP page.
The below method is in DAO implementation class.

I am calling this method from struts action class and I receive a list. Now how do I take this to my front end JSP?
Is it by using or by typecasting the result into my ActionForm and displaying it in front end ?
6 years ago
Mr.Joe,

Initially , i did not add the library.I added it in the below format.



But still it did not work.
7 years ago