You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yan Hu <ya...@yahoo.com> on 2005/02/17 17:43:53 UTC

Newbie--->Construct JSPs on the fly

Hello Guys:
   This is my first real Struts-based project. I am fairly new to Struts. I know some basics and
tried a few toy examples. Now it is time for a serious one.
   My project involes students.   Each student has her own page that might take her to pages that
are customized just for her.  I can not jus write a JSP page for each student. For example, a
student is taking Eng101, Chem101, and CS120 this semester.  I fetch from the database all the
info for these 3 classes she is taking.    I do not want to put all the info on the first page
after she logged in.  I want to have three links on the first page and take her to a sub JSP page
for each specific class for example Eng101.jsp.  There are lots of students. I can�t write all the
pages for them.  In addition, it changes every semester what classes a student takes.   My
question is how do I construct JSPs on the fly? I will need to use Tile. What else do you suggest
me to look into? Thank you very much.


=====


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Thank you all for answering Re: Newbie--->Construct JSPs on the fly

Posted by Yan Hu <ya...@yahoo.com>.
Hello Guys:
First and foremost, I wanted to thank you all for answering my question.  I believe I can learn a
lot of Struts skills and other related skills here.  Thanks again.



> Yan Hu wrote:
> 
> >Hello Guys:
> >   This is my first real Struts-based project. I am fairly new to Struts. I know some basics
> and
> >tried a few toy examples. Now it is time for a serious one.
> >   My project involes students.   Each student has her own page that might take her to pages
> that
> >are customized just for her.  I can not jus write a JSP page for each student. For example, a
> >student is taking Eng101, Chem101, and CS120 this semester.  I fetch from the database all the
> >info for these 3 classes she is taking.    I do not want to put all the info on the first page
> >after she logged in.  I want to have three links on the first page and take her to a sub JSP
> page
> >for each specific class for example Eng101.jsp.  There are lots of students. I can t write all
> the
> >pages for them.  In addition, it changes every semester what classes a student takes.   My
> >question is how do I construct JSPs on the fly? I will need to use Tile. What else do you
> suggest
> >me to look into? Thank you very much.
> >
> >
> >=====
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >  
> >
> 
> -- 
> CM II
> Resolution Systems Inc.
> /-- never compromise. what if you compromise and lose? --/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


=====


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Newbie--->Construct JSPs on the fly

Posted by Karan <ka...@resolution.com>.
Apart from all the other suggestions, if you're going to be doing this 
kind of work often you might want to look at Freemarker:
just create the template and retreive all customizable data from ur 
framework.

HTHs,
Karan

Yan Hu wrote:

>Hello Guys:
>   This is my first real Struts-based project. I am fairly new to Struts. I know some basics and
>tried a few toy examples. Now it is time for a serious one.
>   My project involes students.   Each student has her own page that might take her to pages that
>are customized just for her.  I can not jus write a JSP page for each student. For example, a
>student is taking Eng101, Chem101, and CS120 this semester.  I fetch from the database all the
>info for these 3 classes she is taking.    I do not want to put all the info on the first page
>after she logged in.  I want to have three links on the first page and take her to a sub JSP page
>for each specific class for example Eng101.jsp.  There are lots of students. I can t write all the
>pages for them.  In addition, it changes every semester what classes a student takes.   My
>question is how do I construct JSPs on the fly? I will need to use Tile. What else do you suggest
>me to look into? Thank you very much.
>
>
>=====
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

-- 
CM II
Resolution Systems Inc.
/-- never compromise. what if you compromise and lose? --/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Newbie--->Construct JSPs on the fly

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Do you really need to construct JSPs on-the-fly or do you instead need to
create a template that contains sections that are modified on a
per-student basis?

The student-specific page sounds to me from what you wrote to more or less
just be a links page with links to the classes specific to each student. 
That wouldn't require a separate JSP for each, just a database with the
classes a student is taking and perhaps addresses for the pages for each
class.  Just some usual JSP dynamic content there it seems.

By extension, do the same for each class... Don't literally have a JSP for
each class... instead, just have a JSP "template" that you insert the
class information from the database into.

You'd be down to just 2 JSPs for everything.

