We help IT Professionals succeed at work.

Build web page dynamically

292 Views
Last Modified: 2010-04-06
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
Comment
Watch Question

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.
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 %>

Author

Commented:
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


This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks a lot Lenehan !!!

 This is very useful piece of code.

Cheers,
Vinay.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.