Link to home
Start Free TrialLog in
Avatar of Vinay_enjoy
Vinay_enjoy

asked on

Build web page dynamically

Hi,

In a web based application using jsp/htmls at front end, I need to build a page dynamically. Mean, I have to first ask few questions to the user and based on their answers only, I have to build and display the page accordingly.

Please help me know how can I do this in a web based application using java-j2ee technology.

Thanks,
Vinay.
email:vinay_aggarwal76@yahoo.com
Avatar of Eternal_Student
Eternal_Student
Flag of United Kingdom of Great Britain and Northern Ireland image

I would use a form with lists to display possible choices and depending on the users choices display a different style sheet.

That would be a simple option .. alternatively you could pass the values into the css styles inline. So you store the value in a variable, post that variable to the page that generates the layout/style etc etc and then extract the variable where needed.

Not sure entirely what you wish to achieve but that is a basic over-view.
Avatar of Mr_Lenehan
Mr_Lenehan

I would agree mostly with Eternal_Student, I'd do something like:

<%
String param1 = ""+request.getParameter("param1");
if(param1 .equals("null")){
//give a form to fill in
%>
<form action="thispage.jsp" method="post">
<input type="text" name="param1">
</form>
<%
}
else{
//do somthing with the values
if(param1.equals("0")){
%>
<!-- do stuff that would happen if param1 was 0 -->
<% } //endif%>

<% }//endelse %>
Avatar of Vinay_enjoy

ASKER

Thanks Guys. Let me elaboarte my requirement.
1. I have to display a table on the web page. But I have to ask the user first how many rows and columns he want. Based on his answer only, I would display thta many rows & cols.

2. Then I would ask the user what features he want. This will determine the name of the cols. Whatever features he chose from many check box options, those features will become the col heading.

3. In the final table, the left most col for Serial No will appear by default and it will be non-editable. The values will be 1 to n, populated automatically when the page/table gets displayed,  depending on how many rows the user has chosen.

Appreciate further inputs on this.

Thanks Again,
Regards,
Vinay.
email:vinay_aggarwal76@yahoo.com


ASKER CERTIFIED SOLUTION
Avatar of Mr_Lenehan
Mr_Lenehan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot Lenehan !!!

 This is very useful piece of code.

Cheers,
Vinay.