struts

Struts 2 and business objects

久未见 提交于 2019-12-10 12:18:16
问题 In a Struts 2 class where http get params are auto fetched by field variables. While there were repeated such class fields like userId,groupId, etc in many classes, I decided to make one business object class RequestParams in each class and put all the field there. Then all my class will have just the RequestParams rp; with getRp(); and setRp(); the rp class will have the userId with getters / setters and all other fields. Now I see I have to replace. e.g userId with getRp() . getUserId(); at

Upload multiple files in a JSP

北城以北 提交于 2019-12-10 12:07:18
问题 How to upload multiple files in a JSP? I have a list of eight Questions, I want attachments for each question, when I am submitting the form I am getting the following error. Please help me in solving this "Caused by: java.lang.IllegalArgumentException: Cannot invoke com.usrinfo.form.AssessmentForm.setAttatchment on bean class 'class com.usrinfo.form.AssessmentForm' - argument type mismatch - had objects of type "java.util.ArrayList" but expected signature "org.apace.struts.upload.FormFile"

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean

假如想象 提交于 2019-12-10 11:54:16
问题 I am trying to build a simple struts application where I am trying to print a string value from a java action to jsp using form beans. first.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> Welcome!!!!!!!! <bean:write name="myForm" property="st"/> </body> </html> struts-config.xml <?xml version="1.0"

Hibernate - Tomcat - MySQL issue

风格不统一 提交于 2019-12-10 11:16:16
问题 Dear All, I'm testing a Struts webApp using hibernate-mysql on tomcat7... After the 8 hours timeout period my webApp always crashes . I've changed configurations here and there. But no success. I really appreciate your attention... Here some lines from hibernate.xml property name="hibernate.bytecode.use_reflection_optimizer">false property name="hibernate.c3p0.idle_test_period">30 property name="hibernate.c3p0.max_size">600 property name="hibernate.c3p0.max_statements">50 property name=

Clean way for conditionally rendering HTML in view?

别说谁变了你拦得住时间么 提交于 2019-12-10 11:09:05
问题 Is there a cleaner way to do this in a JSP/Struts1 setup ? ... some HTML here ... EDIT: In admin mode I would like to have access to additional parameters from a form element, e.g. from the form element: input type="text" value="Test user" name="Owner" EDIT 2: Actually, my problem is very similar to the question that was asked in : Conditionally Render In JSP By User But I don't really get the "pseudo-code" from the likely answer 回答1: Is SessionConfig exposed as a bean in your JSP (as part of

Logging user actions

我怕爱的太早我们不能终老 提交于 2019-12-10 11:08:24
问题 The customer wants us to "log" the "actions" that a user performs on our system: creation, deletion and update, mostly. I already have an aspect that logs the trace, but that works at a pretty low level logging every method call. So if a user clicked on the button "open medical file" the log would read: closePreviousFiles("patient zero") createMedicalFile("patient zero") --> file #001 changeStatus("#001") --> open while the desired result is: opened medical file #001 for patient zero I'm

Is it possible to have a dynamic path as part of a jsp include

风流意气都作罢 提交于 2019-12-10 10:34:39
问题 I have a include file in my jsp <%@ include file = "includes/testinclude1.jsp" %> Test Include1 contains struts tags, and therefore needs to be pulled in and compiled. Which works ok. Is there a way to make the path for this file be dynamic in any way or am I looking at a rethink in terms of design? 回答1: You can the <jsp:include page="..."> tag instead of the static <%@ include %> which only works for static references. 回答2: For anyone that is curious, I used a struts include tag, based on

Struts2 action - test it or not?

只愿长相守 提交于 2019-12-10 10:01:33
问题 I'm currently working on one project, that uses Struts2 framework. We use separate component for DB accessing, which is well tested. At the same time, project, that we work on has a lot of Actions, that are not tested. In most of the actions we use at least one DB-service call. So on one hand these actions are pretty simple. I'm not sure - should unit tests be written for that or not? I think that good practice is write unit tests always, but these actions are so simple and I'm under big

“Path login.page does not start with a ”/“ character” message exception after changing java version

假如想象 提交于 2019-12-10 09:32:50
问题 I have a web application which worked with the following: Tomcat 5.0 Struts 1.0 Java 1.5 I have to switch to Java 1.6.When I tried to do that, i received the following stack of exception in my browser: javax.servlet.ServletException: Path login.page does not start with a "/" character org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet

WARNING: No configuration found for the specified action:

自闭症网瘾萝莉.ら 提交于 2019-12-10 07:59:08
问题 I am getting following exception, please help to solve this issue. Jul 16, 2013 11:18:40 AM org.apache.struts2.components.Form evaluateExtraParamsServletRequest WARNING: No configuration found for the specified action: `'HelloWorld1'` in namespace: `''`. Form action defaulting to 'action' attribute's literal value. index.jsp : <s:form action="HelloWorld1" namespace="/" method="post" > <s:textfield name="userName" label="User Name" /> <s:submit /> </s:form> struts.xml : <package name="default"