struts

Any way to anticipate session timeout?

左心房为你撑大大i 提交于 2019-12-06 10:53:55
问题 Is there a way to "catch" the session timeout event, so as to retrieve data from HttpSession before its invalidated ? We're implementing the Filter Interface, and in the doFilter method, the user we stored in the session object at login is null when session times out. Thanks in advance. 回答1: You should be able to register an HttpSessionListener for your webapp that will allow you to get notified when a Session is destroyed. It has two callback methods: public void sessionCreated

Struts 1 redirect from action to action with parameters as POST request

痴心易碎 提交于 2019-12-06 09:56:35
now am trying to redirect to action class from action class with some parameters in my Struts 1.3 web application, here is my code ActionRedirect redirect = new ActionRedirect(mapping.findForward(forwardPage)); redirect.addParameter("method", forwardPage); redirect.addParameter("username", "user"); redirect.addParameter("password", "PWD"); redirect.addParameter("forwardPage", "success"); return redirect; it's working fine, but all parameters are showed in address bar, how can i redirect it as POST request parameter(hide parameters) You can't, it is not a Struts problem. It is how HTTP is

JSP Redirection and passing value

若如初见. 提交于 2019-12-06 09:23:45
I have a JSP in which i am redirecting to another jsp like ,i dont have any other data in that jsp,i want to pass a value from this jsp(index.jsp) to the redirected jsp(login.jsp),how will i do this? Here "logonInput" is defined in struts-config.xml index.JSP is like <%@ page language="java" contentType="text/html;charset=UTF-8"%> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <% String sessionExpired=(String)request.getAttribute("SessionExpired"); %> <logic:redirect forward="logonInput"/> I want to display or pass the value sessionExpired to login.jsp To forward a

How to set the values in session?

混江龙づ霸主 提交于 2019-12-06 09:10:59
问题 If I'm getting empty session I need to setup some values to play the action class. So, here is the method public SearchFilters getFilters() { return (SearchFilters) getSession().get("Filters"); } I would like to check the session, if it's null , then I need to set the some values over here. public SearchFilters getFilters() { if(getSession().get("Filters").equals(null)){ ---- //How to set the values and return ? } return (SearchFilters) getSession().get("Filters"); } 回答1: public SearchFilters

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

匆匆过客 提交于 2019-12-06 08:29:48
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? You can the <jsp:include page="..."> tag instead of the static <%@ include %> which only works for static references. For anyone that is curious, I used a struts include tag, based on artbristols answer and managed to make it dynamic with OGNL. Thanks for all your input. <s:include value="includes

ActionError message not getting displayed in UI

て烟熏妆下的殇ゞ 提交于 2019-12-06 07:58:00
The application is made on Struts 1.2. I have a login form, all the validations related to the login are getting displayed properly. For the validations, I am using the Validator framework. When the validation succeeds but the user authentication fails, then I am not able to display the login failure message properly. I am setting the ActionError message in the Action like this: Login loginDetails = validateUser(loginForm); if(loginDetails == null){ errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.invalidCredentials")); return mapping.findForward("failure"); } Below is the entry

Can't get request attribute in struts action class

╄→尐↘猪︶ㄣ 提交于 2019-12-06 07:36:00
I have a jsp page. I am calling the jsp page in a iframe and appending new parameter to the url. The usrl looks like http:\localhost:8080\Search.pp?blah=true; So when as the search page called has got some filters so in the action class i have code like this String Parameter = request.getParameter(blah); if (StringUtils.isNotEmpty(Parameter)) { Search = Boolean.parseBoolean(campaignSearchParameter); } and then in the jsp page i do something like final Boolean Search = (Boolean) request.getAttribute("blah") == null ? false : (Boolean) request .getAttribute("blah"); request.setAttribute("blah"

Change of Index page based on subdomain/domain name

我是研究僧i 提交于 2019-12-06 05:27:30
Problem and my idea on it is just vague as I'm still in design phase. I just wanted to know something to get a head start on the problem and how/where to proceed to solve it. Problem Part: There's one web app built using struts-2 JSP/servlet, with the URL mywebapp.com . The requirement is every client can access this mywebapp.com using their subdomain, like webapp.abc.com, myapp.xyz.com, etc. I have to filter based on the domain name to give them a customized login page. I have saved their domain name in the database to map their details that need to be displayed on customized login page. What

Clean way for conditionally rendering HTML in view?

故事扮演 提交于 2019-12-06 04:15:37
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 Is SessionConfig exposed as a bean in your JSP (as part of request / session / Struts Form)? If it's not, you can expose it. And if it's a static class containing

javax.xml.ws.WebServiceException: Undefined port type Java Struts SOAP WSDL

倖福魔咒の 提交于 2019-12-06 03:52:19
问题 ok I have really a strange problem that I keep looking for solution in google and yahoo for almost 4 hours today. And I desperately looking for a solution. public static String [] checkCardAccount(String cardNumber, String cardIssuer, String securityNumber){ URL url = null; try { url = new URL("http://localhost:8999/bankcard?wsdl"); } catch (MalformedURLException e) { e.printStackTrace(); } QName qname = new QName("http://server.bcard.soap.com/","BankCardImplService"); Service service =