struts

How to handle the Exceptions in JSP, when session expires?

你。 提交于 2019-12-14 03:33:56
问题 I'm working on struts1.3.8. The JSP page contains scriptlet to iterate the data in the session. Once the user opens the page and not performing any operation till the session expires and then next refreshing it is throwing java.lang.NullPointerException . So how to handle that exception and how to make the session alive? 回答1: You can rely on the existence of a well-known attribute in session. Set this when the session is first created. session.setAttribute("well-known-attribute", "abcd"); In

Remote Link Ajax Struts

我只是一个虾纸丫 提交于 2019-12-14 02:53:40
问题 In my menu.jsp: <s:url id="ajaxTest" value="addCustoInfo"/> <sx:a id="link3" href="%{ajaxTest}" targets="main-content"> Update Content </sx:a> in my struts: <action name="addCustoInfo" method="renderAddCustomerInfo" class="customerInfoAction"> <result name="success">/page/addCustoInfo.jsp</result> <result name="empty">/page/addCustoType.jsp</result> </action> in my CustomerAction: @SuppressWarnings("unchecked") public String renderAddCustomerInfo(){ this.listCustomerType = daoManager

How to let user download the data in database to an excel sheet file from web application in Java/Struts?

北战南征 提交于 2019-12-13 21:56:05
问题 I want to generate a report which includes an excel sheet which is generated from the data from the database . I am using Apache POI HSSF for creating the excel sheet file in the model. Now how to let the user download the file i have created ? 回答1: Just use a servlet. Feed response.getOutputStream() to POI HSSF to write the workbook to. Most important bit is the Content-Disposition response header. If you set it to attachment , then the browser will pop a Save As dialogue. response

Need help in deciding java framework, libraries

不想你离开。 提交于 2019-12-13 19:44:14
问题 I am planning to develop open source java application to work on google app engine as well as normal rdbms system, so please help me in choosing MVC Framework - Struts / Spring MVC ? ORM - JDO / JPA ? I am considering performance as a key factor. 回答1: For app engine you will want a lightweight framework, both for persistance and application stuff. Google is changing their pricing model so you might want to consider how this will impact your plans as well. There is an interesting discussion on

How to prevent a cross site request forgery attack using an image URL?

强颜欢笑 提交于 2019-12-13 14:28:16
问题 From ha.ckers.org/xss.html: IMG Embedded commands - this works when the webpage where this is injected (like a web-board) is behind password protection and that password protection works with other commands on the same domain. This can be used to delete users, add users (if the user who visits the page is an administrator), send credentials elsewhere, etc.... This is one of the lesser used but more useful XSS vectors: <IMG SRC="http://www.thesiteyouareon.com/somecommand.php?somevariables

Read excel sheet without using POI api

ぐ巨炮叔叔 提交于 2019-12-13 10:18:46
问题 I am having an urgent requirement. Reading data from excel sheet. Is there any procedure to read data from excel sheet without using apache poi api. i have to use only struts. Thanking you, Vipul Kumar. 回答1: What do you mean you "only have to use Struts"? If that means you cannot use any other library (and I hope it doesn't), you only have one way: implement an Excel parser yourself. I strongly advise you against it, though. Why would you want to reinvent the wheel? If not, then there are a

Struts validator of field conditional to another variable on the jsp

[亡魂溺海] 提交于 2019-12-13 08:49:50
问题 I'm using the struts validator for a jsp validation and i want to know how can I define a field validation depending on the value of another field of my jsp. I have a list of elements like this one : <s:select name="varName" label="labelVariable" list="listeVariable" listValue="varValue" listKey="varKey"/> And a textfield like this one : <s:textfield name="varNameText" label="labelText"/> In my validator I want to validate the size of the field 'varNameText' depending on the selected value on

How perform Junit tests with Struts - Ibatis

南笙酒味 提交于 2019-12-13 06:32:02
问题 im using Struts 1.2.x and Ibatis 2.x version for development, so i finish yesterday and now i want to perform test this is my first time trying to work with JUnit, I already make test but in JavaApp not running on server, so how can I simulate or generate mocks with server behavior, and wich mocks are recommended for Struts and Ibatis built-in Environment? for example how can i set accerts for login screen? I know about StrutsTestCase im using it, and about Cactus are for containers and

404 when running project through eclipse on Tomcat

浪尽此生 提交于 2019-12-13 06:11:44
问题 I have a Struts 2 project with following directory structure. But when I try to run this project using Eclipse on Tomcat 7, it gives me 404 error. Struts.xml : <?xml version="1.0" encoding="UTF-8"?> <struts> <action name="login" class="com.actions.LoginAction" method="execute"> <result name="success">/jsp/login.jsp</result> </action> </struts> login.jsp : <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Login Page</title> </head> <body> <s:form

AutoCompleter working but default text is not displayed when other event is processed?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 05:27:09
问题 I have an autocompleter tag in Struts 2. I have certain operations to be done when the tag is placed on the autocompleter.... On focus, when I click the autocompleter textbox, the text Select or Type tag ends with ; will be removed. If I process some other event, the text should reappear. How to achieve this functionality ? <sj:autocompleter cssStyle="width:200px;" href="%{#autoCompleteTagUrl}" onSelectTopics="tagsAllSelectTopics" onCompleteTopics="tagsAllCompleteTopics" id="tags_all" name=