我正在为我的项目使用以下内容:Spring 3.0.1 + Apache Tiles 2.2.1 + Glassfish 2.1.我想要做的是在jsp页面中调用一些方法并将一些参数传递给它.例如,我有一个bean:
@Component
@Scope(value = "singleton")
public class TestBean {
public void test(String param){
System.out.println("param = " + param);
}
}
Run Code Online (Sandbox Code Playgroud)
我有一个jsp页面:
<%@page contentType="text/html; charset=utf-8"%>
${testBean.test("hello")}
Run Code Online (Sandbox Code Playgroud)
这段代码给了我一个例外:
org.apache.jasper.JasperException:当未指定默认命名空间时,函数test必须与前缀一起使用
如果我调用一些方法而不传递参数 - 一切都OK.
我试图把的jboss-el.jar在我的WEB-INF/lib目录,并把所需的参数在web.xml(如解释在这里),但没有效果.
我仅限于上面列出的一组技术,因此我无法添加任何内容,或者,例如,无法更改我的app-server版本.
在所有这些条件下,我的问题是否有解决方案?
我正在使用Spring 3.0.1.RELEASE为我的webapp(我无法升级它),我正在尝试从网页上的数据库渲染一些图像.
我有以下简单的Spring配置:
弹簧的application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<task:annotation-driven />
<context:annotation-config />
<context:spring-configured />
<context:component-scan base-package="com.me" />
<bean id="hibernateSessionFactory" class="com.me.dbaccess.HibernateSessionFactory">
<constructor-arg ref="sessionFactory"/>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
弹簧mvc.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<mvc:annotation-driven/>
<bean id="tilesViewResolver" class="com.me.util.TilesExposingBeansViewResolver">
<property name="viewClass" value="com.me.util.TilesExposingBeansView"/>
<property name="exposeContextBeansAsAttributes" value="true"/>
</bean>
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/config/tiles-defs.xml</value>
</list>
</property>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
我有以下控制器:
@Controller
public class PhotoController {
@RequestMapping("/carPhoto.html")
@ResponseBody
public byte[] getCarPhoto(
@RequestParam(UrlParameters.PHOTO_ID) Integer photoId,
@RequestParam(UrlParameters.PHOTO_TYPE) …Run Code Online (Sandbox Code Playgroud) 我在我的 PHP 应用程序中使用Hybridauth 3 代表我的帐户发布一些定期推文。该应用程序具有所有可能的权限。当它在第一个身份验证步骤中要求它们时,我将授予它所有权限。在那之后,Twitter 将我重定向到指定的回调 URL,在那里我得到了一对 access_token 和 access_token_secret。但是当我尝试使用这些令牌发推文时 - 它给了我:
{"errors":[{"code":220,"message":"Your credentials do not allow access to this resource."}]}
Run Code Online (Sandbox Code Playgroud)
这是我尝试发推文的方式:
$config = [
'authentication_parameters' => [
//Location where to redirect users once they authenticate
'callback' => 'https://mysite/twittercallback/',
//Twitter application credentials
'keys' => [
'key' => 'xxx',
'secret' => 'yyy'
],
'authorize' => true
]
];
$adapter = new Hybridauth\Provider\Twitter($config['authentication_parameters']);
//Attempt to authenticate the user
$adapter->setAccessToken(/*tokens I've got from getAccessToken() on /twittercallback/*/);
if(! $adapter->isConnected()) {
// never goes …Run Code Online (Sandbox Code Playgroud)