Am I missing a requirement somewhere?  If not, this seems pretty
straight-forward.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, February 17, 2005 11:43 am, Yan Hu said:
> Hello Guys:
>    This is my first real Struts-based project. I am fairly new to Struts.
> I know some basics and
> tried a few toy examples. Now it is time for a serious one.
>    My project involes students.   Each student has her own page that might
> take her to pages that
> are customized just for her.  I can not jus write a JSP page for each
> student. For example, a
> student is taking Eng101, Chem101, and CS120 this semester.  I fetch from
> the database all the
> info for these 3 classes she is taking.    I do not want to put all the
> info on the first page
> after she logged in.  I want to have three links on the first page and
> take her to a sub JSP page
> for each specific class for example Eng101.jsp.  There are lots of
> students. I can’t write all the
> pages for them.  In addition, it changes every semester what classes a
> student takes.   My
> question is how do I construct JSPs on the fly? I will need to use Tile.
> What else do you suggest
> me to look into? Thank you very much.
>
>
> =====
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Newbie--->Construct JSPs on the fly

Posted by Nic Werner <we...@sonoma.edu>.
It looks like your issue isn't about customized page names, but 
customized links.

I don't know your implementation, and I'm going to abstract out the 
Tiles/Struts portion, but here is how I would do it:

- For the intro page, load the class schedule from the database, and its 
according class code.

- Create dynamic links that pass it to a 'ShowIndivClasses.jsp' page, 
with the parameters of the class to display details for.
ie <a href="ShowIndivClasses.jsp?class=ENG101">English 101</a>

- This page now loads up the information from wherever (DB,Bean) and 
displays the relative information based on the param.

Hope this gave a bigger picture on flow.

- Nic

Mark Lowe wrote:

>For example, a
>student is taking Eng101, Chem101, and CS120 this semester
>
>These all look like modules you'll want to search for "indexed
>properties" on the archieves, and you'll start to see how to go about
>this.
>
>StudentBean student = new StudentBean();
>CourseBean course = new Course();
>course.setCode("ENG101");
>course.setTitle("Introductory English");
>student.addCourse(course);
>
>request.setAttribute("student",student);
>
>...
>
><c:forEach var="course" items="${student.courses}">
>${course.code}
></c:forEach>
>
>or
>
><logic:iterate id="course" name="student" property="courses">
><bean:write name="course" property="code" />
></logic:iterate>
>
>
>
>Mark
>
>
>On Thu, 17 Feb 2005 11:48:51 -0500, Jerry Tan <jt...@dtcc.com> wrote:
>  
>
>>Hello Yan,
>>
>>While the concept of constructing JSP's dynamically is an intriguing one, I
>>am still of the opinion that you can handle your situation below in a more
>>conventional manner.
>>
>>For example, one simper way would be to have an array of String, which
>>represents that particular student's course list for that particular
>>semester.
>>
>>Based on the values of contained in this array, you can construct the
>>appropriate links to that particular course, e.g., ENG101.jsp, etc.
>>
>>hth,
>>
>>                     Yan Hu
>>                     <yachilling@yahoo        To:       Struts Users Mailing List <us...@struts.apache.org>
>>                     .com>                    cc:       (bcc: Jerry Tan/DTCC)
>>                                              Subject:  Newbie--->Construct JSPs on the fly
>>                     02/17/2005 11:43
>>                     AM
>>                     Please respond to
>>                     "Struts Users
>>                     Mailing List"
>>
>>
>>Hello Guys:
>>  This is my first real Struts-based project. I am fairly new to Struts. I
>>  know some basics and
>>tried a few toy examples. Now it is time for a serious one.
>>  My project involes students.   Each student has her own page that might
>>  take her to pages that
>>are customized just for her.  I can not jus write a JSP page for each
>>student. For example, a
>>student is taking Eng101, Chem101, and CS120 this semester.  I fetch from
>>the database all the
>>info for these 3 classes she is taking.    I do not want to put all the
>>info on the first page
>>after she logged in.  I want to have three links on the first page and take
>>her to a sub JSP page
>>for each specific class for example Eng101.jsp.  There are lots of
>>students. I can't write all the
>>pages for them.  In addition, it changes every semester what classes a
>>student takes.   My
>>question is how do I construct JSPs on the fly? I will need to use Tile.
>>What else do you suggest
>>me to look into? Thank you very much.
>>
>>=====
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Newbie--->Construct JSPs on the fly

