jsp/servlet question : problem with repeating/retyping of code

M

Mladen Adamovic

I add multilanguage support to my jsp/servlet application.
I make my own classes for that support, and they are working ok, but my
index.jsp looks like:

<h2>Choose language:</h2>
<a href="set-english.jsp">English</a>
<a href="set-german.jsp">German</a>
.....

and a lot of set-*.jsp files i.e.
<%
//this is set-english.jsp
Language l=(Language) session.getAttribute("language");
l.setLanguage("ENGLISH");
%>
<jsp:forward page="/login.jsp"/>

I have for now English,German,French,Italian,Portuguese,Spanish,Serbian and
Japanese and I don't want each language to have appropriate set-*.jsp file.
 
A

Andrew Thompson

Mladen Adamovic said:
I add multilanguage support to my jsp/servlet application.
I make my own classes for that support, and they are working ok, but my
index.jsp looks like:

Were you..
a) telling us about your problem? or
b) asking a question?

If 'a' - poor you (shrugs).
If 'b' - you forgot the question!
 
T

Tor Iver Wilhelmsen

Mladen Adamovic said:
I have for now English,German,French,Italian,Portuguese,Spanish,Serbian and
Japanese and I don't want each language to have appropriate set-*.jsp file.

Add a parameter to login.jsp that takes the language, e.g.

<a href="login.jsp?language=ENGLISH">English</a>
 
M

Mladen Adamovic

Andrew Thompson said:
Were you..
a) telling us about your problem? or
b) asking a question?

Yeah. I was a bit confuse especially in my Subject.
I were so tired yesterday becouse I worked for 14 hours on my project, I
have just 5 minutes to write a message and never forget to say Mladen -
English is not my native language.
 
M

Mladen Adamovic

Tor Iver Wilhelmsen said:
Add a parameter to login.jsp that takes the language, e.g.

<a href="login.jsp?language=ENGLISH">English</a>

Fine. It works in combination with request.getParameter("language");
Thank you a lot Tor Iver for help.
I feel a bit shamed becouse I didn't know this "param" things - but as
someone here sad "live and learn".
IMHO j2ee API Documentation and tutorial are not good in examples and index.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top