struts

How to come back to form without reset the values?

荒凉一梦 提交于 2019-12-25 02:22:21
问题 I have a web application that is made with Java+Struts. There is a form that when is submited it executes an Action that shows the results of the search. Since here, all ok. What I need is to put a link in the results page to come back to the form without erasing the search parameters. I've put a link that goes back to the form page, but allways erase the search parameters. I've thinking about saving and restoring this parameters to the java session, or adding the parameters to the url (like:

Struts 2 “if” tag

旧时模样 提交于 2019-12-25 02:22:05
问题 In my application, I use Struts 2. In one page, I want to use the Struts 2 <s:if> tag, but can't get it to work. In the action, I expose a "person" entity to the view. Then in the page, I want to compare the current date with the person's birthday. I tried this: <s:if test="person.birthday > new java.util.Date()">xxxx</s:if> But it does not work. How to fix it? 回答1: I believe that you are using Date as a data type for person.brithday .You can do it as follows way If you can change/Modify your

In Struts1.3, From Jsp page to action in Java

被刻印的时光 ゝ 提交于 2019-12-25 02:14:20
问题 I am new to Jsp, and My working application is based on Struts1.3 . I have a Jsp page which display the records basis on the providedId, may be record should be one or more than one it depends on the existence of records. My Jsp page code is: <html:form method="post" action="properties.do" styleId="propertyform"> <logic:iterate id="JobsForm" name="<%=Constant.JOBFORMLISTSECOND%>"> <tr> <td> <html:text property="asfrom" name="JobsForm" styleClass="fieldbox2" styleId="textfield50"/> </td> <td>

Where to store database connection & global variables in struts 1.3

旧街凉风 提交于 2019-12-25 00:48:33
问题 I am new to struts java application & i want to store database connections & global variables. What is best option to store values (Web.xml or struts-config.xml). and How to access the variables defined in that xml files. Is there any other way to store & access database connections. There should be way so that i can go & edit the files like variables and databases connections easily. 回答1: Best way to store your database connection is Configure DataSource & ConnectionPool on application

How to handle newlines in a Struts form that relies on JavaScript

醉酒当歌 提交于 2019-12-25 00:38:29
问题 I have a Struts form which contains a Map: private Map<Long, String> questionAnswers = new TreeMap<Long, String>(); I have the normal getter and setter for this variable (not shown here), and I also have the getter and setter required for Struts to work (using String/Object): public Object getQuestionAnswer(String questionId) { return getQuestionAnswers().get(questionId); } public void setQuestionAnswer(String questionId, Object answerText) { String answer = (answerText == null) ? "" :

how to access formbean class obj in jsp page

丶灬走出姿态 提交于 2019-12-24 20:25:57
问题 I want to access from bean object in jsp page. How to get that? I have formbean class with customername,date,amount,rate etc with setter() and getter() for the field members. I have data access class where i can get data for the bean class property from database and set data to formbean class object E.g.: class formbean{ String amount; String rate; public void setAmount(String amount) { this.amount=amount }; String getAmount() { return amount; } ... } class dao { public Formbean fetchcust() {

Struts Action class execute() method…return null

可紊 提交于 2019-12-24 15:55:29
问题 Struts Action class execute() method…return null I am working on "Struts 1 Plugin". We have a Struts1 application and we want to use Action,ActionForm of Struts1 application to into Struts 2 Application. In Struts 1 Plugin, all Action class is getting called from Struts1Action class. public class Abc extends Action { public ActionForward execute(mapping, form, request, response) { if(some conditon) { response.sendRedirect("/some/action.do"); return null; } } } the above code works fine in

How to retrieve the data from the database and display it on a jsp using Struts and Hibernate

家住魔仙堡 提交于 2019-12-24 14:12:24
问题 I am new to Struts. I want to display all the details from a table to the user on a JSP page. Here is my code: public class ListeActeurAction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception { System.out.println("Action"); ListeActeur ListeActeur= (ListeActeur) form; String query = "select nomActeur from Acteur " ; ListeActeur.setLis( HibernateUtil.ListeActeur(query, req)); req.setAttribute(

struts 2 - where should I set global application variables?

久未见 提交于 2019-12-24 13:45:21
问题 I'm using struts 2 and I'd like to read some custom-defined parameters (global variables), preferably from web.xml or some custom ".properties" file (i.e. not hardcoded in the Java sources). This problem has been driving me mad for the past half hour as I can't google any reasonable solution. What is the best way to do this? I find it strange that it is so difficult ... all the best Nicola Montecchio 回答1: Ask yourself first: are those constants really pertinent to Struts2 or just to your

Struts 1.1 and Servlet 2.5 - NoClassDefFoundError for JspException during tests

落爺英雄遲暮 提交于 2019-12-24 13:44:08
问题 After updating servlet-api provided dependency in pom from 2.3 to 2.5, unit tests for our custom Struts 1.1 RequestProcessor started to fail with NoClassDefFoundError: javax/servlet/jsp/JspException, which indeed is lacking in servlet-api-2.5, compared to 2.3. I use JUnit 4.11 and JMockit 1.2 for unit testing. Interestingly, the application works fine after deploying it to JBoss 5.1. Is Struts 1.1 compatible with web apps using servlet api 2.5? Maybe JBoss 5.1 servlet-api is different from