You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Harshal D <em...@yahoo.com> on 2002/12/08 19:22:02 UTC

Pass parameter to the same JSP & Display parameter value into i/p bean field.

 My app (simplified)
ProductSearch.jsp � display a search box (searchForm) for product name 

-- > Action - > Get name string create product bean

 --> (AGAIN) ProductSearch.jsp display list of products bellow the search box.

--> In the list display QTY from product bean � but allow user to change it � submit every line to GetPrice action with changed product bean (changed qty).

Questions:

1>    Any example of similar code ? � pass parameter to the same JSP (preferred request scope)

2>    A table row displays i/p bean property as well as allows user to change � any such example?

3>    Basically for some reason my parameter passing is not working � if any one wants to help I�ll send the code. My guess � I do not understand bean creation / resetting.

 

Thanks

 

Harshal.



---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now

Re: Pass parameter to the same JSP & Display parameter value into i/p bean field.

Posted by "V. Cekvenich" <vi...@users.sourceforge.net>.
Here is where you can find sample apps, cleverly hidden on the home page 
of Struts:
http://jakarta.apache.org/struts/resources/index.html

But don't be shy about taking a intro public Struts training class, 
there are like 10 companies that train ( It used to be a few last year). 
Or consider a mentor/consultant, many on this list.

I think you display a list of items, and users type in how many of each 
they want to order or something? If so:
Once you master parm passing using examples above(it is so basic in 
Struts), bellow is an example of a multi row update.
It might be more intermediate to do this. (that is why I like to teach 
Struts to people how "know" Struts)
Struts basically does multi row updates for you almost transparent, 
trick is index tag and form bean that implements iterator (you know 
where the example is, right?). Rumor is that David Karr is adding docs 
on Index tag in a few days.
Multi row updates are basis of doing master detail processing on a 
single page or a many to many on a single page, I give you sample 
working code for a simple multi row update:

<%@ tag lib uri="struts/html" prefix="html" %>
<%@ taglib uri="struts/logic" prefix="logic" %>
<%@ taglib uri="jstl/c" prefix="c" %>

<html>
<head>
<link rel=stylesheet type="text/css" href="css/default.css">

<html:form action="/myconcreateaction?Dispatch=Save">

<table>
<logic:iterate name="myFormBean" id="row">
<tr>
<td>Username:</td>
<td><html:text name="row" indexed="true" property="fieldName"/></td>
</tr>
</logic:iterate>

</table>

<html:submit property="submit" value="Save" />

</html:form>

</body>
</html>

hth,

.V


Harshal D wrote:
>  My app (simplified)
> ProductSearch.jsp – display a search box (searchForm) for product name 
> 
> -- > Action - > Get name string create product bean
> 
>  --> (AGAIN) ProductSearch.jsp display list of products bellow the search box.
> 
> --> In the list display QTY from product bean – but allow user to change it – submit every line to GetPrice action with changed product bean (changed qty).
> 
> Questions:
> 
> 1>    Any example of similar code ? – pass parameter to the same JSP (preferred request scope)
> 
> 2>    A table row displays i/p bean property as well as allows user to change – any such example?
> 
> 3>    Basically for some reason my parameter passing is not working – if any one wants to help I’ll send the code. My guess – I do not understand bean creation / resetting.
> 
>  
> 
> Thanks
> 
>  
> 
> Harshal.
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>