shai ban

Ranch Hand
+ Follow
since Jan 05, 2010
Merit badge: grant badges
For More
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
10
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shai ban

Hi,
I have created a Spring REST service. Now I want to consume it not by RestTemplate but through other Spring MVC application. I want to use the filter org.springframework.web.filter.HiddenHttpMethodFilter and concerned about how to use the output in JSP that can be XML/JSON?


Please let me know if am not clear enough.

Thanks.
10 years ago
Try it.

if your css folder is outside web-inf
<context-root>/resources/css

then declare like <mvc:resources mapping="/css/**" location="/resources/css/" />

if your css folder is under web-inf like below example
WEB-INF/resources/css

then declare like <mvc:resources mapping="/css/**" location="/WEB-INF/resources/css/" />
10 years ago
My bad. The problem was in the IE browser where I had highest security and I didn't test it in another browser.

Thanks.
10 years ago
Problem should be jar/configuration only as I just updated for below working example and it also didn't work!!!
http://www.mkyong.com/spring-security/spring-security-hello-world-example/

I updated Spring core libraries to 3.2.3.RELEASE and Spring securities jar to 3.1.4.RELEASE. And it stopped working!!!

Still, I don't have any idea how to fix.
10 years ago
Hi,
Trying to run a very basic spring-security demo but not able to login into app. Seems to be a configuration issue but not able to figure it out. Please help.
I am using Spring 3.2 and Spring Security 3.1
For convenience, I have pasted the code below and attached as well. Hope it will help or please let me know in case of any other query.
The URL I am hitting is "http://localhost:8080/SpringSecurity/home". It is opening the automatic login form but even after providing the correct credentials (admin/password), it is coming on the same page again!!! I have attached log file for tomcat console. It contains log for Tomcat load as well as hitting the url and then login. Link for WAR is also given, in case you want to try.
UPDATE: Not able to attach here so uploaded on rapidshare.com Below are links:
http://rapidshare.com/files/146621860/security_log.txt
http://rapidshare.com/files/3127127598/pom.txt
http://rapidshare.com/files/3340242913/SpringSecurity.war


web.xml


Spring-MVC-servlet.xml


SpringSecurity-servlet.xml


HomeController.java



home.jps



Thanks.
10 years ago
Check the date format/timezone in db.
10 years ago
You will be getting some exception about View not found. Please paste the trace.
10 years ago

Jhakda Velu wrote:Can you post how you have added view resolvers? If no order is specified, i think InternalViewResolver will be used. If you post more details, someone may be able to help.



I didn't specify any order for both resolvers thats why it was giving the problem. After specifying, it solved.
Thanks.
10 years ago
Hi All,
New to Spring. Got stuck with Tiles.
How dispatchServlet will know that a particular view should be resolved with a particular resolver? eg. I am using two resolvers InternalResourceViewResolver or TilesViewResolver?
Now, I returned some view name that was supposed to resolved with TilesViewResolver but it got resolved with InternalResourceViewResolver and it tried to find that jsp. Whereas, actual jsp name should come after consulting TilesViewResolver! What's wrong here?
I am using plain JSPs also that doesn't have anything to do with Tiles. Should I use only plain JSPs or Tiles only?

Please explain. Let me know if you have any query.

Thanks.

NOTE:
Getting the below exception. Here Dispatcher servlet is calling InterviewViewResolver instead of TilesViewResolver? May be because of this attribute' title' is not visible there.



org.apache.tiles.template.NoSuchAttributeException: Attribute 'title' not found.
org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:50)
org.apache.tiles.template.GetAsStringModel.resolveAttribute(GetAsStringModel.java:152)
org.apache.tiles.template.GetAsStringModel.execute(GetAsStringModel.java:110)
org.apache.tiles.jsp.taglib.GetAsStringTag.doTag(GetAsStringTag.java:261)
org.apache.jsp.WEB_002dINF.jsp.showTilePage_jsp._jspx_meth_tiles_005fgetAsString_005f0(showTilePage_jsp.java:117)
org.apache.jsp.WEB_002dINF.jsp.showTilePage_jsp._jspService(showTilePage_jsp.java:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

10 years ago
Hi,
I am new to Spring. Tried a Tiles example. Having a query. Lets say, I am returning a logical name 'showTilePage' from the controller and I have two resolvers declared InternalResourceViewResolver or TilesViewResolver. How DispatcherServlet will know which resolver to consult for a particular logical view name? Is that logical view name is unique among all the controller's view names?
When I tried below example I returned logical view name 'showTilePage' and template jsp name was different. I thought it will pick the 'showTilePage' below definition and will render the parent template's jsp that was something different earlier. But to my utmost surprise, it was asking for showTilePage.jsp!!! So I had to change jsp name in the parent template definition? Does it means, template file name in parent template and 'name' in child tile definition should be same as below example?
Please let me know if I am not clear.

<tiles-definitions>

<!-- Default Main Template -->
<definition name=".mainTemplate" template="/WEB-INF/jsp/showTilePage.jsp">
<put-attribute name="title" value="Empty" type="string" cascade="true"/>
<put-attribute name="header" value="/WEB-INF/views/templates/header.jsp" />
<put-attribute name="footer" value="/WEB-INF/views/templates/footer.jsp" />
<put-attribute name="menu" value="/WEB-INF/views/templates/menu.jsp" />
<put-attribute name="body" value="/WEB-INF/views/templates/blank.jsp" />
</definition>

<definition name="showTilePage" extends=".mainTemplate">
<put-attribute name="title" value="Spring TILES example" type="string" cascade="true" />
<put-attribute name="body" value="/WEB-INF/views/jsp/body.jsp" />
</definition>

</tiles-definitions>

Thanks.
10 years ago

Naresh Chaurasia wrote:Follow the following link Setting Up Spring(MVC). It will get you started in less than 30 minutes.



Thanks but I am asking through Maven.
10 years ago

vijay jacob wrote: There is no automated process.



It means you have to add coordinates for every jar. Right?
10 years ago

vijay jacob wrote:
Main reason people take the pain is to have version controlled jar. And it rebuilds only those changed classes unlike ant which rebuild all the classes.



Then how to use Maven in the scenario I mentioned?
How you will add a lot of dependencies (lets say of Spring MVC) in POM? one by one or is there some automated process?
10 years ago
Spring 3.0.5 distribution includes sample examples under 'projects' directory but this directory is not present in 3.2.3 RELEASE? Then where are Spring examples for 3.2.3 RELEASE?

Thanks.
10 years ago

vijay jacob wrote:

Maven 2nd approach would be the best. maven & eclipse is standard tool.



Right but you already know that there are a lot of jars that we need to add in the POM. Including JARS directly in the eclipse build path takes less than a minute but adding all these JARS as dependency in POM will take more time. Isn't it? How to improve it or is there any best method so that these dependencies can come automatically in POM?

Thanks.
10 years ago