Gabriela Rios

Ranch Hand
+ Follow
since Feb 27, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Gabriela Rios

Hi,

I would like to have dynamic sql statements where I can utilize a hash map to add conditionals something like the following:

<select id="getUsers" resultType="hashmap" parameterType="hashmap">
select *
from users
<where>
<iterate var="i=0" increment>
$columni$ like #valuei#
</iterate>
</where>
</select>

Is there a way for me to accomplish something like that?

I appreciate your input on this.
Thanks.
Hello,

I have a question regarding redirect. I have noticed that when I do a redirect some (NOT ALL) of my model attributes are passed in the URL. I can't quite understand why. I have some attributes that I want to maintain throughout my controllers so I added the annotation @SessionAttributes with the name of the model attributes. In all my controllers, I use at least two of those session attributes but I can only see this particular one always being passed. If I update one of those session attributes, it gets passed on the URL as well. The one that ALWAYS gets passed in my URL is a String. Other types of objects don't get passed in my URL. Is that the reason? If it's a string and/or if I just updated the attributes that is a string, will it get passed in my URL? I redirect using strings. I also use Apache Tiles.

Thanks in advance for the clarification.

12 years ago
Hello, I'm having some difficulties adding Spring Webflow to my application.

I used one of the spring samples: webflow-showcase: https://src.springframework.org/svn/spring-samples/webflow-showcase
I got it to run locally. I created my own flow and made it work.

Now, I'm trying to add it to my application but I can't get the reference to go to the folder with my flow definition.

webflow.xml


servlet-context.xml

I originally only had UrlBasedViewResolver but for the flows I had to create an AjaxUrlBasedViewResolver and I had to add a new definition to my TilesConfigurer.



This is the page that launches my flow: shoppingcart.jsp. My href is the name of the folder that has my flow: shopping-cart.



My shopping-cart folder is in "/WEB-INF/views/flows" as per my FlowRegistry.

WEB-INF
>>views
>>>>flows
>>>>>>shopping-cart
>>>>>>>>flow.xml
>>>>>>>>step1.jsp
>>>>>>>>step2.jsp
>>>>>>>>views.xml

flow.xml



views.xml




Any idea of what I'm doing wrong? Thanks. Any help will be greatly appreciated.

Regards,
12 years ago
Thanks Bill. I may used as it looks a little bit cleaner. Should I have my links like this instead of plain text: <c:url value="home"/>?
12 years ago
Thanks Mark! That fixed my problem with the css, js, and images. Does that mean that I need to add the context to all my links? For example in my header I have the logo of my company and I have the reference of my links like this "home". Now, of course, that doesn't work. Should I then have "${pageContext.request.contextPath}\home" for ALL of my links? I feel like I'm doing something wrong here.
12 years ago
Hi,

I have a questions regarding the change of the root folder by default after a call using more than one RequestMapping. Could any body please clarify this for me? For example:
I have a link in one of my views with something like this #142

I have my Controller



The problem I'm having is the following: I have my images, css, js, etc in the resources folder so my links are <link rel="stylesheet" type="text/css" href="resources/css/grid.css"/>. Initially, this all works but after having used /product/{142}. My root folder has changed to MyRoot/product so links now instead of going to MyRoot/resources/css/grid.css they go to MyRoot/Product/resources/css/grid.css.

How should I address this issue? I don't want to have a different header and footer every time I used a mapping with more than one level like /product/142.

Any help will be greatly appreciated
12 years ago
Hello,

I'm new to RESTful Web Services. I created one and now I'm working on the client but I'm confused on how to turn my xml into my object.

I have my response of the type org.apache.http.HttpResponse. It looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><User><address>XXX</address><firstname>Gabriela</firstname></User>

I have my class User with @XmlRootElement. How do i turn that xml into my class.
In here, http://cxf.apache.org/docs/jax-rs-data-bindings.html, they show how to do it but they never really assign the response to the Customer or Customers.

I also found this, http://www.mkyong.com/webservices/jax-rs/restful-java-client-with-apache-httpclient/, but it produces a string rather than xml. I would like to find an example like this where instead of using json they use xml.

I would like to know how do they do something like this?

HttpResponse result = httpclient.execute(get);
User user = magicFunction(result);

Can somebody point in the right direction please?

Thanks,



12 years ago
Turns out I still had the error so I removed <context:annotation-config /> and it works now. Thanks


web.xml




root-context.xml


servlet-context.xml

13 years ago
Thanks for letting me know all of that. I'm in the process of learning spring 3 and hibernate but at the same time I have to make some progress in my project so I'm using things that I don't fully understand.

I have removed the filter as I really didn't need it. Initially, when I added it, it let me see other errors that I had with my mappings. I had errors with my OneToMany and ManyToMany annotations which essentially was that I didn't have the table in my hibernate.cfg.xml.



The first example that I saw didn't really use that file. It was something like this.



Is that file really necessary? I get a warning because the DTD is deprecated but I changed it to the new one supposedly and it didn't work for me. Any thoughts on this? Thanks for your help on this. I'm learning a lot with you guys.
13 years ago
It works now. I added this filter:



Thanks!
13 years ago
Thanks Mark! I moved my DataSource, TransactionManager and SessionFactory to my root-context.xml. When I try to run it, I get:

Jun 11, 2012 9:43:07 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/MPower] threw exception [Request processing failed; nested exception is org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here] with root cause
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

Any ideas?
13 years ago
I added <context:annotation-config/> but that didn't fix the problem.

This is my web.xml



13 years ago
Hello,

I'm trying to incorporate hibernate in my project but I'm having some difficulties. I'm getting the following error:

ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sys.power.dao.hibernate.UserDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sys.power.dao.hibernate.UserDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


I'm not sure what the problem is as I'm implementing all the interfaces needed. I don't know where is the mapping that I need to make the autowired work. I don't want this post that long but here are my files.

root-context.xml


servlet-context.xml


hibernate.cfg.xml



I have my User.java


UserDAO.java


UserDAOImpl.java


UserService.java


UserServiceImpl.java


UserController.java



are my packages ok? What am I missing? any ideas? Thanks. Any help will be greatly appreciate it.
13 years ago
I got this working by doing the follwing:



and also I had the wrong dialect in my hibernateProperties: <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>