Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

struts taglib problem!

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using <html:hidden> like this, right?? help me
<html:form action="/shop/cart.do" method="POST">
<font size="2">num:</font><html:text property="qty" size="2"/><br>
<bean efine id="id" name="products" property="productId" type="java.lang.String"/>
<bean efine id="discount" name="products" property="discount" type="java.lang.String"/>
<bean efine id="productName" name="products" property="productName" type="java.lang.String"/>
<html:hidden property="productId" value="<%=id%>" write="true"/><input type="hidden" name="action" value="addcart">
<html:hidden property="price" value="<%=discount%>"/>
<html:hidden property="productName" value="<%=productName%>"/>
<html:hidden property="userName" value="<%=(String)session.getAttribute("username")%>"/>
<html:submit property="B1" value="addcart"/></html:form>
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<html:hidden property="price" value="<%=discount%>"/>



Try this

<input type="hidden" value="<%=discount%>" name="price">

struts doesn't allow nesting of tags.so quoted one is not possible.
 
swenling wen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very much!!!
I have thinked that struts tags can be nested.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do these values relate to your form? If they are properties of your form then you can get rid of the bean:define lines and just use this:

<html:hidden property="price" />

- Brent
 
swenling wen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get a value from bean and then relate to my form.
How to solve it? such as:
<bean efine id="id" name="products" property="productId" type="java.lang.String"/> ---this get a value from a bean
<html:hidden property="productId" value="<%=id%>" write="true"/>
---put this value to my form <html:hidden>
Right???do like this.
 
Hold that thought. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic