Struts2.5.10.1 core jar missing xwork2 dispatcher package - struts2

I see the Struts2.5.10.1 core jar is missing the dispatcher package. I have the below code in my JSP and it does not work anymore. Could anyone answer me what would be the correct code to write here?
<s:set var="url" value="%{#context['com.opensymphony.xwork2.dispatcher.HttpServletRequest'].requestURL}"/>
Answer: Below is the code template used. I removed un-required code and replaced it with '...'.
The Result is that I got a complete link: http://localhost:8080/.../param1=val1&param2=val2

Related

unable to find `as` method in `Config`

I saw the following code snippet
val settings = configuration.underlying.as[CookieSecretSettings]("silhouette.oauth1TokenSecretProvider")
I believe configuration is of type play.api.Configuration and underlying is of typeConfig` (https://www.playframework.com/documentation/2.6.x/api/scala/index.html#play.api.Configuration)
I copied the code in my Apploader (as I am using Compile Time Injection). The BuiltInComponentsFromContext has a configuration variable. I thought to use that as follows val config = configuration.underlying.as[CookieAuthenticatorSettings]("silhouette.authenticator") but the compiler cannot resolve as. What am I doing wrong?
The Config library seem to have asInstanceOf instead of as but I get other errors if I use that. I notice that the code for which as works uses play version 2.4.2 while I am using 2.6.12.
I realize this is an old question, but I stumbled upon this exact problem today and couldn't find anything helpful.
The as method is provided by a third-party library (Ficus) to read case classes and Scala types from Typesafe config. You need to include it in your build dependencies, then add to imports:
import net.ceedubs.ficus.Ficus._
import net.ceedubs.ficus.readers.ArbitraryTypeReader._

Grails, tagLib g:remoteLink does not exist

I'm trying to add a delete-button to my edit-form but have not found anything that work and when I found that remoteLink could help me I tried that but when adding it to any form/app I always get:
"Tag [remoteLink] does not exist. "
I'm using Grails-3.2.4.
Maybe I need to import something or..?
The remote* tags were deprecated and removed in Grails 3.x. You should be using javascript library for making AJAX-calls
This taglib and code was placed as external plugin. You can add it via
additional dependency in build.gradle:
compile 'org.grails.plugins:ajax-tags:1.0.0'
plugin page: https://plugins.grails.org/plugin/grails/ajax-tags

magento unable to reroute to controller in config.xml

(FYI this is version 1.4, and yes I'm flushing my var/cache folder. I've started reading through Alan Storm's tutorials and that helped, but nothing specific on this problem)
I am new to Magento, we are using the OnePage checkout method, and we have the following:
app/code/local/Ourcompany/Checkout/etc/config.xml
Which has the following definition:
<frontend>
<routers>
<checkout>
<args>
<modules>
<Ourcompany_Checkout before="Mage_Checkout">Ourcompany_Checkout</Ourcompany_Checkout>
</modules>
</args>
</checkout>
</routers>
</frontend>
I have a corresponding file in:
/app/code/local/Ourcompany/Checkout/controllers/OnepageController.php
In there I have a class:
class Ourcompany_Checkout_OnepageController extends Mage_Checkout_OnepageController
So far I have not been able to get Magento to acknowledge it's there. The native methods in core are being called only. If I remove or rename this page, there is no error statement - I think my syntax in config.xml is not correct. Can anyone identify the improper syntax present?
This is the first time I have answered my own question but I think the answer here is noteworthy. The CommerceBug debugger was very useful as I was able to look at classes that were loaded. As it turns out, there was another module that had been created, called Admaster which got precedence as the router for the OnepageController.
I'm sure dealing with this type of conflict is common for Magento, so I have a mental checklist item now if this happens again.

JSF2 loadbundle issue

Trying to design a facelet using Mojarra tags.In base template trying to load the property file using loadBundle tag.During runtime getting error like below
Can't find resouce for bundle web/test/properties/sample key en_GB
Placed the property file in the below location
webapp/test/properties/sample.properties and adding this like below
<f:loadBundle basename="test.properties.sample" var="msgs" />
Also I tried to place the property file under webapp/resources/test/properties/sample.properties but no hopes.
Could anyone please throw some light to resolve the issue?
Thanks in advance.
First of all, the resource bundle should be in the src folder. But you can find here a detailed example about resource bundles: http://www.mkyong.com/jsf2/jsf-2-0-and-resource-bundles-example/
I hope it helps!

bean-validation validation.xml ignored

I am using JSR 303 Bean validation in my JSF 2.0 web application and it works fine with annotations. Now I would like to ignore annotations and configure validation rules using the validation.xml file, so this is what I did (I am using an eclipse dynamic web project) :
Added validation.xml under WebContent/META-INF/validation.xml
<?xml version="1.0" encoding="UTF-8"?>
<validation-config
xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
>
<constraint-mapping>META-INF/validation/constraint-mapping.xml</constraint-mapping>
</validation-config>
Then created the file constraint-mapping.xml under WebContent/META-INF/validation/constraint-mapping.xml
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
<bean class="my.full.path.ValidationMB" ignore-annotations="true">
</bean>
</constraint-mappings>
Having these configurations in place, I suppose the annotations in my bean class ValidationMB shall be ignored, BUT this is not happening!, which makes me assume that the validation.xml file is not being loaded.
any ideas? thanks.
Environment:
Apache Tomcat 7.0.23
javax.faces-2.1.4.jar
hibernate-validator-4.2.0.Final.jar
hibernate-validator-annotation-processor-4.2.0.Final.jar
validation-api-1.0.0.GA.jar
slf4j-api-1.6.1.jar
From the spec: section 4.4.6. XML Configuration: META-INF/validation.xml
Unless explicitly ignored by calling
Configuration.ignoreXMLConfiguration(), a Configuration takes into
account the configuration available in META-INF/validation.xml. This
configuration file is optional but can be used by applications to
refine some of the Bean Validation behavior. If more than one
META-INF/validation.xml file is found in the classpath, a
ValidationException is raised.
To solve my problem I had to create a META-INF folder under the project src folder, which ends in the WEB-INF/classes/META-INF.
The structure of the web application is:
ROOT
|_META-INF -- don't put validation.xml here
|_WEB-INF
|__ classes
|_META-INF
|__validation.xml
But I think that if I pack my web application in a jar file and reuse it in another project It may not work, I will let you know later once I do it.
Try to put your validation.xml directly into the WEB-INF/ directory.
I stumbled across this while looking for something else but wanted to clarify to the OP what is happening. You do in fact need the file to exist at META-INF/validation.xml; however, that is relative to the classpath which is why it worked when you put it under WEB-INF/classes/META-INF/validation.xml.
The cleaner approach is to let the file be put there for you. Your Eclipse project should already be outputting whatever is in your source directory to WEB-INF/classes somehow for you or nothing would be running. But sometimes there are filters on what it outputs so it might excluding something. You might want to check your src dirs and make sure they don't have exclusions.
Just as an example, if you had a Maven war project, all of your java sources would go in src/main/java and the generated classes would end up in the WEB-INF/classes directory. The equivalent happens for src/main/resources which contains non-source files. When I want *.xml, *.properties, etc. to end up in WEB-INF/classes I put them in src/main/resources. For your example I would have a src/main/resources/META-INF/validation.xml file.
Hope this helps anyone else who comes across this and is confused.

Resources