struts

There is no Action mapped for namespace / and action name tutorial

南楼画角 提交于 2019-12-04 05:45:29
问题 I am unable to execute my struts2 application. I am using eclipse indigo IDE, tomcat 7 and jdk 1.7. The jar files I included are: commons-logging-1.0.4.jar, freemarker-2.3.8.jar, ognl- 2.6.11.jar, struts2-core-2.0.11.jar, xwork-2.0.4.jar I placed the struts.xml in classes folder in WEB-INF and I also tried it placing in src folder but I could not able to make it. I am getting the below error on console There is no Action mapped for namespace / and action name tutorial. - [unknown location]

How to disable autocomplete for Struts tags(HTML:text)

偶尔善良 提交于 2019-12-04 05:31:46
问题 For normal HTML input tag,disabling autocomplete is simple as given below: <input type="email" name="email" autocomplete="off"> Whereas its does not work for Struts tags given below: <html:text property="" styleId="Field" maxlength="4" size="4" tabindex="14" onblur="check(this);" value="" /> How to disable autocomplete for Struts tags? 回答1: Autocomplete attribute is not passed through to the rendered HTML by the tag. You can do so by writing your own custom tag that extends the tag to accept

How to get JSP scriptlet value in struts tag

六眼飞鱼酱① 提交于 2019-12-04 03:38:59
问题 Here is my code: <% request.setAttribute("lcItem", "Hello"); %> If I do as following, I'm not getting the value: <s:property value="%{lcItem}" /> <s:property value="lcItem" /> Any suggestions? 回答1: This works perfectly.. <% request.setAttribute("lcItem", LeftContentItem); %> <s:property value="#request['lcItem']" /> Note: According to the Scope we use we should specify the #request .. etc 回答2: You can write your code 2 ways <% request.setAttribute("lcItem", "Hello"); %> <% pageContext

Struts2 ActionContext and ValueStack?

浪子不回头ぞ 提交于 2019-12-04 01:43:02
问题 My questions are: In Struts2, does every action object have its own corresponding ActionContext and ValueStack? In other words, for every new request a new action object is created. Does this mean every time a new action object is created, a new ActionContext and ValueStack also get created? Consider this scenario: Action1------1st req------->view.jsp------2nd req--------->action2. So when a request comes for action1 a new object of action1 and corresponding ActionContext and ValueStack will

Struts and Spring together?

徘徊边缘 提交于 2019-12-03 22:07:14
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. From a struts 1 ActionForm class you'll be needing: WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("yourService"); 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.DelegatingActionProxy. You'll need to have the spring-webmvc-struts.jar in the classpath. struts-config.xml: <action path="

Display an ArrayList with struts2 and jsp

怎甘沉沦 提交于 2019-12-03 21:27:21
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 to display an arraylist of arraylists of strings to display my select statement, but I need to figure

Dynamic file download without saving file in the server

荒凉一梦 提交于 2019-12-03 20:57:07
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 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 know how to create an Excel with POI: POI Workbook needs a OutputStream to write the data into. public String

How to append loop index of c:forEach tag to Struts HTML tag attributes?

早过忘川 提交于 2019-12-03 20:09:26
How can I append the loop index of a c:forEach tag to the attributes of a struts select/text tag? For example. <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%> <c:forEach begin="2" end="${pageView.guestCount}" varStatus="gC"> <div class="section guest-details"> <html:select property='title_guest<c:out value="${gC.index}"/>'> <html:options collection="titles" property="code" labelProperty="value" /> </html:select> </div> </c:forEach> throws the following error javax.servlet.jsp.JspException at org.apache.struts.taglib.html.SelectTag.calculateMatchValues(SelectTag.java:246) Now,

Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContext.xml]

扶醉桌前 提交于 2019-12-03 18:15:40
问题 I m trying to port my hibernate example to spring by using spring hibernatetemplate but i m getting this error Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/applicationContext.xml]. Please suggest me run my project. I m fresher in my company my web.xml file <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml

Servlets vs MVC frameworks [closed]

孤者浪人 提交于 2019-12-03 17:52:47
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I very often come across this question of why we have got lots of web frameworks addressing the same or similar drawbacks. When looking deeply, I also have given thought on why JSP / Servlets is not being used after the other web frameworks (like Struts, Spring MVC etc) have shown