You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andre Wittenburg <an...@cth.de> on 2000/11/30 17:34:02 UTC

Preprocessing for a jsp

Hi!

I'm a newbie, so ....

I want to initialize a Form in my ServletController before redirecting
 to the jsp. 

In my scenario the user has already logged on the system and is navigating
 through the pages...
.. on a <href> i would like to redirect to a servlet which ask the db for
some values and fills some form data (e.g. a selection list) befor the 
page is displayed to the user. 

Looks like i made some wrong configuration in the xml-files, because i get
a java.lang.ClassCastException when the servlet is called.

Or are there any other possibilities to make this preprocessing ....


Greetings

Andre




Re: Preprocessing for a jsp

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Andre Wittenburg wrote:

> Hi!
>
> I'm a newbie, so ....
>
> I want to initialize a Form in my ServletController before redirecting
>  to the jsp.
>
> In my scenario the user has already logged on the system and is navigating
>  through the pages...
> .. on a <href> i would like to redirect to a servlet which ask the db for
> some values and fills some form data (e.g. a selection list) befor the
> page is displayed to the user.
>

The Struts example application illustrates the approach that I normally take on
this issue.  Instead of hyperlinking to the next JSP page directly, hyperlink to
a URI that goes through the controller servlet, which can then call an action
that sets up your beans and forwards to the ultimate JSP page.

At the bottom of "registration.jsp", there is a "Create" link to create a new
subscription.  The destination URI for this is
"/editSubscription.do?action=Create", which calls an action to set up the
correct request attributes before forwarding to the entry form.

>
> Looks like i made some wrong configuration in the xml-files, because i get
> a java.lang.ClassCastException when the servlet is called.
>

There are many possible causes for ClassCastException -- we would need to see
the actual code (and the actual exception stack trace) to be more helpful.

>
> Or are there any other possibilities to make this preprocessing ....
>
> Greetings
>
> Andre

Craig McClanahan



Re: Preprocessing for a jsp

Posted by Pierre Métras <ge...@sympatico.ca>.
Hi Andre,

> Looks like i made some wrong configuration in the xml-files, because i get
> a java.lang.ClassCastException when the servlet is called.

We need a little more information to help, because a Cast exception can
occurs almost everywhere...
Which version of Struts are you using? And give us an extract of your
configuration file, with the stack dump.

Pierre Métras