struts

EntityManager ThreadLocal pattern with JPA in JSE

▼魔方 西西 提交于 2019-11-27 14:08:50
问题 I'm developing a simple "Book Store" project using Struts 1.3 + JPA (with Hibernate as persistence provider). I cannot switch to Spring or any other more sophisticated development environment (e.g., Jboss) and I cannot use any Hibernate-specific technique (e.g., Session class). Given the fact that I'm in a JSE Environment, I need to explicitly manage the whole EntityManager's lifecycle. The Book entity is defined as follows: @Entity public class Book { @Id private String isbn; private String

Address already in use: JVM_Bind java

白昼怎懂夜的黑 提交于 2019-11-27 12:33:38
Some times whenever I restart the application, which is built on Java Struts Mysql and Jboss 4.05 Version I get the error as Address already in use: JVM_Bind Only fix that i know is to restart the machine and try again, it will work. Else Some times I do Ctrl-Alt-Del and Stop all the process related to Java, some times this also works. But what is the exact reason and how can we prevent this problem ? phoenix24 Address already in use: JVM_Bind means that some other application is already listening on the port your current application is trying to bind. what you need to do is, either change the

struts select tag with values of a array list

↘锁芯ラ 提交于 2019-11-27 09:48:16
I am developing a simple struts application. In my JSP I have a dropdown list box (using s:select tag). I need to fill the values with a arraylist values in the action class. How can I do that? what changes needed in the structs.xml file for complete this? JSP: <s:select name="department" label="" list="departmentlist" headerKey="-1" headerValue="Select Department"> Action class: private List<String> departmentlist = new ArrayList<String>(); public String xyz() { departmentlist.add("aaa"); departmentlist.add("bbb"); departmentlist.add("ccc"); departmentlist.add("ddd"); return "success"; } The

How to fetch hibernate query result as associative array of list or hashmap

时光怂恿深爱的人放手 提交于 2019-11-27 08:06:58
I am developing an application in struts 2 and hibernate 3. I have 3 tables Inspection InspectionMission Timeline Inspection is associated with InspectionMission and InspectionMission is associated with Timeline . Now I have following problem. I have written following query in HQL public List getQuartewiseInspectionList(){ Session session = HibernateUtil.getSessionFactory().getCurrentSession(); Query q = session.createQuery( "select count(i.inspectionId) as tot_inspections,t.year,t.quarter" + " From Inspection as i " + " inner join i.inspectionMission as im inner join im.timeline as t" + "

Can`t uncheck all in Struts Multibox

巧了我就是萌 提交于 2019-11-27 06:54:45
问题 I have a j2ee application running on weblogic. I was confused with my multibox. What I know of multibox is that the checked items will be passed as an array of strings on submit. I don`t know why in my application it works fine when i uncheck a checkbox or more, as long as a single box remains checked but when I uncheck everything, the submitted array is the array of the previously checked multiboxes when it was supposed to be empty. Can you help me please? 回答1: Are you familiar with the

Struts2 list couldn't be resolved

左心房为你撑大大i 提交于 2019-11-27 06:31:36
问题 please help me. I am facing this error for 3 days. I have searched all the examples on the web, but I couldn't figured it out. These are my files: struts.xml ... <action name="menu" class="com.struts.actions.MenuAction" method="asdf"> <result name="success" type="tiles">struts2tiles.home</result> </action> ... menu2.jsp .... <body> <s:form action="menu"> <s:checkboxlist label="What's your favor color" list="colors" name="colors" /> <s:submit value="submit" name="submit" /> </s:form> </body>

Struts 2 - How to redirect exceptions of type Exception to a particular page, but not handle a particular exception?

帅比萌擦擦* 提交于 2019-11-27 06:25:15
问题 I wish to redirect all errors of type Exception to the result " error ". For that, I did this : <global-exception-mappings> <exception-mapping result="error" exception="java.lang.Exception"></exception-mapping> </global-exception-mappings> But I don't want to handle a particular exception, specifically the org.springframework.security.access.AccessDeniedException which should be allowed to propagate further. How can I achieve that ? 回答1: Use instanceof operator and rethrow desired exception

AJAX vs Form Submission

和自甴很熟 提交于 2019-11-27 04:51:01
We pull data from server and for that If we are using Struts, then we can pull either by submitting a page which MVC Architecture or we cam make an AJAX call but conventions is of using forms and render response but we also face challenges to give rich user experience, so we compromise convention and start using excessive AJAX, so how we should make balance between two? I personally think that AJAX should be used for displays updates and form submissions should be done via a page reload. Reasoning? When submitting forms, you are telling the application to do something. Users tend to want to

Getting a 'No thread-bound request found' error from spring in my web app

纵然是瞬间 提交于 2019-11-27 01:34:21
I'm getting a 'No thread-bound request found' error in my web app and hoping to get some help. I'm trying to use struts2 + spring + hibernate, and use spring to manage the hibernate session factory, and inject hibernate sessions into my struts actions. I hope that made sense. When the app starts up, there are no errors, but when i make the first web request it bombs out with the 'No thread-bound request found' error. Here's my spring config: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

Java Component based vs Request based frameworks

社会主义新天地 提交于 2019-11-26 23:57:57
问题 I was recently asked in an interview - In java, how do you compare component based frameworks to request based frameworks? I explained EJB as an example of Component based framework and Struts as a request based framework but was not convinced if I did justice to the question. Any ideas on what interviewer meant and what should have been compared?? regards, avajurug 回答1: They were most likely looking for examples of web frameworks - for example, JSF is a component-based framework, and Struts