struts

Tomcat: Issue with redirecting from HTTP to HTTPS

这一生的挚爱 提交于 2019-12-11 03:19:09
问题 I am doing some modifications to an existing web application which uses Struts and deploys on Tomcat. I was trying to make my application redirect from HTTP to HTTPS when the user visits one particular page. To do that, I added to my web.xml: <security-constraint> <web-resource-collection> <web-resource-name>secured page</web-resource-name> <url-pattern>/secured.do</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user

Struts 1.3 ActionErrors access

时光怂恿深爱的人放手 提交于 2019-12-11 03:14:46
问题 In my ActionForm i have the validate method: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){ ActionErrors errorList = new ActionErrors(); errorList.add("myError", new ActionMessage("this is my error")); return errorList; } Then the flow will be returned to the page form.jsp. I want to access that error from my form.jsp page but using JSTL's EL and not html:error tag. I know that errorList is stored as an Attribute on the requests scope but I need the exact

Eclipse and struts syntax errors in JSP files

蹲街弑〆低调 提交于 2019-12-11 01:32:35
问题 I'm using eclipse as my java IDE and the project I'm working on uses struts. Eclipse is telling me on any page that has struts tags that the tags are syntax errors. E.g. my tag <logic:equal shows this error Syntax error on token "<", delete this token but the page works just fine. How can I get eclipse to not show errors in these cases? EDIT: Just noticed this is only when the tag is inside a <script> block. Tags in regular HTML work fine. Is this just an unresolved bug with my version of

How to access OGNL tracing evaluations in Struts 2?

[亡魂溺海] 提交于 2019-12-11 01:23:49
问题 I was told to optimize a web application. To do so I use JProfiler. I noticed a large part of the response time is spent in the presentation layer. Especially, when the code builds the HTML code. Drilling down this bottle neck, I saw that the code deals a lot with OGNL classes/methods (nearly 50% of the calls). I tuned the JSP code (see below for details) by removing some unnecessary OGNL statements. I managed to gain 200ms. However the code still spend more than 2000ms on average in this

How to prevent XSS vulnerability with Struts

☆樱花仙子☆ 提交于 2019-12-11 00:56:55
问题 We need to add anti-XSS support in our Struts application. Most specifically the architect requires that all user input must be "sanitized" before storing in DB. As I don't want to reinvent the square wheel, which Java library can I use for this ? And where to put it ? Ideally it should be configurable (which input fields to check, not all of them in request) and fast. My first thought is Struts Validator. Thanks in advance Lluis 回答1: I recommend you look into OWASP's ESAPI project. It has

bean:message equivalent in java code?

心不动则不痛 提交于 2019-12-11 00:13:32
问题 I'm using Struts 1.2 and I need to reference the value of some internationalized strings in a JSP page. Normally I would do this using the < bean:message > tag, but I need to reference it from the Java code (surrounded by <% ... %>) instead. How can I do this? For example: <% person.setName("John Smith"); person.setOccupation("Chef"); // I want to internationalize this string %> 回答1: First, I would recommend looking at your Action / JSP / Taglibs and see if you absolutely need to use

Can I have SEO friendly urls in Struts?

こ雲淡風輕ζ 提交于 2019-12-11 00:06:37
问题 I want to have SEO friendly urls in my application, which will be built in java/j2ee using Struts (1/2). I have some classifications as follows county/countryname county/state/statename county/state/locality/localitname I guess above URLs will be seo friendly? How can I have such URLs with Struts instead of something like /county='xyz' ? 回答1: use urlrewrite library, it will integrate nicely with most of the java web frameworks. example from here: In the following example requests for /world

How to have a class use applicationContext beans?

时光怂恿深爱的人放手 提交于 2019-12-10 23:09:38
问题 I'm working on my first java struts2 webapp and want to be able to inject bean parameters into any arbitrary class that is called. But I find that I can only do this with struts action classes... Let's say I have this bean in my applicationContext.xml file: <bean id="BeanTest" class="BeanTest"> <property name="test" value="someval" /> </bean> If I have a struts action class setup called BeanTest (like so), and I add a setter (public void setTest()), then the test parameter will be set and I

Reading model objects mapped in Velocity Templates

人盡茶涼 提交于 2019-12-10 16:11:29
问题 I have a Struts + Velocity structure like for example, a Person class, whose one property is a Car object (with its own getter/setter methods) and it is mapped to a Velocity form that submits to an Action, using ModelDriven and getModel structure. I what to put a button on the form that shows "View Car" if car property is not null or car.id != 0 or show another button "Choose Car" if car is null or car.id = 0. How do I code this. I tried something like that in the template file: #if($car !=

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

筅森魡賤 提交于 2019-12-10 12:19:32
问题 I am using My-eclipse and doing a struts project there is no syntax error but on starting tomcat server the following error appear in console. java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory and javax.servlet.UnavailableException: Parsing error processing resource path jndi:/localhost/strutspro/WEB-INF/struts-config.xml any idea whats the problem. 回答1: Donwload commons-logging and place the jar(s) in WEB-INF/lib . And for the future - google the class name that is not