Posted by Mark Lowe <me...@gmail.com>.
For example, a
student is taking Eng101, Chem101, and CS120 this semester

These all look like modules you'll want to search for "indexed
properties" on the archieves, and you'll start to see how to go about
this.

StudentBean student = new StudentBean();
CourseBean course = new Course();
course.setCode("ENG101");
course.setTitle("Introductory English");
student.addCourse(course);

request.setAttribute("student",student);

...

<c:forEach var="course" items="${student.courses}">
${course.code}
</c:forEach>

or

<logic:iterate id="course" name="student" property="courses">
<bean:write name="course" property="code" />
</logic:iterate>



Mark


On Thu, 17 Feb 2005 11:48:51 -0500, Jerry Tan <jt...@dtcc.com> wrote:
> 
> Hello Yan,
> 
> While the concept of constructing JSP's dynamically is an intriguing one, I
> am still of the opinion that you can handle your situation below in a more
> conventional manner.
> 
> For example, one simper way would be to have an array of String, which
> represents that particular student's course list for that particular
> semester.
> 
> Based on the values of contained in this array, you can construct the
> appropriate links to that particular course, e.g., ENG101.jsp, etc.
> 
> hth,
> 
>                      Yan Hu
>                      <yachilling@yahoo        To:       Struts Users Mailing List <us...@struts.apache.org>
>                      .com>                    cc:       (bcc: Jerry Tan/DTCC)
>                                               Subject:  Newbie--->Construct JSPs on the fly
>                      02/17/2005 11:43
>                      AM
>                      Please respond to
>                      "Struts Users
>                      Mailing List"
> 
> 
> Hello Guys:
>   This is my first real Struts-based project. I am fairly new to Struts. I
>   know some basics and
> tried a few toy examples. Now it is time for a serious one.
>   My project involes students.   Each student has her own page that might
>   take her to pages that
> are customized just for her.  I can not jus write a JSP page for each
> student. For example, a
> student is taking Eng101, Chem101, and CS120 this semester.  I fetch from
> the database all the
> info for these 3 classes she is taking.    I do not want to put all the
> info on the first page
> after she logged in.  I want to have three links on the first page and take
> her to a sub JSP page
> for each specific class for example Eng101.jsp.  There are lots of
> students. I can't write all the
> pages for them.  In addition, it changes every semester what classes a
> student takes.   My
> question is how do I construct JSPs on the fly? I will need to use Tile.
> What else do you suggest
> me to look into? Thank you very much.
> 
> =====
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Newbie--->Construct JSPs on the fly

Posted by Jerry Tan <jt...@dtcc.com>.
Hello Yan,

While the concept of constructing JSP's dynamically is an intriguing one, I
am still of the opinion that you can handle your situation below in a more
conventional manner.

For example, one simper way would be to have an array of String, which
represents that particular student's course list for that particular
semester.

Based on the values of contained in this array, you can construct the
appropriate links to that particular course, e.g., ENG101.jsp, etc.

hth,






                                                                                                                                       
                      Yan Hu                                                                                                           
                      <yachilling@yahoo        To:       Struts Users Mailing List <us...@struts.apache.org>                            
                      .com>                    cc:       (bcc: Jerry Tan/DTCC)                                                         
                                               Subject:  Newbie--->Construct JSPs on the fly                                           
                      02/17/2005 11:43                                                                                                 
                      AM                                                                                                               
                      Please respond to                                                                                                
                      "Struts Users                                                                                                    
                      Mailing List"                                                                                                    
                                                                                                                                       




Hello Guys:
   This is my first real Struts-based project. I am fairly new to Struts. I
   know some basics and
tried a few toy examples. Now it is time for a serious one.
   My project involes students.   Each student has her own page that might
   take her to pages that
are customized just for her.  I can not jus write a JSP page for each
student. For example, a
student is taking Eng101, Chem101, and CS120 this semester.  I fetch from
the database all the
info for these 3 classes she is taking.    I do not want to put all the
info on the first page
after she logged in.  I want to have three links on the first page and take
her to a sub JSP page
for each specific class for example Eng101.jsp.  There are lots of
students. I can’t write all the
pages for them.  In addition, it changes every semester what classes a
student takes.   My
question is how do I construct JSPs on the fly? I will need to use Tile.
What else do you suggest
me to look into? Thank you very much.


=====


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org