some question of using Struts

I am now using Struts for the development. I have 3 questions about J2EE

pattern by the use of Struts:

1) How can I use Struts to create the Front Controller? In the book

descibing Front Controller, it is a servlet file which receives the request

and then dispatches to the appropriate view according to the request.

However, in using Struts, should I use the same way? However, I found that

in using Struts, I can call the controller class which subclass

ActionServlet, all the views forwarded are declared in the

struts-config.xml. Am I right in this method?

2) In the project, there is a Front Controller which dispatches the request

to the appropriate view (jsp file). Of course, I use Struts to do this.

However, I expect that the user is impossible for going to the view (jsp

page) directly by typing the address of the jsp file. I hope that the user

can go to the view through the controller only. How can I do this?

3) There is a problem by using browser - when a user browses a site, he can

press the 'back' button to the previous page, and then click the 'forward'

button also. How can I prevent this by using Struts? I found that in some

sites, when the user clicks the 'back' button, an error page displays. How

can I do this? Thanks!

Many Thanks!

Leyland

[1414 byte] By [leefungho] at [2007-9-27 4:42:37]
# 1
1. ActionServlet is the FrontController. the controller classes for your application must derive from the class Action.2. Place all JSPs that shall be protected under the WEB-INF folder3. In struts version 1.1 there is a synchronizer token tag.
babbela at 2007-7-5 14:30:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Where can I find the information of Synchronizer Token Tag in Struts? I can't find it?Thanks
leefungho at 2007-7-5 14:30:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Sorry for the mistake. There is no tag for it. There is a method in the Action class called

yourActionClass.generateToken(HttpServletRequest)

http://jakarta.apache.org/struts/api/org/apache/struts/action/Action.html#generateToken(javax.servlet.http.HttpServletRequest)

babbela at 2007-7-5 14:30:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Sorry for piggy-backing this thread.

The way I understand it, in STRUTS' MVC model, an action from an jsp is first processed by the ActionServlet which then redirects the action to the Action.class. The Action.class does the processing and forward the results to the browser. In doing so, the Action.class generates a fresh page everytime it receives and action redirected from the Action.class.

My question is:

Is there a way for a page displayed in a browser to send an action back to the ActionServlet which causes another action.class to modify the page? The pages to be share are determined at runtime.

The purpose of doing this is to recycle/share some jsp among the Action.class so that I can cut down on the number of jsp I need to maintain.

loheg at 2007-7-5 14:30:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Hi, go ahead and decide the action to which u have to redirect the jsp using java script controll statments.
pkp_pradeep at 2007-7-5 14:30:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...