Pattern « Development « JSP-Servlet Q&A

1. Is there a way to access web.xml properties from a Java Bean?

Is there any way in the Servlet API to access properties specified in web.xml (such as initialization parameters) from within a Bean or Factory class that is not associated at all ...

2. Is it an anti-pattern to put labels and such in property files (releated to JSP's and web development)

I see a lot of J2EE developers put labels in property files but don't use different Locales. So, you get a lot of missing property exceptions. And the main ...

3. Using sqls in JSP - What is the best practice?

Say, You have an application which lists down users in your application. Ideally, if you were writing code to achieve this in Java, irrespective of what your UI layer is, I ...

4. Best practices of implementation of front controller using java servlets

Suppose we have some project with next structure:


5. singletonclasses

how to create singleton classes for multiple uses and how to connect to jsp with that singleton class

6. JSP template implementation (Composite View Pattern)

What is the best way to implement the Composite View Pattern for a Java website? My idea was to take one jsp and include multiple pages like:

<h1>Layout Start</h1>
Values values = DataHandler.getValues(request);
LayoutHelper layout ...

7. How to develop JSP/Servlets Web App using MVC pattern?

I'm developing a JSP/Servlet web app (no frameworks). I want to use MVC pattern. I am going to design my project like this:

  1. Controller: a servlet that reads a request, extracts the ...

8. How to create new account using servlets

I want to know how can I create new account using servlets in post method? I'm currently following MVC design pattern, and I want to know if I pass the required data ...

9. Business Logic Layerin Servlet and JSP

Recently I started to move from a .NET platform to J2EE. I'm Eclipse to build JSP and Servlet applications which should use Business Logic layer. The approach in .NET is very simple ...

10. Design Patterns web based applications

I am designing a simple web based application. I am new to this web based domain.I needed your advice regarding the design patterns like how responsibility should be distributed among Servlets, ...

11. jsp jdbc data access layer design

Hi: I have a question about how to design and map object class in java with database(sql). For example, if I have Customer and Order Class which match with Customer and Order Table ...

12. Looking for a good pattern to implement View adapters for objects, in Java/JSP

this is more a design question. Suppose you have many beans A, B, C.... Then you have a class that creates, say, tables out of beans. You need something that tells ...

13. JSP/javabean/servlet MVC

Where should mysql code go in terms of MVC? Obviously not the view.

14. Ajax call to a JSP

I am working on a web app, where a EXTJS makes an ajax call to a JSP, the JSP in turn calls a java class and then returns the value and ...

15. why business logic should be moved out of JSP?

What are the advantages of keeping the business logic outside JSP, since JSP's are meant mainly for presentation? We still see business logic written inside the JSP, so I needed ...

16. Variable declarations conventions/rules in Java MVC pattern?

I am a novice in Java World. How to avoid confusion over variable declaration in MVC pattern over same variable? For Example, In Servlet (Controller):

String firstName     = request.getParameter("firstname");
String lastName ...

17. servlet code structure / pattern ideas ? writing response

I have a simple servlet at the moment. I need it to call a static jar method and return its response. 1) Can someone recommend a suitable structure ie do I need ...

18. How does a servlet uses BusinessDelegate?

I have a Servlet

