?
Solved

Pass query string parameters dynamically from action class

Posted on 2005-03-07
3
Medium Priority
?
278 Views
Last Modified: 2010-03-31
Hi folks,
I am having a simple problem which I am frankly unable to solve. I want to pass query string parameters from the action class. I want to append it with the action mapping and send it with the request. I want to know how to achieve this solution?

Simple example code will do good for me....because I am in need of it.

Regards
0
Comment
Question by:pampa34
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 29

Accepted Solution

by:
bloodredsun earned 500 total points
ID: 13475083
I assume that you're using Struts here as you haven't said.

The query string is available to the view layer (your jsp) so you don't need to pass them explicitly. If you are talking about passing parameters created in the action to the view layer, that's a bit of an odd thing to do as that is what your actionForm is for.

An alternative approach would be to use an extra javabean that you can stick in the request in the action and then access it in the jsp using jstl.

e.g.

action
------------
ParamBean pb = new ParamBean() ; //map-backed bean
pb.addParam("param1" , "Hello there") ; //enter into bean hashmap
pb.addParam("param2" , "Hello back") ; //enter into bean hashmap
request.setAttibute("paramBean" , pb ) ; //save into the request

jsp
------------
<c:out value='${requestScope.paramBean.param[0]}'/>
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question