I would like to do something like this in my jsp (using spring and struts):
<security:authorize ifAllGranted="ACCESS_<s:property value='%{#attr.currentQueue}'/>">
Sadly it doesn't seem to work since I can't see the content I should see right now. However, there is no error either.
Any idea whether it should work ? Is the method wrong ?
Solved the problem using another Struts OGNL : ${currentQueue} instead of using a property tag. Which gives :
<security:authorize ifAllGranted="ACCESS_${currentQueue}">
Related
I am new in Java EE and I am building a web application with maven, spring mvc
and hibernate.
I have a problem with the jsp. I can not show the data of object with the expression / jstl
language. In console doesn't show any error. Any suggestions?
Pom.xml:
Controller:
Inicio.jsp:
I guess in the controller you are setting the object with key
model.addObject("usuario", usuarioo);
The first character is small 'u'.
And in your jsp you are trying to access using Usuario. Thus the value is not getting printed.
Kindly use something like
${usuario.nombre}
I have a 3rd party .jsp that I am trying to use in my SpringMVC 3.2 application.
the URL call looks like this:
http://localhost:8080/dms/pcc.jsp/Page/q/0/AttributescumentID=eJQAyAEYASgBJAFMAMgAlADIARgBsAG8AZwBvAC4AdABpAGYA0
I am getting a 404 error. How do I map this in my web.xml?
when I call
http://localhost:8080/dms/pcc.jsp
it works (well, no 404 errors) but I need to send it the parameters.
Changing the 3rd party jsp might be problematic, so how does one map this call straight to the jsp?
Thanks in advance.
Really a broad question. I would start with checking mapping in #Controller, then move into application-config.xml and then web.xml.
It would be nice if you would look at sample Spring Application.
If call to http://localhost:8080/dms/pcc.jsp works, you should try following thing.
http://localhost:8080/dms/pcc.jsp?AttributescumentID=eJQAyAEYASgBJAFMAMgAlADIARgBsAG8AZwBvAC4AdABpAGYA0&otherParams=something
The Page/q/0/ part in URL seems to be messing things up for you. If these also are parameters to be sent, send it the way explained above.
So we're using spring-security-redirect as a parameter in the form that is sent to j_spring_security_check, in order to send the user to the correct page after a successful login. Migrating from Spring security 3.0 to 3.1, this stopped working. We use a subclass of SavedRequestAwareAuthenticationSuccessHandler, overriding onAuthenticationSuccess(), and debugging that method I see that getTargetUrlParameter() returns null. isAlwaysUseDefaultTargetUrl() returns false.
Browsing around I can't find anyone having similar problems... I find some references to AbstractAuthenticationTargetUrlRequestHandler.DEFAULT_TARGET_PARAMETER, which seems to have disappeared in 3.1.
Any ideas?
As per Spring security 3.1 xsd,
Attribute : authentication-success-handler-ref
Reference to an AuthenticationSuccessHandler bean which should be used to handle a successful authentication
request. Should not be used in combination with default-target-url (or always-use-default-target-url) as the
implementation should always deal with navigation to the subsequent destination.
So, in your subclass, you have to perform the redirection.
Is there a way to get the controller and action name currently ( or about to ) executing ?
I am interested in getting this primarily in an Interceptor so I can perform logic depending on action.
Grails for example offers this as params.controller and params.action
Anything similar? Could not find anything on the web.
Spring MVC 3.0.6 ( found this Spring MVC : What is the best way to pass the controller + action name to the view? but it was for version 3.1 )
Thanks!
You can use an aspect to get the method name from joinPoint.getSignature().getName(), and that can be added to the Model as an Attribute. The Controller name is probably also in there somewhere.
We're trying to use Struts 2 Validation w/ Annotations and we've ran into a weird problem. We have a method that we have specified a string validation for. When we run that method we get a NullException in the AnnotationValidationConfigurationBuilder on line 580. We took a look and it appears that the validationFactory is null. We traced that back and can't find a reason why it would be null though we did notice an #Inject annotation on the setValidatorFactory.
As a side note we're also using Spring 2 in the mix and calling it from the jQuery plugin.
Has anyone run into this before? We've looked at all the docs and none of them talk about needing to register a bean with Spring or anything like that.
Thanks,
Shane
We found the answer. Apparently if you have a validators.xml you need to specify everything in the base validators.xml. This has changed since we used this in the past without needing to do this.