public class ParameterSnoop extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res){
String name = request.getParamter("name");
UserDTO user UserDTO();
If i have a BusinessDelegate as shown , how the servlet uses ...

19. Refactoring Java Servlets - Looking for a good naming scheme

I'm refactoring an existing (Ajax) Java Web application, which currently holds lots of its logic directly in the servlets. (The servlets even call each other, using a few nasty tricks ...) The ...

21. Best Practices, Patterns vs 'Workable Patterns'

a couple of weeks ago i was speaking with another programmmer and friend of mine. he had a problem: 'translate' a series of complicated ASP pages which relied heavily on a couple of database tables into a servlet/JSP application. should he use a command pattern/ servlet centric application? (in which a single servlet takes input and delegates the appropriate responses through ...

22. Security in MVC Pattern

Hi, There are two very typical ways of going about this, and probably others that work equally well. For the resources you don't want to be accessed externally ( from a browser ), you can: 1) Put them inside of WEB-INF ( best located in a subdirectory there ). This makes them accessible internally (eg: from forward() ), but not externally ...

23. Composite View Pattern using JSP .....

Hi, I'am trying to develop an Architecture where the static content, images etc displayed to the user will be dynamic,in the sense personalised according to User's preference & access to the system. The static content is not populated thru the Database but rather delivered through plain HTML pages included at run time. Are there any design pattern , Api's,Reference material availabe ...

24. Resuable Design pattern for jsps

Hi, We have one application which is developed for some number of branches. and for all these branches we have some similarity in display and data(around 60% similar in case of data). which we have developed and running in production. Now we want to add some more branches in our application. for this we have to add some new jsps/java codes ...

25. Design Patterns

27. JSP Design Pattern

30. Bread crumbs pattern

31. Design patterns for templates (or something like that ...)

Hello everyone, I'm developing a webapp which has a web structure similar to a portal (well, it actually is a portal!). Like in every other portal on the web, there will be a great number of pages which all have the same structure, i.e. an header, a navigation bar, left and right menu's, a footer and so on. The content of ...

32. JSP/servlet Application in MVC pattern

34. Authentication with JDBC Realms and MVC pattern (Controller servlet)

Hello, I am developing a web application using the MVC pattern and I try to use to athenticate with JDBC Realms. My problem is that using this athentication method with a Controller servlet that forwards requests to a proper jsp page dont works. I dont know to do. If someone know how I have to do to athenticate using a Controller ...

35. Design Patterns in Servlet and JSP

37. need of Design Pattern with servlet

38. JSP - Servlet Comm Pattern

41. Difference between two J2EE design patterns books

I posted this in Java-Intermediate forum earlier but I believe this might be the right forum. ---------------------------------------------------------------------------- Hi, I was checking through J2EE Design Patterns books. In Barnes and Noble I came across two books. 1. Core J2EE Patterns (Core Design Series) : Best Practices and Design Strategies 2. Core J2EE Patterns : Best Practices and Design Strategies, Exclusive Poster Edition ...

42. pattern to deal with exception in the commit or rollback phase

Hi, Just wondering if there is a best practice, or pattern for dealing with fairly low-level exceptions, that happen during commit or rollback. For example, all my code is 100% successful, and the container (Jboss 3.2.6) is now committing all the DB stuff. Then an exception happens. The reason that I need to 'deal' with it, is that in a separate ...

43. service locator pattern and DI

Service Locator pattern is still need for web frameworks that does not support DI. An alternative for such is simply let the EJB container inject instances of the session beans (whether remote or local) into a servlet which are declared as instance variables, override the init and load the servlet at startup. Now you have a service locator POJO (singleton that ...

44. Help me understanding the PRG Pattern

45. Wrapper pattern in HttpServletRequest

46. J2EE - Pattern - Business Objects

47. JDNI, Business Delegate/Proxy and Service Locator patterns

I'd like to put together code that can access an object in a different domain/server address, but I do not want to construct the "remote" object locally - I want to use JDNI, Business Delegate/Proxy and Service Locator patterns to achieve the desired result. To that end I have a couple of questions: 1. How do I get JNDI to provide ...

49.  problem

53. Implementing MVC Design Pattern

54. MVC pattern

55. DTO Assembler pattern methods

I'm using the DTO Assembler pattern in my project to copy data from DTO to hibernate entities and vice versa. When I copy values no problem. The problem arises when I have to establish relations based on the ID (from FKs) that represent relationships within the DTO. This makes the DTOAssembler methods have to be transactionals and that also have to ...

56. Java pattern for JSP Quiz Application