You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Farid C <do...@yahoo.fr> on 2004/04/25 09:28:35 UTC
How to generate a static web site from struts form output ?
Good Morning
I have a struts application with a form
to browse a product catalog (database back end).
A usual query is to ask to show all the products
so instead to use cpu each time a user
requests by the form to see all the products,
I would like to generate static html files
with all the products
Do you have any idea what could be an elegant solution
?
I thought to write a standalone program who would
connect the database to get all the products and
generate the html pages on the disk.
Or to write a robot to simulate a user who connects
to the web site, ask by the form to see all the
products and browse in the output pages to dump them
on the web site.
I would appreciate any idea to code as less possible,
may be there are already some tools for this kind of
problems.
Thank you for your time
F
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to insert null using sql query in java code
Posted by Riyad Kalla <rs...@email.arizona.edu>.
Paul,
This is actually a topic I'm interested in... how do you protect from
SQL injections? (prepared statements?)
Paul Thomas wrote:
>
> On 25/04/2004 10:03 Jignesh Patel wrote:
>
>> Hi All,
>> I am following query to insert value in databse now suppose value of
>> "webpurchased","targetadvt" and 'trial" is null then how can I can
>> insert
>>
>> same null value in database.
>> Because my parameter is like String webpurchased=null --In this case
>> value of
>> webpurchase will be replaced by string 'null' while insering, which is
>> meaning less. I want to insert real null.
>>
>> MY query:
>> stmt.executeQuery("INSERT INTO advt_spns_soln VALUES
>> "+
>>
>> "(advt_spns_soln_id.nextval,'"+firstName+"','"+lastName+"','"+title+
>> "','"+
>> company+"','"+companyAddress+"','"+city+"','"+stateId+"',"+postalcode+",'"+
>>
>> country+"','"+email+"',"+phone+",'"+url+"','"+campaign+"','"+webpurchased+"','"+
>>
>> targetAdvt+"','"+trial+"','"+budget+"','"+marketobjective+"','"+emailupdate+"')");
>>
>>
>
>
> Use a PreparedStatement and its setNull method. You are, of course,
> aware that the way you're creating your SQL leaves you open to SQL
> injections.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to insert null using sql query in java code
Posted by Paul Thomas <pa...@tmsl.demon.co.uk>.
On 25/04/2004 10:03 Jignesh Patel wrote:
> Hi All,
> I am following query to insert value in databse now suppose value of
> "webpurchased","targetadvt" and 'trial" is null then how can I can insert
>
> same null value in database.
> Because my parameter is like String webpurchased=null --In this case
> value of
> webpurchase will be replaced by string 'null' while insering, which is
> meaning less. I want to insert real null.
>
> MY query:
> stmt.executeQuery("INSERT INTO advt_spns_soln VALUES
> "+
>
> "(advt_spns_soln_id.nextval,'"+firstName+"','"+lastName+"','"+title+
> "','"+
> company+"','"+companyAddress+"','"+city+"','"+stateId+"',"+postalcode+",'"+
> country+"','"+email+"',"+phone+",'"+url+"','"+campaign+"','"+webpurchased+"','"+
> targetAdvt+"','"+trial+"','"+budget+"','"+marketobjective+"','"+emailupdate+"')");
>
>
Use a PreparedStatement and its setNull method. You are, of course, aware
that the way you're creating your SQL leaves you open to SQL injections.
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to insert null using sql query in java code
Posted by yoge <yo...@adventnet.com>.
Hi,
Try the below code.
if(webpurchased != null)
{
webpurchased="'"+webpurchased+"'";
}
stmt.executeQuery("INSERT INTO advt_spns_soln VALUES "+
"(advt_spns_soln_id.nextval,'"+firstName+"','"+lastName+"','"+title+
"','"+
company+"','"+companyAddress+"','"+city+"','"+stateId+"',"+postalcode+",'"+
country+"','"+email+"',"+phone+",'"+url+"','"+campaign+"',"+webpurchased+",'"+
targetAdvt+"','"+trial+"','"+budget+"','"+marketobjective+"','"+emailupdate+"')");
Dont forget to remove single quotes for the variable webpurchased in the
query statement.
Thanks
Yoge
Jignesh Patel wrote:
>Hi All,
>I am following query to insert value in databse now suppose value of
>"webpurchased","targetadvt" and 'trial" is null then how can I can insert
>same null value in database.
>Because my parameter is like String webpurchased=null --In this case value of
>webpurchase will be replaced by string 'null' while insering, which is
>meaning less. I want to insert real null.
>
>MY query:
> stmt.executeQuery("INSERT INTO advt_spns_soln VALUES "+
> "(advt_spns_soln_id.nextval,'"+firstName+"','"+lastName+"','"+title+ "','"+
>company+"','"+companyAddress+"','"+city+"','"+stateId+"',"+postalcode+",'"+
>country+"','"+email+"',"+phone+",'"+url+"','"+campaign+"','"+webpurchased+"','"+
>targetAdvt+"','"+trial+"','"+budget+"','"+marketobjective+"','"+emailupdate+"')");
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
how to insert null using sql query in java code
Posted by Jignesh Patel <jp...@bangracing.com>.
Hi All,
I am following query to insert value in databse now suppose value of
"webpurchased","targetadvt" and 'trial" is null then how can I can insert
same null value in database.
Because my parameter is like String webpurchased=null --In this case value of
webpurchase will be replaced by string 'null' while insering, which is
meaning less. I want to insert real null.
MY query:
stmt.executeQuery("INSERT INTO advt_spns_soln VALUES "+
"(advt_spns_soln_id.nextval,'"+firstName+"','"+lastName+"','"+title+ "','"+
company+"','"+companyAddress+"','"+city+"','"+stateId+"',"+postalcode+",'"+
country+"','"+email+"',"+phone+",'"+url+"','"+campaign+"','"+webpurchased+"','"+
targetAdvt+"','"+trial+"','"+budget+"','"+marketobjective+"','"+emailupdate+"')");
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to generate a static web site from struts form output ?
Posted by Mark Lowe <ma...@boxstuff.com>.
wget or curl would be one way..
On 25 Apr 2004, at 09:28, Farid C wrote:
> Good Morning
>
> I have a struts application with a form
> to browse a product catalog (database back end).
>
> A usual query is to ask to show all the products
> so instead to use cpu each time a user
> requests by the form to see all the products,
> I would like to generate static html files
> with all the products
>
> Do you have any idea what could be an elegant solution
> ?
>
> I thought to write a standalone program who would
> connect the database to get all the products and
> generate the html pages on the disk.
>
> Or to write a robot to simulate a user who connects
> to the web site, ask by the form to see all the
> products and browse in the output pages to dump them
> on the web site.
>
> I would appreciate any idea to code as less possible,
> may be there are already some tools for this kind of
> problems.
>
> Thank you for your time
> F
>
>
>
>
>
>
> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger
> !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org