struts

Multiple Submit button in Struts 1.3

我是研究僧i 提交于 2019-12-05 11:09:33
I have this code in my JSP: <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> .. .. <html:form action="update" > .. .. <html:submit value="delete" /> <html:submit value="edit" /> <html:sumit value="update" /> </html:form> And this in the struts-config.xml file: <action path="/delete" name="currentTimeForm" input="/viewall.jsp" type="com.action.DeleteProduct"> <forward name="success" path="/viewall.jsp" /> <forward name="failure" path="/viewall.jsp" /> </action> Like the delete action, I have edit and update . It works fine, if I give the name specifically like <html:form

Struts <bean:write> tags

折月煮酒 提交于 2019-12-05 10:17:07
How do I escape character like '&' in struts tags. For example we can mention. <a href="./testaction.do?testmethod=bookResult&bookTitle=<bean:write name="booklist" property="title"/>" class="nLink"><bean:write name="booklist" property="title"/></a></small> I'm iteration over a book list array (booklist) and setting book titles one by one.In this scenario I need to escape characters like '&' within the 'title' property in order execute the respective logic for that particular action. Thanks. Maybe use the filter attribute? <bean:write name="booklist" property="title" filter="true" /> More on

Display an ArrayList with struts2 and jsp

回眸只為那壹抹淺笑 提交于 2019-12-05 10:07:44
问题 I am trying to learn struts2, so this is a pretty basic question. I have a page input_database.jsp, and its corresponding class input_database.java in the class file I have an arraylist of strings with a mutator and an accessor. I want to display it inside my .jsp file I've been trying to use a to do it, but I think I'm doing something fundamentally wrong. here's the code I've been trying to use in the jsp file. the arraylist is a private list of strings called query_data. my ultimate goal is

Supplying credentials safely to a RESTFUL API

北慕城南 提交于 2019-12-05 08:49:11
I've created a RESTful server app that sits and services requests at useful URLs such as www.site.com/get/someinfo. It's built in Spring. However, these accesses are password protected. I'm now building a client app that will connect to this RESTful app and request data via a URL. How can I pass the credentials across? Currently, it just pops up the user/password box to the user, but I want the user to be able to type the username and password into a box on the client app, and have the client app give the credentials to the RESTful app when it requests data. The client is built using Struts.

Can you do a struts2 action redirect using POST instead of GET?

痴心易碎 提交于 2019-12-05 08:02:48
<action name="actionA" class="com.company.Someaction"> <result name="success" type="redirect-action"> <param name="actionName">OtherActionparam> <param name="paramA">${someParams}</param> <param name="paramB">${someParams}</param> <param name="aBoatLoadOfOtherParams">${aBoatLoadOfOtherParams}</param> </result> </action> In the above action map, I am redirecting from SomeAction to OtherAction. I am having issues, because unfortunately I need to pass a large amount of data between the two actions. IE7 will only allow GET requests to be like 2k, so its blowing up when I'm just over that limit

<html:radio> Check radio button default in struts html tag

守給你的承諾、 提交于 2019-12-05 05:37:39
How to set radio button checked by default in struts html tag ? <html:radio name="RegisterForm" property="Group" value="<%=Contant.Male%>"/><label>Male</label><BR> <html:radio name="RegisterForm" property="Group" value="<%=Contant.Female%>"/><label>Female</label> Here, i have to set Male as default one. Thanks in advance. Just make sue that your controller sets the corresponding property in the form before dispatching to the view: form.setGroup(Constant.Male); 来源: https://stackoverflow.com/questions/14237731/htmlradio-check-radio-button-default-in-struts-html-tag

Dynamic file download without saving file in the server

穿精又带淫゛_ 提交于 2019-12-05 05:29:20
问题 I am using Apache POI libraries to do some operation on multiple excel files. I'm trying to download the excel report without storing it somewhere in the server. I am using Struts 2 which needs the file fed into a InputStream while POI Workbook needs a OutputStream to write the data into. Any help would be great 回答1: Since you already know you need a Stream result: I am using Struts 2 which needs the file fed into a InputStream // With Getter private InputStream inputStream; and you already

上一篇写的文件上传,这一篇写文件上传中回报的错误,以及解决办法

不问归期 提交于 2019-12-05 05:16:48
文件上传不了,有以下几种情况: 1).form表单后面的enctype="multipart/form-data"没有,导致无法以流的形式写入。 2).第一条有的话,当点击提交的时候,直接返回strut中的error返回结果,没有fileerror提示或者提示文件太大。 原因:是因为你上传的文件或者图片大小位于struts中拦截器配置中文件大小限制的值(总)(<constant name="struts.multipart.maxSize" value="1024102400"/>)和你action中上传文件的大小限制的值(<param name="maximumSize">1024</param>)(单)之间。 解决办法:根据上传的情况来设置总,和单个的值。尽可能的设置大点或者设置成一样。 3).若果报错提示显示上传的类型不对, 第一,你就要看看你用的那个浏览器了,兼容性不同导致的; 第二,当然也有可能是你的strut中 (<paramname="allowedTypes">/image/bmp,image/png,image/gif,image/jpeg,image/jpg,image/x-png, image/pjpeg</param>)这句话没有包括你上传的格式。 4),若果提示你上传找不到存储路径,那就简单了,第一、看看你的存储路径是不是与你struts中(<param

Struts and Spring together?

喜夏-厌秋 提交于 2019-12-05 04:21:25
问题 I am pretty new to both Struts and Spring. I need to know how to access a Spring Service in a Struts ActionForm. Even a pointer in the right direction would be appreciated. 回答1: From a struts 1 ActionForm class you'll be needing: WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("yourService"); 回答2: Are you using Struts 1 or 2? If you're using Struts 1 then there are couple of ways of doing it. I prefer to do it using org.springframework.web.struts

struts2-基于注解的Action配置

≡放荡痞女 提交于 2019-12-05 02:03:58
1.web.xml中配置拦截器 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <filter> <filter-name>strutsFilter</filter-name> <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>strutsFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> 2.·使用注解的方式配置struts需要引入一个jar包 3