Tag: jsp

Getter Property(没有属性和setter)通过ValueStack访问

public class MyAction extends ActionSupport { public String getMyValue() { return “SomeText”; } … } 我有这个MyAction类。 现在,问题是当我使用OGNL在我的JSP页面中引用myValue时,它会在ValueStack上创建myValue属性,还是只调用getter方法?

从不同的URL但相同的域加载jsp中的图像?

我正在尝试将图像加载到位于类路径上’ files ‘文件夹中的jsp中。 我尝试加载图片的.jsp的URL是http://www.my-webapp.com/authenticated/dashboard 。 问题是jsp正在’ authenticated ‘文件夹中搜索’ files ‘文件夹而不是类路径。 这是我使用Google Chrome的“Inspect Element”时获得的url: 如何告诉我的jsp在classpath上搜索’ files文件夹但在’ authenticated ‘文件夹中没有? 我的struts.xml (如果需要): /authenticated/dashboard.jsp 谢谢

如何在JSF中访问Map

我尝试使用C:foreach来访问jsf中的地图。但我无法使用“#”符号访问jsf中的地图。但我可以使用“$”符号访问它。但是我需要访问使用jsf显示组件h:outputtext。我的示例代码是 h:form binding=”#{MapInJsf.initForm}”> <%–${nameMap.key}–%> I cann access it <%—-%> 我做错了什么以及如何访问?我的Ref链接是JSF组件的动态值绑定请帮帮我。

如何使用Struts2和hibernate维护会话?

我需要知道如何使用Struts2维护一个表单和多个input[Name,City,Country]会话,最后使用hibernate将数据存储到数据库中。 这个表单有两个按钮: add (存储到会话); Submit (存储到数据库)。 首先,输入表单详细信息[name city and country] ,然后单击添加按钮数据将存储到session 。 其次,输入相同的详细信息,然后单击add 。 三,输入相同的表单详细信息,但现在单击提交按钮所有详细信息(第一个第二个和第三个)将使用hibernate存储到数据库。 请帮我解决一下…… 得到一个错误:我们的代码是: Person.java: @Entity public class Person { @Id @GeneratedValue private int id; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public […]

JSP表单:复选框到ac:foreach

本论坛的许多post都提到了类似的问题; 但没有人有特定的解决方案,我感谢你帮助我: 我正在使用spring开发一个Web应用程序,我不知道我应该在表单的路径中放置什么:checkbox标签里面的c:foreach one,这是我的代码: Download Delete ‘ rights ‘是Spring文档中定义的字符串列表,它有一个getter和一个像其他属性一样的setter,我的复选框在c:foreach标签之外工作,但是当它们包含在这个标签中时会生成这个exception: org.springframework.beans.NotReadablePropertyException: Invalid property ‘person’ of bean class [java.util.ArrayList]: Bean property ‘person’ is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? 你对这个问题有什么看法吗?

使用JSP下载文件

我目前正在尝试使用JSP构建一些小型的litle应用程序,并且没有陷入某些困境,从Web服务器下载文件。 我似乎无法弄清楚我应该怎么做这个任务。 这里有没有任何JSP开发人员知道这个并且可以指出我正确的方向?

HTTP状态500 – 在Struts2应用程序中处理JSP页面时发生exception

我正在学习Struts2并在托管我的应用程序时面临以下问题。 具有/ struts-tags示例, 等的index.jsp页面在托管应用程序时抛出exception。 项目中使用的jar子: common-lang3.jar commons-fileupload-1.3.jar commons-io-2.0.1.jar commons-logging-1.1.3.jar commons-logging-api-1.1.jar freemarker-2.3.19.jar javassist-3.11.0.GA.jar ognl-3.0.6.jar struts2-core-2.3.15.3.jar xwork-core-2.3.15.3.jar exception堆栈跟踪: **HTTP Status 500 – An exception occurred processing JSP page /index.jsp at line 12** **type** Exception report **message** An exception occurred processing JSP page /index.jsp at line 12 **description** The server encountered an internal error that prevented it from […]

当组件作为会话作用域时,无法将Spring控制器作为请求范围

我正在尝试按照本网站上的指南来正确地将我的bean用于Spring网络应用程序: http://richardchesterwood.blogspot.com/2011/03/using-sessions-in-spring-mvc-including.html 我正在尝试遵循方法3,这基本上意味着我想将我的组件类作为会话范围,因此我必须根据请求调整我的控制器类的范围。 我将控制器放入我的JSP页面,以便可以使用它。 但是,当我尝试这样做时,我的webapp存在构建问题,当我尝试访问网页时,它给出了503 service_unavailable错误。 构建错误是: 严重:上下文初始化失败org.springframework.beans.factory.BeanCreationException:创建名为’org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0’的bean时出错:bean的初始化失败; 嵌套exception是java.lang.IllegalStateException:无法将处理程序’currentWeekController’映射到URL路径[/ TimeTracking]:已经映射了处理程序’scopedTarget.currentWeekController’。 这是相关的类和jsp页面。 如果您还有其他需要,请随便询问! CurrentWeekController控制器类: package controllers; import javax.servlet.http.HttpServletRequest; import models.CurrentWeek; import models.ModelMap; import models.User; import org.joda.time.MutableDateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; /** * this is the controller for current week, it lets you change the current week […]

如何“逻辑:迭代”只是一个对象?

所以,我有这个代码: logic:iterate name=”nameForm” property=”name” id=”nameId” indexId=”index” bean:write name=”nameId” property=”field1″/ bean:write name=”nameId” property=”field2″/ 这很有效,因为我收到了一个“对象表”,所以我可以毫无问题地进行迭代。 现在,在另一个页面上,我需要做同样的事情,但问题是我没有收到“对象表”,而是一个对象本身。 我尝试了它 – 正如预期的那样 – 得到了错误: 无法为此集合创建迭代器 我已经RTFM了,而且我比以前更加困惑。 我得到了“logic:iterate”里面的“name”如何指向struts-config中的表单名称,现在我需要对一个 bean做同样的事情,请问有什么帮助吗?

上传zip文件,解压缩并读取文件

我正在使用NetBeans,我正在开发一个允许上传zip文件的jsp页面。 zip文件包含6个CSV文件,用于写入SQL数据库。 我的问题是,我如何允许用户上传文件,在jsp页面中解压缩,并允许我读取文件? 提前致谢!